diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt index 1c5f7a8be..a0bdd2c55 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt @@ -27,98 +27,6 @@ class SettingsGeneralController : SettingsController() { override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) { titleRes = R.string.pref_category_general - listPreference { - key = Keys.lang - titleRes = R.string.pref_language - entryValues = arrayOf("", "ar", "bg", "bn", "ca", "cs", "de", "el", "en-US", "en-GB", - "es", "fr", "hi", "hu", "in", "it", "ja", "ko", "lv", "ms", "nb-rNO", "nl", "pl", "pt", - "pt-BR", "ro", "ru", "sc", "sr", "sv", "th", "tl", "tr", "uk", "vi", "zh-rCN") - entries = entryValues.map { value -> - val locale = LocaleHelper.getLocaleFromString(value.toString()) - locale?.getDisplayName(locale)?.capitalize() - ?: context.getString(R.string.system_default) - }.toTypedArray() - defaultValue = "" - summary = "%s" - - onChange { newValue -> - val activity = activity ?: return@onChange false - val app = activity.application - LocaleHelper.changeLocale(newValue.toString()) - LocaleHelper.updateConfiguration(app, app.resources.configuration) - activity.recreate() - true - } - } - listPreference { - key = Keys.dateFormat - titleRes = R.string.pref_date_format - entryValues = arrayOf("", "MM/dd/yy", "dd/MM/yy", "yyyy-MM-dd") - entries = entryValues.map { value -> - if (value == "") { - context.getString(R.string.system_default) - } else { - value - } - }.toTypedArray() - defaultValue = "" - summary = "%s" - } - listPreference { - key = Keys.themeMode - titleRes = R.string.pref_theme_mode - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - entriesRes = arrayOf( - R.string.theme_system, - R.string.theme_light, - R.string.theme_dark) - entryValues = arrayOf( - Values.THEME_MODE_SYSTEM, - Values.THEME_MODE_LIGHT, - Values.THEME_MODE_DARK) - defaultValue = Values.THEME_MODE_SYSTEM - } else { - entriesRes = arrayOf( - R.string.theme_light, - R.string.theme_dark) - entryValues = arrayOf( - Values.THEME_MODE_LIGHT, - Values.THEME_MODE_DARK) - defaultValue = Values.THEME_MODE_LIGHT - } - - summary = "%s" - - onChange { - activity?.recreate() - true - } - } - listPreference { - key = Keys.themeDark - titleRes = R.string.pref_theme_dark - entriesRes = arrayOf( - R.string.theme_dark_default, - R.string.theme_dark_blue, - R.string.theme_dark_amoled) - entryValues = arrayOf( - Values.THEME_DARK_DEFAULT, - Values.THEME_DARK_BLUE, - Values.THEME_DARK_AMOLED) - defaultValue = Values.THEME_DARK_DEFAULT - summary = "%s" - - preferences.themeMode().asObservable() - .subscribeUntilDestroy { isVisible = it != Values.THEME_MODE_LIGHT } - - onChange { - if (preferences.themeMode().getOrDefault() != Values.THEME_MODE_LIGHT) { - activity?.recreate() - } - true - } - } intListPreference { key = Keys.startScreen titleRes = R.string.pref_start_screen @@ -140,6 +48,103 @@ class SettingsGeneralController : SettingsController() { } } + preferenceCategory { + titleRes = R.string.pref_category_display + + listPreference { + key = Keys.lang + titleRes = R.string.pref_language + entryValues = arrayOf("", "ar", "bg", "bn", "ca", "cs", "de", "el", "en-US", "en-GB", + "es", "fr", "hi", "hu", "in", "it", "ja", "ko", "lv", "ms", "nb-rNO", "nl", "pl", "pt", + "pt-BR", "ro", "ru", "sc", "sr", "sv", "th", "tl", "tr", "uk", "vi", "zh-rCN") + entries = entryValues.map { value -> + val locale = LocaleHelper.getLocaleFromString(value.toString()) + locale?.getDisplayName(locale)?.capitalize() + ?: context.getString(R.string.system_default) + }.toTypedArray() + defaultValue = "" + summary = "%s" + + onChange { newValue -> + val activity = activity ?: return@onChange false + val app = activity.application + LocaleHelper.changeLocale(newValue.toString()) + LocaleHelper.updateConfiguration(app, app.resources.configuration) + activity.recreate() + true + } + } + listPreference { + key = Keys.dateFormat + titleRes = R.string.pref_date_format + entryValues = arrayOf("", "MM/dd/yy", "dd/MM/yy", "yyyy-MM-dd") + entries = entryValues.map { value -> + if (value == "") { + context.getString(R.string.system_default) + } else { + value + } + }.toTypedArray() + defaultValue = "" + summary = "%s" + } + listPreference { + key = Keys.themeMode + titleRes = R.string.pref_theme_mode + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + entriesRes = arrayOf( + R.string.theme_system, + R.string.theme_light, + R.string.theme_dark) + entryValues = arrayOf( + Values.THEME_MODE_SYSTEM, + Values.THEME_MODE_LIGHT, + Values.THEME_MODE_DARK) + defaultValue = Values.THEME_MODE_SYSTEM + } else { + entriesRes = arrayOf( + R.string.theme_light, + R.string.theme_dark) + entryValues = arrayOf( + Values.THEME_MODE_LIGHT, + Values.THEME_MODE_DARK) + defaultValue = Values.THEME_MODE_LIGHT + } + + summary = "%s" + + onChange { + activity?.recreate() + true + } + } + listPreference { + key = Keys.themeDark + titleRes = R.string.pref_theme_dark + entriesRes = arrayOf( + R.string.theme_dark_default, + R.string.theme_dark_blue, + R.string.theme_dark_amoled) + entryValues = arrayOf( + Values.THEME_DARK_DEFAULT, + Values.THEME_DARK_BLUE, + Values.THEME_DARK_AMOLED) + defaultValue = Values.THEME_DARK_DEFAULT + summary = "%s" + + preferences.themeMode().asObservable() + .subscribeUntilDestroy { isVisible = it != Values.THEME_MODE_LIGHT } + + onChange { + if (preferences.themeMode().getOrDefault() != Values.THEME_MODE_LIGHT) { + activity?.recreate() + } + true + } + } + } + preferenceCategory { titleRes = R.string.pref_category_security diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt index 12c6be550..41e24d15d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt @@ -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 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 16b615243..b07acefe3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -147,7 +147,7 @@ Hide app contents when switching apps and block screenshots - Display + Display Library manga per row Portrait Landscape