13

Pre-Android 11 (API Level 30) I had <item name="android:windowLightStatusBar">true</item> set in my theme and was additionally changing this (when needed) in the the code with

fun setLightStatusBar(){ 
    window?.decorView?.let { it.systemUiVisibility = it.systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR }
} 

fun setDarkStatusBar(){
    window?.decorView?.let { it.systemUiVisibility = it.systemUiVisibility and View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv() }
}

However, Android-30 adds a new way to control with

fun setLightStatusBar(){ 
    window?.insetsController?.setSystemBarsAppearance(APPEARANCE_LIGHT_STATUS_BARS, APPEARANCE_LIGHT_STATUS_BARS)
} 

fun setDarkStatusBar(){
    window?.insetsController?.setSystemBarsAppearance(0, APPEARANCE_LIGHT_STATUS_BARS)
}

but my issue is that this cannot overwrite the theme-set values and thus I need to either do it all with styles or all in code.

My question is if this is intended to be like this or am I missing something somewhere?

Kosh
  • 5,515
  • 2
  • 31
  • 63
Viktor Stojanov
  • 638
  • 5
  • 19

1 Answers1

1

I removed <item name="android:windowLightStatusBar">true/false</item> from styles.xml and it worked correctly.