Add Loading fallback states

Add fallback states for when there is no music & if the load fails, along with a retry button if that happens.
This commit is contained in:
OxygenCobalt
2020-08-19 10:10:36 -06:00
parent 1b21552576
commit 24452e8fa4
8 changed files with 116 additions and 26 deletions
@@ -19,5 +19,4 @@
tools:ignore="FragmentTagUsage" />
</FrameLayout>
</layout>
+1 -2
View File
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app="http://schemas.android.com/apk/res-auto"
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
+27 -5
View File
@@ -3,6 +3,13 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="loadingModel"
type="org.oxycblt.auxio.loading.LoadingViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -14,22 +21,37 @@
android:indeterminateTint="?attr/colorAccent"
android:indeterminateTintMode="src_in"
android:paddingBottom="@dimen/padding_small"
app:layout_constraintBottom_toTopOf="@+id/text_indexing_library"
app:layout_constraintBottom_toTopOf="@+id/status_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"/>
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/text_indexing_library"
android:id="@+id/status_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/label_loading_music"
app:layout_constraintBottom_toBottomOf="parent"
android:text="@string/status_loading_music"
app:layout_constraintBottom_toTopOf="@+id/reset_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/loading_bar" />
<Button
android:id="@+id/reset_button"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/label_retry"
android:onClick="@{() -> loadingModel.retry()}"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/status_text" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
+1 -1
View File
@@ -9,7 +9,7 @@
android:id="@+id/loadingFragment"
android:name="org.oxycblt.auxio.loading.LoadingFragment"
android:label="LoadingFragment"
tools:layout="@layout/fragment_loading" >
tools:layout="@layout/fragment_loading">
<action
android:id="@+id/action_to_library"
app:destination="@id/libraryFragment" />
+6 -1
View File
@@ -2,7 +2,12 @@
<resources>
<string name="app_name">Auxio</string>
<string name="label_loading_music">Scanning your music library for the first time...</string>
<string name="status_loading_music">Scanning your music library for the first time...</string>
<string name="error_no_music">No music found.</string>
<string name="error_music_load_failed">Music loading failed.</string>
<string name="label_retry">Retry</string>
<string name="title_library_fragment">Library</string>
</resources>