Fix dark theme

This commit is contained in:
aayush262 2024-02-02 19:05:32 +05:30
parent 829292399b
commit cbdd1a2538
3 changed files with 18 additions and 21 deletions

View file

@ -109,13 +109,13 @@ fun logger(e: Any?, print: Boolean = true) {
fun initActivity(a: Activity) {
val window = a.window
WindowCompat.setDecorFitsSystemWindows(window, false)
val darkMode = PrefManager.getNullableVal(PrefName.DarkMode, null as Boolean?)
val darkMode = PrefManager.getVal<Int>(PrefName.DarkMode)
val immersiveMode: Boolean = PrefManager.getVal(PrefName.ImmersiveMode)
darkMode.apply {
AppCompatDelegate.setDefaultNightMode(
when (this) {
true -> AppCompatDelegate.MODE_NIGHT_YES
false -> AppCompatDelegate.MODE_NIGHT_NO
2 -> AppCompatDelegate.MODE_NIGHT_YES
1 -> AppCompatDelegate.MODE_NIGHT_NO
else -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
}
)