Merge light and dark themes (#5470)

* Merge AMOLED and regular dark themes

This allows all variants of dark themes to use black backgrounds as a
separate preference.

* Merge light and dark themes

* Fix ReaderSeekBar color on Dark Blue theme

* Color fixes

* Fix Dark Blue bars ripple

* Simplify night mode check
This commit is contained in:
Ivan Iskandar
2021-07-02 19:44:04 +07:00
committed by GitHub
parent 82f3677168
commit 0eadc028b6
71 changed files with 408 additions and 785 deletions
@@ -119,62 +119,30 @@ class SettingsGeneralController : SettingsController() {
}
}
listPreference {
key = Keys.themeLight
titleRes = R.string.pref_theme_light
entriesRes = arrayOf(
R.string.theme_light_default,
R.string.theme_light_blue,
R.string.theme_light_strawberrydaiquiri,
R.string.theme_light_yotsuba
)
entryValues = arrayOf(
Values.LightThemeVariant.default.name,
Values.LightThemeVariant.blue.name,
Values.LightThemeVariant.strawberrydaiquiri.name,
Values.LightThemeVariant.yotsuba.name
)
defaultValue = Values.LightThemeVariant.default.name
key = Keys.appTheme
titleRes = R.string.pref_app_theme
val appThemes = Values.AppTheme.values()
entriesRes = appThemes.map { it.titleResId }.toTypedArray()
entryValues = appThemes.map { it.name }.toTypedArray()
defaultValue = appThemes[0].name
summary = "%s"
preferences.themeMode().asImmediateFlow { isVisible = it != Values.ThemeMode.dark }
.launchIn(viewScope)
onChange {
if (preferences.themeMode().get() != Values.ThemeMode.dark) {
activity?.recreate()
}
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_greenapple,
R.string.theme_dark_midnightdusk,
R.string.theme_dark_amoled,
R.string.theme_dark_amoled_hotpink
)
entryValues = arrayOf(
Values.DarkThemeVariant.default.name,
Values.DarkThemeVariant.blue.name,
Values.DarkThemeVariant.greenapple.name,
Values.DarkThemeVariant.midnightdusk.name,
Values.DarkThemeVariant.amoled.name,
Values.DarkThemeVariant.hotpink.name
)
defaultValue = Values.DarkThemeVariant.default.name
summary = "%s"
switchPreference {
key = Keys.themeDarkAmoled
titleRes = R.string.pref_dark_theme_pure_black
defaultValue = false
preferences.themeMode().asImmediateFlow { isVisible = it != Values.ThemeMode.light }
.launchIn(viewScope)
onChange {
if (preferences.themeMode().get() != Values.ThemeMode.light) {
activity?.recreate()
}
activity?.recreate()
true
}
}