Add: System Amoled Theme

Fix: Use similar switches in Settings
This commit is contained in:
LooKeR
2021-10-16 11:32:25 +05:30
parent 59ebd3394f
commit ac79953c7c
3 changed files with 14 additions and 3 deletions

View File

@ -173,7 +173,7 @@ object Preferences {
sealed class Theme(override val valueString: String) : Enumeration<Theme> {
override val values: List<Theme>
get() = if (Android.sdk(29)) listOf(System, Light, Dark, Amoled)
get() = if (Android.sdk(29)) listOf(System, AmoledSystem, Light, Dark, Amoled)
else listOf(Light, Dark, Amoled)
abstract fun getResId(configuration: Configuration): Int
@ -185,6 +185,13 @@ object Preferences {
}
}
object AmoledSystem : Theme("system-amoled") {
override fun getResId(configuration: Configuration): Int {
return if ((configuration.uiMode and Configuration.UI_MODE_NIGHT_YES) != 0)
R.style.Theme_Main_Amoled else R.style.Theme_Main_Light
}
}
object Light : Theme("light") {
override fun getResId(configuration: Configuration): Int = R.style.Theme_Main_Light
}