Set status bar theme programatically

This commit is contained in:
Jonathan Klee 2024-09-20 14:57:10 +02:00
parent 78bf83acf4
commit 3b1581a2ba
2 changed files with 8 additions and 1 deletions

View file

@ -37,11 +37,19 @@ class MainSettingsActivity : AppCompatActivity() {
val isLightMode = isSystemInLightMode()
if (isLightMode) {
insetsController.setSystemBarsAppearance(
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS,
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS
)
insetsController.setSystemBarsAppearance(
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS,
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS
)
} else {
insetsController.setSystemBarsAppearance(
0,
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS
)
insetsController.setSystemBarsAppearance(
0,
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS

View file

@ -49,7 +49,6 @@
<item name="android:divider">@color/e_divider_color</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@color/e_background</item>
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
<item name="switchStyle">@style/ETheme.Switch</item>
</style>