home: fix misaligned grant/retry button
Caused by naive visibility logic when I added the "More" button prior. Resolves #544.
This commit is contained in:
parent
e912120f9f
commit
e32fc6b609
3 changed files with 39 additions and 36 deletions
|
@ -335,7 +335,6 @@ class HomeFragment :
|
||||||
logD("Received ok response")
|
logD("Received ok response")
|
||||||
binding.homeFab.show()
|
binding.homeFab.show()
|
||||||
binding.homeIndexingContainer.visibility = View.INVISIBLE
|
binding.homeIndexingContainer.visibility = View.INVISIBLE
|
||||||
binding.homeIndexingError.visibility = View.INVISIBLE
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,13 +342,13 @@ class HomeFragment :
|
||||||
val context = requireContext()
|
val context = requireContext()
|
||||||
binding.homeIndexingContainer.visibility = View.VISIBLE
|
binding.homeIndexingContainer.visibility = View.VISIBLE
|
||||||
binding.homeIndexingProgress.visibility = View.INVISIBLE
|
binding.homeIndexingProgress.visibility = View.INVISIBLE
|
||||||
|
binding.homeIndexingActions.visibility = View.VISIBLE
|
||||||
when (error) {
|
when (error) {
|
||||||
is NoAudioPermissionException -> {
|
is NoAudioPermissionException -> {
|
||||||
logD("Showing permission prompt")
|
logD("Showing permission prompt")
|
||||||
binding.homeIndexingStatus.text = context.getString(R.string.err_no_perms)
|
binding.homeIndexingStatus.text = context.getString(R.string.err_no_perms)
|
||||||
// Configure the action to act as a permission launcher.
|
// Configure the action to act as a permission launcher.
|
||||||
binding.homeIndexingAction.apply {
|
binding.homeIndexingTry.apply {
|
||||||
visibility = View.VISIBLE
|
|
||||||
text = context.getString(R.string.lbl_grant)
|
text = context.getString(R.string.lbl_grant)
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
requireNotNull(storagePermissionLauncher) {
|
requireNotNull(storagePermissionLauncher) {
|
||||||
|
@ -358,29 +357,29 @@ class HomeFragment :
|
||||||
.launch(PERMISSION_READ_AUDIO)
|
.launch(PERMISSION_READ_AUDIO)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
binding.homeIndexingError.visibility = View.INVISIBLE
|
binding.homeIndexingMore.visibility = View.GONE
|
||||||
}
|
}
|
||||||
is NoMusicException -> {
|
is NoMusicException -> {
|
||||||
logD("Showing no music error")
|
logD("Showing no music error")
|
||||||
binding.homeIndexingStatus.text = context.getString(R.string.err_no_music)
|
binding.homeIndexingStatus.text = context.getString(R.string.err_no_music)
|
||||||
// Configure the action to act as a reload trigger.
|
// Configure the action to act as a reload trigger.
|
||||||
binding.homeIndexingAction.apply {
|
binding.homeIndexingTry.apply {
|
||||||
visibility = View.VISIBLE
|
visibility = View.VISIBLE
|
||||||
text = context.getString(R.string.lbl_retry)
|
text = context.getString(R.string.lbl_retry)
|
||||||
setOnClickListener { musicModel.refresh() }
|
setOnClickListener { musicModel.refresh() }
|
||||||
}
|
}
|
||||||
binding.homeIndexingError.visibility = View.INVISIBLE
|
binding.homeIndexingMore.visibility = View.GONE
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
logD("Showing generic error")
|
logD("Showing generic error")
|
||||||
binding.homeIndexingStatus.text = context.getString(R.string.err_index_failed)
|
binding.homeIndexingStatus.text = context.getString(R.string.err_index_failed)
|
||||||
// Configure the action to act as a reload trigger.
|
// Configure the action to act as a reload trigger.
|
||||||
binding.homeIndexingAction.apply {
|
binding.homeIndexingTry.apply {
|
||||||
visibility = View.VISIBLE
|
visibility = View.VISIBLE
|
||||||
text = context.getString(R.string.lbl_retry)
|
text = context.getString(R.string.lbl_retry)
|
||||||
setOnClickListener { musicModel.rescan() }
|
setOnClickListener { musicModel.rescan() }
|
||||||
}
|
}
|
||||||
binding.homeIndexingError.apply {
|
binding.homeIndexingMore.apply {
|
||||||
visibility = View.VISIBLE
|
visibility = View.VISIBLE
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
findNavController().navigateSafe(HomeFragmentDirections.reportError(error))
|
findNavController().navigateSafe(HomeFragmentDirections.reportError(error))
|
||||||
|
@ -394,7 +393,7 @@ class HomeFragment :
|
||||||
// Remove all content except for the progress indicator.
|
// Remove all content except for the progress indicator.
|
||||||
binding.homeIndexingContainer.visibility = View.VISIBLE
|
binding.homeIndexingContainer.visibility = View.VISIBLE
|
||||||
binding.homeIndexingProgress.visibility = View.VISIBLE
|
binding.homeIndexingProgress.visibility = View.VISIBLE
|
||||||
binding.homeIndexingAction.visibility = View.INVISIBLE
|
binding.homeIndexingActions.visibility = View.INVISIBLE
|
||||||
|
|
||||||
when (progress) {
|
when (progress) {
|
||||||
is IndexingProgress.Indeterminate -> {
|
is IndexingProgress.Indeterminate -> {
|
||||||
|
|
|
@ -29,6 +29,7 @@ import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import kotlinx.coroutines.yield
|
import kotlinx.coroutines.yield
|
||||||
|
|
|
@ -70,8 +70,8 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_margin="@dimen/spacing_medium"
|
android:layout_margin="@dimen/spacing_medium"
|
||||||
android:fitsSystemWindows="true"
|
android:visibility="invisible"
|
||||||
android:visibility="invisible">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
android:layout_margin="@dimen/spacing_medium"
|
android:layout_margin="@dimen/spacing_medium"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textAppearance="@style/TextAppearance.Auxio.BodyLarge"
|
android:textAppearance="@style/TextAppearance.Auxio.BodyLarge"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/home_indexing_action"
|
app:layout_constraintBottom_toTopOf="@+id/home_indexing_actions"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintVertical_chainStyle="packed"
|
app:layout_constraintVertical_chainStyle="packed"
|
||||||
tools:text="Status" />
|
tools:text="Status" />
|
||||||
|
@ -103,37 +103,40 @@
|
||||||
android:layout_marginEnd="@dimen/spacing_medium"
|
android:layout_marginEnd="@dimen/spacing_medium"
|
||||||
android:indeterminate="true"
|
android:indeterminate="true"
|
||||||
app:indeterminateAnimationType="disjoint"
|
app:indeterminateAnimationType="disjoint"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/home_indexing_action"
|
app:layout_constraintBottom_toBottomOf="@+id/home_indexing_actions"
|
||||||
app:layout_constraintTop_toTopOf="@+id/home_indexing_action" />
|
app:layout_constraintTop_toTopOf="@+id/home_indexing_actions" />
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
<LinearLayout
|
||||||
android:id="@+id/home_indexing_action"
|
android:id="@+id/home_indexing_actions"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
android:layout_marginStart="@dimen/spacing_medium"
|
android:layout_marginStart="@dimen/spacing_medium"
|
||||||
android:layout_marginEnd="@dimen/spacing_small"
|
android:layout_marginEnd="@dimen/spacing_medium"
|
||||||
android:layout_marginBottom="@dimen/spacing_medium"
|
android:layout_marginBottom="@dimen/spacing_medium"
|
||||||
android:text="@string/lbl_retry"
|
|
||||||
style="@style/Widget.Auxio.Button.Secondary"
|
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
tools:layout_editor_absoluteX="16dp">
|
||||||
app:layout_constraintEnd_toStartOf="@+id/home_indexing_error"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/home_indexing_status" />
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||||
android:id="@+id/home_indexing_error"
|
android:id="@+id/home_indexing_try"
|
||||||
|
style="@style/Widget.Auxio.Button.Primary"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/spacing_small"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/lbl_retry" />
|
||||||
|
|
||||||
|
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||||
|
android:id="@+id/home_indexing_more"
|
||||||
|
style="@style/Widget.Auxio.Button.Secondary"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/spacing_small"
|
android:layout_marginStart="@dimen/spacing_small"
|
||||||
android:layout_marginEnd="@dimen/spacing_medium"
|
android:layout_weight="1"
|
||||||
android:text="@string/lbl_show_error_info"
|
android:text="@string/lbl_show_error_info" />
|
||||||
style="@style/Widget.Auxio.Button.Primary"
|
|
||||||
android:visibility="invisible"
|
</LinearLayout>
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/home_indexing_action"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/home_indexing_action"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/home_indexing_action" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue