More preference grouping

This commit is contained in:
arkon 2020-02-27 18:34:14 -05:00
parent bf8268adc4
commit 3a62acc54d
3 changed files with 99 additions and 94 deletions

View file

@ -27,6 +27,30 @@ class SettingsGeneralController : SettingsController() {
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
titleRes = R.string.pref_category_general
intListPreference {
key = Keys.startScreen
titleRes = R.string.pref_start_screen
entriesRes = arrayOf(R.string.label_library, R.string.label_recent_manga,
R.string.label_recent_updates)
entryValues = arrayOf("1", "2", "3")
defaultValue = "1"
summary = "%s"
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
preference {
titleRes = R.string.pref_manage_notifications
onClick {
val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS).apply {
putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName)
}
startActivity(intent)
}
}
}
preferenceCategory {
titleRes = R.string.pref_category_display
listPreference {
key = Keys.lang
titleRes = R.string.pref_language
@ -119,25 +143,6 @@ class SettingsGeneralController : SettingsController() {
true
}
}
intListPreference {
key = Keys.startScreen
titleRes = R.string.pref_start_screen
entriesRes = arrayOf(R.string.label_library, R.string.label_recent_manga,
R.string.label_recent_updates)
entryValues = arrayOf("1", "2", "3")
defaultValue = "1"
summary = "%s"
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
preference {
titleRes = R.string.pref_manage_notifications
onClick {
val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS).apply {
putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName)
}
startActivity(intent)
}
}
}
preferenceCategory {

View file

@ -41,7 +41,7 @@ class SettingsLibraryController : SettingsController() {
titleRes = R.string.pref_category_library
preferenceCategory {
titleRes = R.string.pref_category_library_display
titleRes = R.string.pref_category_display
preference {
titleRes = R.string.pref_library_columns

View file

@ -147,7 +147,7 @@
<string name="secure_screen_summary">Hide app contents when switching apps and block screenshots</string>
<!-- Library section -->
<string name="pref_category_library_display">Display</string>
<string name="pref_category_display">Display</string>
<string name="pref_library_columns">Library manga per row</string>
<string name="portrait">Portrait</string>
<string name="landscape">Landscape</string>