ThemeEngine: Don't apply color to systembar on Android 15+

Android 15 enforces transparent colors on system bars

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2024-07-18 17:19:47 +07:00
parent e24d5d08e8
commit e844023506
2 changed files with 7 additions and 2 deletions

View File

@@ -65,6 +65,10 @@ fun isUAndAbove(): Boolean {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE
}
fun isVAndAbove(): Boolean {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM
}
fun isMIUI(): Boolean {
return getSystemProperty("ro.miui.ui.version.name").isNotEmpty()
}

View File

@@ -51,7 +51,7 @@ fun AppCompatActivity.applyThemeAccent() {
}
1 -> {
setSystemBarConfiguration(light = true)
if (!isVAndAbove()) setSystemBarConfiguration(light = true)
if (isSAndAbove()) {
uiModeManager.setApplicationNightMode(UiModeManager.MODE_NIGHT_NO)
} else {
@@ -60,7 +60,7 @@ fun AppCompatActivity.applyThemeAccent() {
}
else -> {
setSystemBarConfiguration(light = false)
if (!isVAndAbove()) setSystemBarConfiguration(light = false)
if (isSAndAbove()) {
uiModeManager.setApplicationNightMode(UiModeManager.MODE_NIGHT_YES)
} else {
@@ -70,6 +70,7 @@ fun AppCompatActivity.applyThemeAccent() {
}
}
@Suppress("DEPRECATION")
private fun AppCompatActivity.setSystemBarConfiguration(light: Boolean) {
WindowInsetsControllerCompat(this.window, this.window.decorView.rootView).apply {
// Status bar color