home: add music loading error dialog

Add a dialog that shows the stack trace of a music loading error.

This is an MVP that is only available to music loading to resolve some
immediate issues.

Resolves #527.
This commit is contained in:
Alexander Capehart
2023-08-14 17:46:01 -06:00
parent ada29b2f7a
commit f5c7f25cdf
13 changed files with 294 additions and 85 deletions
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M200,880Q167,880 143.5,856.5Q120,833 120,800L120,240L200,240L200,800Q200,800 200,800Q200,800 200,800L640,800L640,880L200,880ZM360,720Q327,720 303.5,696.5Q280,673 280,640L280,160Q280,127 303.5,103.5Q327,80 360,80L720,80Q753,80 776.5,103.5Q800,127 800,160L800,640Q800,673 776.5,696.5Q753,720 720,720L360,720ZM360,640L720,640Q720,640 720,640Q720,640 720,640L720,160Q720,160 720,160Q720,160 720,160L360,160Q360,160 360,160Q360,160 360,160L360,640Q360,640 360,640Q360,640 360,640ZM360,640Q360,640 360,640Q360,640 360,640L360,160Q360,160 360,160Q360,160 360,160L360,160Q360,160 360,160Q360,160 360,160L360,640Q360,640 360,640Q360,640 360,640L360,640Z"/>
</vector>
@@ -69,8 +69,8 @@
android:id="@+id/playback_seek_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_small"
android:layout_marginEnd="@dimen/spacing_small"
android:layout_marginStart="@dimen/spacing_tiny"
android:layout_marginEnd="@dimen/spacing_tiny"
app:layout_constraintBottom_toTopOf="@+id/playback_controls_container"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/spacing_medium"
android:paddingEnd="@dimen/spacing_large"
android:paddingStart="@dimen/spacing_large"
tools:context=".MainActivity">
<com.google.android.material.card.MaterialCardView
android:id="@+id/error_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/Widget.Material3.CardView.Filled"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<TextView
android:id="@+id/error_stack_trace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/spacing_medium"
android:paddingStart="@dimen/spacing_medium"
android:paddingBottom="@dimen/spacing_medium"
android:paddingEnd="@dimen/size_copy_button"
android:breakStrategy="simple"
android:hyphenationFrequency="none"
android:typeface="monospace"
tools:text="Stack trace here" />
</HorizontalScrollView>
</ScrollView>
<com.google.android.material.button.MaterialButton
android:id="@+id/error_copy"
style="@style/Widget.Auxio.Button.Icon.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
app:icon="@drawable/ic_copy_24"
android:layout_margin="@dimen/spacing_small"
app:backgroundTint="?attr/colorPrimaryContainer"
android:src="@drawable/ic_code_24" />
</FrameLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>
+19 -2
View File
@@ -108,16 +108,33 @@
<org.oxycblt.auxio.ui.RippleFixMaterialButton
android:id="@+id/home_indexing_action"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_medium"
android:layout_marginEnd="@dimen/spacing_medium"
android:layout_marginEnd="@dimen/spacing_small"
android:layout_marginBottom="@dimen/spacing_medium"
android:text="@string/lbl_retry"
style="@style/Widget.Auxio.Button.Secondary"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/home_indexing_error"
app:layout_constraintTop_toBottomOf="@+id/home_indexing_status" />
<org.oxycblt.auxio.ui.RippleFixMaterialButton
android:id="@+id/home_indexing_error"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_small"
android:layout_marginEnd="@dimen/spacing_medium"
android:text="@string/lbl_show_error_info"
style="@style/Widget.Auxio.Button.Primary"
android:visibility="invisible"
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>
</com.google.android.material.card.MaterialCardView>
+13
View File
@@ -81,8 +81,21 @@
<action
android:id="@+id/play_from_genre"
app:destination="@id/play_from_genre_dialog" />
<action
android:id="@+id/report_error"
app:destination="@id/error_details_dialog" />
</fragment>
<dialog
android:id="@+id/error_details_dialog"
android:name="org.oxycblt.auxio.home.ErrorDetailsDialog"
android:label="error_details_dialog"
tools:layout="@layout/dialog_error_details">
<argument
android:name="error"
app:argType="java.lang.Exception" />
</dialog>
<dialog
android:id="@+id/song_sort_dialog"
android:name="org.oxycblt.auxio.home.sort.SongSortDialog"
+1
View File
@@ -23,6 +23,7 @@
<dimen name="size_btn">48dp</dimen>
<dimen name="size_accent_item">56dp</dimen>
<dimen name="size_bottom_sheet_bar">64dp</dimen>
<dimen name="size_copy_button">64dp</dimen>
<dimen name="size_play_pause_button">72dp</dimen>
<dimen name="size_icon_small">24dp</dimen>
+8
View File
@@ -16,6 +16,8 @@
<string name="lbl_observing">Monitoring music library</string>
<!-- As in to retry loading music -->
<string name="lbl_retry">Retry</string>
<!-- As in to show additional information about a music loading error -->
<string name="lbl_show_error_info">More</string>
<!-- As in grant permission -->
<string name="lbl_grant">Grant</string>
@@ -168,6 +170,12 @@
<string name="lbl_selection">Selection</string>
<string name="lbl_error_info">Error information</string>
<!-- As in copied to the system clipboard -->
<string name="lbl_copied">Copied</string>
<!-- As in to report an error -->
<string name="lbl_report">Report</string>
<!-- Long Namespace | Longer Descriptions -->
<eat-comment />