Fix getDarkModeStatus to handle configuration changes more accurately (#3412)
Updated getDarkModeStatus function to improve detection of dark mode status.
This commit is contained in:
1 parent
6e6ca209df
commit
1ac19ae3e9
1 file changed
+2
-2
@@ -380,10 +380,10 @@ object Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getDarkModeStatus(context: Context): Boolean {
|
fun getDarkModeStatus(context: Context): Boolean {
|
||||||
val mode = context.resources.configuration.uiMode and UI_MODE_NIGHT_MASK
|
return context.resources.configuration.uiMode and UI_MODE_NIGHT_MASK != UI_MODE_NIGHT_NO
|
||||||
return mode != UI_MODE_NIGHT_NO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun setNightMode(context: Context) {
|
fun setNightMode(context: Context) {
|
||||||
when (settingsStorage?.decodeString(AppConfig.PREF_UI_MODE_NIGHT, "0")) {
|
when (settingsStorage?.decodeString(AppConfig.PREF_UI_MODE_NIGHT, "0")) {
|
||||||
"0" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
"0" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||||
|
|||||||
Reference in new issue
Block a user