detail: add loading indicator to song detail

Add a loading indicator to the song detail view.

This should make the loading process clearer for some songs that take
longer to load.
This commit is contained in:
Alexander Capehart 2022-11-22 11:15:02 -07:00
parent 668fe86479
commit 0598409ca5
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
3 changed files with 107 additions and 88 deletions

View file

@ -25,6 +25,7 @@
- Allowed light/dark theme to be customized on Android 12+ - Allowed light/dark theme to be customized on Android 12+
- All information now scrolls in the playback view - All information now scrolls in the playback view
- A month is now shown for song/album dates when available - A month is now shown for song/album dates when available
- Added loading indicator to song properties view
#### What's Fixed #### What's Fixed
- Fixed issue where the scroll popup would not display correctly in landscape mode [#230] - Fixed issue where the scroll popup would not display correctly in landscape mode [#230]

View file

@ -22,6 +22,7 @@ import android.text.format.Formatter
import android.view.LayoutInflater import android.view.LayoutInflater
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.core.view.isInvisible
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs import androidx.navigation.fragment.navArgs
import org.oxycblt.auxio.R import org.oxycblt.auxio.R
@ -64,8 +65,10 @@ class SongDetailDialog : ViewBindingDialogFragment<DialogSongDetailBinding>() {
if (song != null) { if (song != null) {
if (song.info != null) { if (song.info != null) {
binding.detailLoading.isInvisible = true
binding.detailContainer.isInvisible = false
val context = requireContext() val context = requireContext()
binding.detailContainer.isGone = false
binding.detailFileName.setText(song.song.path.name) binding.detailFileName.setText(song.song.path.name)
binding.detailRelativeDir.setText(song.song.path.parent.resolveName(context)) binding.detailRelativeDir.setText(song.song.path.parent.resolveName(context))
binding.detailFormat.setText(song.info.resolvedMimeType.resolveName(context)) binding.detailFormat.setText(song.info.resolvedMimeType.resolveName(context))
@ -86,7 +89,8 @@ class SongDetailDialog : ViewBindingDialogFragment<DialogSongDetailBinding>() {
binding.detailSampleRate.setText(R.string.def_sample_rate) binding.detailSampleRate.setText(R.string.def_sample_rate)
} }
} else { } else {
binding.detailContainer.isGone = true binding.detailLoading.isInvisible = false
binding.detailContainer.isInvisible = true
} }
} else { } else {
findNavController().navigateUp() findNavController().navigateUp()

View file

@ -10,16 +10,28 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true">
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/detail_loading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/spacing_large"
android:paddingEnd="@dimen/spacing_large"
android:layout_gravity="center"
android:indeterminate="true"
app:indeterminateAnimationType="disjoint" />
<LinearLayout <LinearLayout
android:id="@+id/detail_container" android:id="@+id/detail_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="@dimen/spacing_large" android:paddingStart="@dimen/spacing_large"
android:paddingEnd="@dimen/spacing_large" android:paddingEnd="@dimen/spacing_large">
android:showDividers="middle"
android:visibility="gone"
tools:visibility="visible">
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -133,6 +145,8 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
</LinearLayout> </LinearLayout>
</FrameLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>