I'm using Accompanist `systemUiController.setSyste...
# compose
r
I'm using Accompanist
systemUiController.setSystemBarsColor()
to set dark icons. When I switch between apps using gesture navigation there is a lag in my test app where the system icons are momentarily white before changing back to black. Is there a way to avoid this? (Video and code in thread.)
1
This code is based on the sample at https://google.github.io/accompanist/systemuicontroller/:
Copy code
setContent {
    val systemUiController = rememberSystemUiController()
    val useDarkIcons = MaterialTheme.colors.isLight
    SideEffect {
        systemUiController.setSystemBarsColor(
            color = Color.Gray,
            darkIcons = useDarkIcons
        )
    }
    Box (modifier = Modifier.background(Color.LightGray).fillMaxSize()) {
        Text("systemUiController test")
    }
}
(This is on a Pixel 4a, API 30, on the emulator.)
l
Not sure if this is just normal android behaviour with system status, have you tried doing the same test but without using compose?
a
This is the system behavior on API 30 when you are using
WindowInsetsController.setSystemBarsAppearance()
, which is what accompanist uses under the hood. If you want to eliminate the lag, you need to set
android:windowLightStatusBar
in your xml theme. Edit: Tried on Android 12 and it seems that there's no lag any more so this is only a problem on Android 11.
👍 1
☝️ 1
r
Thanks Albert. Now all I have to do is figure out where to put the
android:windowLightStatusBar
(All my experience on Android is Compose -- no xml so far.) :)
Thanks that worked. (Do you consider the Android 11 vs. Android 12 behavior a bug?)
a
Even if it is a bug it is already fixed and the fix isn't likely to be back ported to Android 11 considering the severity.