Skip to content

Commit

Permalink
Fix getDarkModeStatus to handle configuration changes more accurately (
Browse files Browse the repository at this point in the history
…#3412)

Updated getDarkModeStatus function to improve detection of dark mode status.
  • Loading branch information
CodeWithTamim authored Aug 3, 2024
1 parent 6e6ca20 commit 1ac19ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,10 @@ object Utils {
}

fun getDarkModeStatus(context: Context): Boolean {
val mode = context.resources.configuration.uiMode and UI_MODE_NIGHT_MASK
return mode != UI_MODE_NIGHT_NO
return context.resources.configuration.uiMode and UI_MODE_NIGHT_MASK != UI_MODE_NIGHT_NO
}


fun setNightMode(context: Context) {
when (settingsStorage?.decodeString(AppConfig.PREF_UI_MODE_NIGHT, "0")) {
"0" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
Expand Down

0 comments on commit 1ac19ae

Please sign in to comment.