Use master-detals pattern for settings

This commit is contained in:
Koitharu
2022-04-02 09:09:01 +03:00
parent b916d4016e
commit 41fb351fe0
49 changed files with 578 additions and 688 deletions

View File

@@ -1,84 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
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:initialExpandedChildrenCount="5">
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
app:iconSpaceReserved="false"
app:title="@string/app_name">
<PreferenceCategory android:title="@string/app_name">
<Preference
app:iconSpaceReserved="false"
app:key="app_version"
app:persistent="false"
app:summary="@string/check_for_updates" />
android:key="app_version"
android:persistent="false"
android:summary="@string/check_for_updates" />
<SwitchPreferenceCompat
app:defaultValue="true"
app:iconSpaceReserved="false"
app:isPreferenceVisible="false"
app:key="app_update_auto"
app:summary="@string/show_notification_app_update"
app:title="@string/application_update"
tools:isPreferenceVisible="true" />
<Preference
app:iconSpaceReserved="false"
app:key="about_app_translation"
app:summary="@string/about_app_translation_summary"
app:title="@string/about_app_translation" />
<Preference
app:iconSpaceReserved="false"
app:key="about_support_developer"
app:summary="@string/about_support_developer_summary"
app:title="@string/about_support_developer" />
<Preference
app:iconSpaceReserved="false"
app:key="about_gratitudes"
app:summary="@string/about_gratitudes_summary"
app:title="@string/about_gratitudes" />
android:defaultValue="true"
android:key="app_update_auto"
android:summary="@string/show_notification_app_update"
android:title="@string/application_update" />
</PreferenceCategory>
<PreferenceCategory
app:iconSpaceReserved="false"
app:title="@string/about_feedback">
<PreferenceCategory android:title="@string/about_feedback">
<Preference
app:iconSpaceReserved="false"
app:key="about_feedback_4pda"
app:summary="https://4pda.to/forum/index.php?showtopic=697669"
app:title="@string/about_feedback_4pda" />
android:key="about_feedback_github"
android:persistent="false"
android:summary="@string/url_github_issues"
android:title="@string/github" />
<Preference
app:iconSpaceReserved="false"
app:key="about_feedback_discord"
app:summary="https://discord.gg/NNJ5RgVBC5"
app:title="Discord" />
android:key="about_feedback_4pda"
android:summary="@string/url_forpda"
android:title="@string/about_feedback_4pda" />
<Preference
app:iconSpaceReserved="false"
app:key="about_feedback_github"
app:summary="https://github.com/nv95/Kotatsu/issues"
app:title="GitHub" />
</PreferenceCategory>
<PreferenceCategory
app:iconSpaceReserved="false"
app:key="copyright"
app:title="@string/about_copyright_and_licenses">
android:key="about_feedback_discord"
android:summary="@string/url_discord"
android:title="@string/discord" />
<Preference
android:fragment="org.koitharu.kotatsu.settings.about.LicenseFragment"
app:icon="@drawable/ic_copyleft"
app:iconSpaceReserved="false"
app:key="about_license"
app:title="@string/about_license" />
android:key="about_app_translation"
android:summary="@string/about_app_translation_summary"
android:title="@string/about_app_translation" />
</PreferenceCategory>

View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ListPreference
android:defaultValue="-1"
android:entries="@array/themes"
android:entryValues="@array/values_theme"
android:key="theme"
android:title="@string/theme"
app:useSimpleSummaryProvider="true" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="dynamic_theme"
android:summary="@string/dynamic_theme_summary"
android:title="@string/dynamic_theme"
app:isPreferenceVisible="false" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="amoled_theme"
android:summary="@string/black_dark_theme_summary"
android:title="@string/black_dark_theme" />
<ListPreference
android:key="date_format"
android:title="@string/date_format" />
<ListPreference
android:entries="@array/list_modes"
android:key="list_mode_2"
android:title="@string/list_mode"
app:allowDividerAbove="true"
app:useSimpleSummaryProvider="true" />
<org.koitharu.kotatsu.settings.utils.SliderPreference
android:key="grid_size"
android:stepSize="5"
android:title="@string/grid_size"
android:valueFrom="50"
android:valueTo="150"
app:defaultValue="100" />
<SwitchPreferenceCompat
android:key="protect_app"
android:persistent="false"
android:summary="@string/protect_application_summary"
android:title="@string/protect_application"
app:allowDividerAbove="true" />
</PreferenceScreen>

View File

