Categorize library settings

This commit is contained in:
arkon 2020-02-02 18:04:50 -05:00
parent 6f84815801
commit 4f03ee814a
2 changed files with 132 additions and 116 deletions

View File

@ -27,6 +27,9 @@ class SettingsLibraryController : SettingsController() {
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) { override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
titleRes = R.string.pref_category_library titleRes = R.string.pref_category_library
preferenceCategory {
titleRes = R.string.pref_category_library_display
preference { preference {
titleRes = R.string.pref_library_columns titleRes = R.string.pref_library_columns
onClick { onClick {
@ -51,6 +54,14 @@ class SettingsLibraryController : SettingsController() {
"${context.getString(R.string.landscape)}: $landscape" "${context.getString(R.string.landscape)}: $landscape"
} }
} }
}
val dbCategories = db.getCategories().executeAsBlocking()
val categories = listOf(Category.createDefault()) + dbCategories
preferenceCategory {
titleRes = R.string.pref_category_library_update
intListPreference { intListPreference {
key = Keys.libraryUpdateInterval key = Keys.libraryUpdateInterval
titleRes = R.string.pref_library_update_interval titleRes = R.string.pref_library_update_interval
@ -93,10 +104,6 @@ class SettingsLibraryController : SettingsController() {
titleRes = R.string.pref_update_only_non_completed titleRes = R.string.pref_update_only_non_completed
defaultValue = false defaultValue = false
} }
val dbCategories = db.getCategories().executeAsBlocking()
val categories = listOf(Category.createDefault()) + dbCategories
multiSelectListPreference { multiSelectListPreference {
key = Keys.libraryUpdateCategories key = Keys.libraryUpdateCategories
titleRes = R.string.pref_library_update_categories titleRes = R.string.pref_library_update_categories
@ -139,6 +146,11 @@ class SettingsLibraryController : SettingsController() {
true true
} }
} }
}
preferenceCategory {
titleRes = R.string.pref_category_library_categories
intListPreference { intListPreference {
key = Keys.defaultCategory key = Keys.defaultCategory
titleRes = R.string.default_category titleRes = R.string.default_category
@ -158,6 +170,7 @@ class SettingsLibraryController : SettingsController() {
} }
} }
} }
}
class LibraryColumnsDialog : DialogController() { class LibraryColumnsDialog : DialogController() {

View File

@ -126,12 +126,16 @@
<string name="pref_start_screen">Start screen</string> <string name="pref_start_screen">Start screen</string>
<string name="pref_language">Language</string> <string name="pref_language">Language</string>
<string name="system_default">System default</string> <string name="system_default">System default</string>
<string name="pref_date_format">Date format</string>
<!-- Library section --> <!-- Library section -->
<string name="pref_category_library_display">Display</string>
<string name="pref_library_columns">Library manga per row</string> <string name="pref_library_columns">Library manga per row</string>
<string name="portrait">Portrait</string> <string name="portrait">Portrait</string>
<string name="landscape">Landscape</string> <string name="landscape">Landscape</string>
<string name="default_columns">Default</string> <string name="default_columns">Default</string>
<string name="pref_category_library_update">Updates</string>
<string name="pref_library_update_interval">Library update frequency</string> <string name="pref_library_update_interval">Library update frequency</string>
<string name="update_never">Manual</string> <string name="update_never">Manual</string>
<string name="update_1hour">Hourly</string> <string name="update_1hour">Hourly</string>
@ -143,19 +147,18 @@
<string name="update_48hour">Every 2 days</string> <string name="update_48hour">Every 2 days</string>
<string name="update_weekly">Weekly</string> <string name="update_weekly">Weekly</string>
<string name="update_monthly">Monthly</string> <string name="update_monthly">Monthly</string>
<string name="pref_library_update_categories">Categories to include in global update</string>
<string name="all">All</string>
<string name="pref_library_update_prioritization">Library update order</string> <string name="pref_library_update_prioritization">Library update order</string>
<string name="pref_library_update_restriction">Library update restrictions</string> <string name="pref_library_update_restriction">Library update restrictions</string>
<string name="pref_library_update_restriction_summary">Update only when the conditions are met</string> <string name="pref_library_update_restriction_summary">Update only when the conditions are met</string>
<string name="wifi">Wi-Fi</string> <string name="wifi">Wi-Fi</string>
<string name="charging">Charging</string> <string name="charging">Charging</string>
<string name="pref_update_only_non_completed">Only update ongoing manga</string> <string name="pref_update_only_non_completed">Only update ongoing manga</string>
<string name="pref_auto_update_manga_sync">Sync chapters after reading</string>
<string name="pref_ask_update_manga_sync">Confirm before updating</string> <string name="pref_category_library_categories">Categories</string>
<string name="pref_date_format">Date format</string>
<string name="default_category">Default category</string> <string name="default_category">Default category</string>
<string name="default_category_summary">Always ask</string> <string name="default_category_summary">Always ask</string>
<string name="pref_library_update_categories">Categories to include in global update</string>
<string name="all">All</string>
<!-- Extension section --> <!-- Extension section -->
<string name="all_lang">All</string> <string name="all_lang">All</string>
@ -239,7 +242,6 @@
<string name="color_filter_b_value">B</string> <string name="color_filter_b_value">B</string>
<string name="color_filter_a_value">A</string> <string name="color_filter_a_value">A</string>
<!-- Downloads section --> <!-- Downloads section -->
<string name="pref_download_directory">Downloads directory</string> <string name="pref_download_directory">Downloads directory</string>
<string name="pref_download_only_over_wifi">Only download over Wi-Fi</string> <string name="pref_download_only_over_wifi">Only download over Wi-Fi</string>
@ -256,6 +258,7 @@
<string name="pref_download_new_categories">Categories to include in download</string> <string name="pref_download_new_categories">Categories to include in download</string>
<!-- Sync section --> <!-- Sync section -->
<string name="pref_auto_update_manga_sync">Sync chapters after reading</string>
<string name="services">Services</string> <string name="services">Services</string>
<!-- Backup section --> <!-- Backup section -->