settings: use manual nav graph

Manually use our own navigation graph in the new settings view.

This avoids a crash that occurs with the default preferences navigation
(on some devices) where the differing app IDs between debug and release
makes it so that the fragments cannot be found. Because you know.
Android.
This commit is contained in:
Alexander Capehart
2023-01-20 18:38:10 -07:00
parent f2d44b40bf
commit 90843918d6
13 changed files with 113 additions and 102 deletions
@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:background="?attr/colorSurface"
android:orientation="vertical"
android:transitionGroup="true">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/settings_list_fragment"
android:name="org.oxycblt.auxio.settings.ui.RootPreferenceFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
tools:layout="@android:layout/preference_category" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
+48 -11
View File
@@ -10,7 +10,7 @@
tools:layout="@layout/fragment_main">
<action
android:id="@+id/action_show_settings"
app:destination="@id/settings_fragment" />
app:destination="@id/root_preferences_fragment" />
<action
android:id="@+id/action_show_about"
app:destination="@id/about_fragment" />
@@ -68,27 +68,64 @@
app:argType="org.oxycblt.auxio.music.Music$UID" />
</dialog>
<fragment
android:id="@+id/settings_fragment"
android:name="org.oxycblt.auxio.settings.SettingsFragment"
android:label="fragment_settings"
tools:layout="@layout/fragment_settings">
android:id="@+id/root_preferences_fragment"
android:name="org.oxycblt.auxio.settings.RootPreferenceFragment"
android:label="fragment_settings">
<action
android:id="@+id/go_to_accent_dialog"
app:destination="@id/accent_dialog" />
android:id="@+id/go_to_ui_preferences"
app:destination="@id/ui_preferences_fragment" />
<action
android:id="@+id/go_to_tab_dialog"
app:destination="@id/tab_dialog" />
android:id="@+id/go_to_personalize_preferences"
app:destination="@id/personalize_preferences_fragment" />
<action
android:id="@+id/go_to_pre_amp_dialog"
app:destination="@id/pre_amp_dialog" />
android:id="@+id/go_to_music_preferences"
app:destination="@id/music_preferences_fragment" />
<action
android:id="@+id/go_to_audio_preferences"
app:destination="@id/audio_preferences_fragment" />
<action
android:id="@+id/go_to_music_dirs_dialog"
app:destination="@id/music_dirs_dialog" />
</fragment>
<fragment
android:id="@+id/ui_preferences_fragment"
android:name="org.oxycblt.auxio.settings.categories.UIPreferenceFragment"
android:label="fragment_ui_preferences">
<action
android:id="@+id/go_to_accent_dialog"
app:destination="@id/accent_dialog" />
</fragment>
<fragment
android:id="@+id/personalize_preferences_fragment"
android:name="org.oxycblt.auxio.settings.categories.PersonalizePreferenceFragment"
android:label="fragment_personalize_preferences">
<action
android:id="@+id/go_to_tab_dialog"
app:destination="@id/tab_dialog" />
</fragment>
<fragment
android:id="@+id/music_preferences_fragment"
android:name="org.oxycblt.auxio.settings.categories.MusicPreferenceFragment"
android:label="fragment_personalize_preferences">
<action
android:id="@+id/go_to_separators_dialog"
app:destination="@id/separators_dialog" />
</fragment>
<fragment
android:id="@+id/audio_preferences_fragment"
android:name="org.oxycblt.auxio.settings.categories.AudioPreferenceFragment"
android:label="fragment_personalize_preferences">
<action
android:id="@+id/go_to_pre_amp_dialog"
app:destination="@id/pre_amp_dialog" />
</fragment>
<dialog
android:id="@+id/accent_dialog"
android:name="org.oxycblt.auxio.ui.accent.AccentCustomizeDialog"
+5
View File
@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Note: The old way of naming keys was to prefix them with KEY_. Now it's to prefix them with auxio_. -->
<string name="set_key_ui" translatable="false">auxio_ui</string>
<string name="set_key_personalize" translatable="false">auxio_personalize</string>
<string name="set_key_music" translatable="false">auxio_music</string>
<string name="set_key_audio" translatable="false">auxio_audio</string>
<string name="set_key_theme" translatable="false">KEY_THEME2</string>
<string name="set_key_black_theme" translatable="false">KEY_BLACK_THEME</string>
<string name="set_key_accent" translatable="false">auxio_accent2</string>
+4 -4
View File
@@ -3,26 +3,26 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/set_root_title">
<Preference
app:fragment="org.oxycblt.auxio.settings.ui.UIPreferenceFragment"
app:icon="@drawable/ic_accent_24"
app:key="@string/set_key_ui"
app:summary="@string/set_ui_desc"
app:title="@string/set_ui" />
<Preference
app:fragment="org.oxycblt.auxio.settings.ui.PersonalizePreferenceFragment"
app:icon="@drawable/ic_config_24"
app:key="@string/set_key_personalize"
app:summary="@string/set_personalize_desc"
app:title="@string/set_personalize" />
<Preference
app:fragment="org.oxycblt.auxio.settings.ui.MusicPreferenceFragment"
app:icon="@drawable/ic_song_24"
app:key="@string/set_key_music"
app:summary="@string/set_content_desc"
app:title="@string/set_content" />
<Preference
app:fragment="org.oxycblt.auxio.settings.ui.AudioPreferenceFragment"
app:icon="@drawable/ic_play_24"
app:key="@string/set_key_audio"
app:summary="@string/set_audio_desc"
app:title="@string/set_audio" />