@@ -6,14 +6,12 @@
<Preference
android:key="backup"
android:persistent="false"
android:title="@string/create_backup"
app:iconSpaceReserved="false" />
android:title="@string/create_backup" />
<Preference
android:key="restore"
android:persistent="false"
android:title="@string/restore_backup"
app:iconSpaceReserved="false" />
android:title="@string/restore_backup" />
<Preference
android:icon="@drawable/ic_info_outline"

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.sources.SourcesSettingsFragment"
android:key="remote_sources"
android:title="@string/remote_sources" />
<Preference
android:key="local_storage"
android:persistent="false"
android:title="@string/manga_save_location" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.SuggestionsSettingsFragment"
android:key="suggestions"
android:persistent="false"
android:title="@string/suggestions" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.backup.BackupSettingsFragment"
android:title="@string/backup_restore"
app:allowDividerAbove="true" />
</PreferenceScreen>

View File

@@ -1,51 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:android="http://schemas.android.com/apk/res/android">
<Preference
android:key="search_history_clear"
android:persistent="false"
android:summary="@string/loading_"
android:title="@string/clear_search_history"
app:iconSpaceReserved="false" />
android:title="@string/clear_search_history" />
<Preference
android:key="updates_feed_clear"
android:persistent="false"
android:summary="@string/loading_"
android:title="@string/clear_updates_feed"
app:iconSpaceReserved="false" />
android:title="@string/clear_updates_feed" />
<SwitchPreferenceCompat
android:key="history_exclude_nsfw"
android:title="@string/exclude_nsfw_from_history"
app:iconSpaceReserved="false" />
android:title="@string/exclude_nsfw_from_history" />
<PreferenceCategory
android:title="@string/cache"
app:iconSpaceReserved="false">
<PreferenceCategory android:title="@string/cache">
<Preference
android:key="thumbs_cache_clear"
android:persistent="false"
android:summary="@string/computing_"
android:title="@string/clear_thumbs_cache"
app:iconSpaceReserved="false" />
android:title="@string/clear_thumbs_cache" />
<Preference
android:key="pages_cache_clear"
android:persistent="false"
android:summary="@string/computing_"
android:title="@string/clear_pages_cache"
app:iconSpaceReserved="false" />
android:title="@string/clear_pages_cache" />
</PreferenceCategory>
<Preference
android:key="cookies_clear"
android:persistent="false"
android:title="@string/clear_cookies"
app:iconSpaceReserved="false" />
android:title="@string/clear_cookies" />
</PreferenceScreen>

View File

@@ -1,102 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ListPreference
android:defaultValue="-1"
android:entries="@array/themes"
android:entryValues="@array/values_theme"
android:key="theme"
android:title="@string/theme"
app:iconSpaceReserved="false"
app:useSimpleSummaryProvider="true" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="dynamic_theme"
android:summary="@string/dynamic_theme_summary"
android:title="@string/dynamic_theme"
app:iconSpaceReserved="false" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="amoled_theme"
android:summary="@string/black_dark_theme_summary"
android:title="@string/black_dark_theme"
app:iconSpaceReserved="false" />
<ListPreference
android:key="date_format"
android:title="@string/date_format"
app:iconSpaceReserved="false" />
<ListPreference
android:entries="@array/list_modes"
android:key="list_mode_2"
android:title="@string/list_mode"
app:allowDividerAbove="true"
app:iconSpaceReserved="false"
app:useSimpleSummaryProvider="true" />
<org.koitharu.kotatsu.settings.utils.SliderPreference
android:key="grid_size"
android:stepSize="5"
android:title="@string/grid_size"
android:valueFrom="50"
android:valueTo="150"
app:defaultValue="100"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.sources.SourcesSettingsFragment"
android:key="remote_sources"
android:title="@string/remote_sources"
app:allowDividerAbove="true"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.SuggestionsSettingsFragment"
android:key="suggestions"
android:persistent="false"
android:title="@string/suggestions"
app:iconSpaceReserved="false" />
<Preference
android:key="local_storage"
android:title="@string/manga_save_location"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.HistorySettingsFragment"
android:title="@string/history_and_cache"
app:iconSpaceReserved="false" />
<SwitchPreferenceCompat
android:key="protect_app"
android:persistent="false"
android:summary="@string/protect_application_summary"
android:title="@string/protect_application"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.ReaderSettingsFragment"
android:title="@string/reader_settings"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.TrackerSettingsFragment"
android:title="@string/check_for_new_chapters"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.backup.BackupSettingsFragment"
android:title="@string/backup_restore"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.about.AboutSettingsFragment"
android:title="@string/about"
app:iconSpaceReserved="false" />
</PreferenceScreen>

View File

