music: make musicloader async

Make MusicLoader instantiation fully asynchronous. This implementation
changes a lot about Auxio. For one, the loading screen is now gone.
However, many parts of the app now run under the fact that MusicStore
might not be available. However, I don't think there will be too much bugs
from it. Some more changes will be made to improve this implementation.
This commit is contained in:
OxygenCobalt
2021-10-24 20:01:15 -06:00
parent 926fef4218
commit fe0c2761c7
22 changed files with 286 additions and 503 deletions
@@ -55,6 +55,7 @@
android:layout_margin="@dimen/spacing_medium"
android:contentDescription="@string/desc_shuffle_all"
app:layout_anchor="@id/home_pager"
app:tint="?attr/colorControlNormal"
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"
app:layout_anchorGravity="bottom|end" />
@@ -1,64 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="loadingModel"
type="org.oxycblt.auxio.loading.LoadingViewModel" />
</data>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/loading_panel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_large"
android:animateLayoutChanges="true"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<ProgressBar
android:id="@+id/loading_circle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@+id/loading_action_button"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/loading_error_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_small"
android:fontFamily="@font/inter_semibold"
android:textAlignment="center"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_medium"
android:visibility="invisible"
app:layout_constraintBottom_toTopOf="@+id/loading_action_button"
tools:text="No Music Found" />
<com.google.android.material.button.MaterialButton
android:id="@+id/loading_action_button"
style="@style/Widget.Auxio.Button.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="@dimen/spacing_insane"
android:paddingEnd="@dimen/spacing_insane"
android:text="@string/lbl_retry"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
</layout>
+1 -17
View File
@@ -2,23 +2,7 @@
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:startDestination="@id/loading_fragment">
<fragment
android:id="@+id/loading_fragment"
android:name="org.oxycblt.auxio.loading.LoadingFragment"
android:label="LoadingFragment"
tools:layout="@layout/fragment_loading">
<action
android:id="@+id/action_to_main"
app:destination="@id/main_fragment"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:launchSingleTop="true"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim"
app:popUpTo="@id/loading_fragment"
app:popUpToInclusive="true" />
</fragment>
app:startDestination="@id/main_fragment">
<fragment
android:id="@+id/main_fragment"
android:name="org.oxycblt.auxio.MainFragment"