Changed auto theme to the Android built-in mechanism

This commit is contained in:
0x416c6578 2021-08-03 08:21:17 +01:00 committed by GitHub
parent e04beceaec
commit 095e6a2d91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -8,7 +8,13 @@ import android.content.Context
object TwilightManagerAccessor {
fun isNight(context: Context): Boolean {
return TwilightManager.getInstance(context).isNight
//From https://developer.android.com/guide/topics/ui/look-and-feel/darktheme#kotlin
val currentNightMode: Int = context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
when (currentNightMode) {
Configuration.UI_MODE_NIGHT_NO -> { return false }
Configuration.UI_MODE_NIGHT_YES -> { return true }
}
return false;
}
fun getNightState(context: Context): Int {