@@ -1,23 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:android="http://schemas.android.com/apk/res/android">
<Preference
android:key="notifications_sound"
android:title="@string/notification_sound"
app:iconSpaceReserved="false" />
android:title="@string/notification_sound" />
<CheckBoxPreference
android:defaultValue="false"
android:key="notifications_vibrate"
android:title="@string/vibration"
app:iconSpaceReserved="false" />
android:title="@string/vibration" />
<CheckBoxPreference
android:defaultValue="true"
android:key="notifications_light"
android:title="@string/light_indicator"
app:iconSpaceReserved="false" />
android:title="@string/light_indicator" />
</PreferenceScreen>

View File

@@ -7,14 +7,13 @@
android:defaultValue="false"
android:key="reader_prefer_rtl"
android:summary="@string/prefer_rtl_reader_summary"
android:title="@string/prefer_rtl_reader"
app:iconSpaceReserved="false" />
android:title="@string/prefer_rtl_reader" />
<ListPreference
android:entries="@array/zoom_modes"
android:key="zoom_mode"
android:title="@string/scale_mode"
app:iconSpaceReserved="false"
app:useSimpleSummaryProvider="true" />
<MultiSelectListPreference
@@ -23,20 +22,17 @@
android:entryValues="@array/values_reader_switchers"
android:key="reader_switchers"
android:title="@string/switch_pages"
app:allowDividerAbove="true"
app:iconSpaceReserved="false" />
app:allowDividerAbove="true" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="reader_animation"
android:title="@string/pages_animation"
app:iconSpaceReserved="false" />
android:title="@string/pages_animation" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="pages_numbers"
android:title="@string/show_pages_numbers"
app:iconSpaceReserved="false" />
android:title="@string/show_pages_numbers" />
<ListPreference
android:entries="@array/screenshots_policy"
@@ -44,7 +40,7 @@
android:key="screenshots_policy"
android:title="@string/screenshots_policy"
app:defaultValue="allow"
app:iconSpaceReserved="false"
app:useSimpleSummaryProvider="true" />
<ListPreference
@@ -53,7 +49,7 @@
android:key="pages_preload"
android:title="@string/preload_pages"
app:defaultValue="2"
app:iconSpaceReserved="false"
app:useSimpleSummaryProvider="true" />
</PreferenceScreen>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.AppearanceSettingsFragment"
android:icon="@drawable/ic_appearance"
android:key="appearance"
android:title="@string/appearance" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.ContentSettingsFragment"
android:icon="@drawable/ic_manga_source"
android:key="content"
android:title="@string/content" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.HistorySettingsFragment"
android:icon="@drawable/ic_history"
android:title="@string/history_and_cache" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.ReaderSettingsFragment"
android:icon="@drawable/ic_book_page"
android:title="@string/reader_settings" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.TrackerSettingsFragment"
android:icon="@drawable/ic_feed"
android:title="@string/check_for_new_chapters" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.about.AboutSettingsFragment"
android:icon="@drawable/ic_info_outline"
android:title="@string/about" />
</PreferenceScreen>

View File

@@ -5,10 +5,9 @@
<Preference
android:key="auth"
android:order="100"
android:persistent="false"
android:title="@string/sign_in"
android:order="100"
app:allowDividerAbove="true"
app:iconSpaceReserved="false" />
app:allowDividerAbove="true" />
</PreferenceScreen>

View File

@@ -7,14 +7,12 @@
android:defaultValue="false"
android:key="suggestions"
android:summary="@string/suggestions_summary"
android:title="@string/suggestions_enable"
app:iconSpaceReserved="false" />
android:title="@string/suggestions_enable" />
<SwitchPreferenceCompat
android:dependency="suggestions"
android:key="suggestions_exclude_nsfw"
android:title="@string/exclude_nsfw_from_suggestions"
app:iconSpaceReserved="false" />
android:title="@string/exclude_nsfw_from_suggestions" />
<Preference
android:icon="@drawable/ic_info_outline"

View File

@@ -8,25 +8,23 @@
android:entries="@array/track_sources"
android:entryValues="@array/values_track_sources"
android:key="track_sources"
android:title="@string/track_sources"
app:iconSpaceReserved="false" />
android:title="@string/track_sources" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="tracker_notifications"
android:summary="@string/show_notification_new_chapters"
android:title="@string/notifications"
app:iconSpaceReserved="false" />
android:title="@string/notifications" />
<Preference
android:dependency="tracker_notifications"
android:fragment="org.koitharu.kotatsu.settings.NotificationSettingsLegacyFragment"
android:key="notifications_settings"
android:title="@string/notifications_settings"
app:iconSpaceReserved="false" />
android:title="@string/notifications_settings" />
<org.koitharu.kotatsu.settings.utils.LinksPreference
android:key="track_warning"
android:icon="@drawable/ic_info_outline"
android:key="track_warning"
android:persistent="false"
android:selectable="false"
android:summary="@string/tracker_warning"