https://kotlinlang.org logo
#compose
Title
# compose
n

nglauber

05/31/2021, 2:32 PM
I’m trying to change the status bar color using accompanist library, but no success… 😕
Copy code
val systemUiController = rememberSystemUiController()
val useDarkIcons = MaterialTheme.colors.isLight

SideEffect {
    systemUiController.setStatusBarColor(
        color = Color.Red,
        darkIcons = useDarkIcons
    )
}
MyComposable()
cc: @cb
c

cb

05/31/2021, 2:34 PM
What does ‘no success’ mean? What API level?
n

nglauber

05/31/2021, 2:34 PM
MyComposable
has a
Scaffold
as root element… I’m testing on emulator. API 30
Just to add more details… the
TopBar
of my
Scaffold
is using
Copy code
Modifier
    .statusBarsPadding()
Not sure if it helps…
c

cb

05/31/2021, 2:37 PM
Not really. SystemUiController is a very thin layer on top of the Android APIs, so I’d be surprised if this is a bug in Accompanist
If you can provide a reproducible sample, I’ll take a look
n

nglauber

05/31/2021, 2:38 PM
Sure… give me 2min
c

cb

05/31/2021, 2:38 PM
Please raise it as an issue on the repo 👍
n

nglauber

05/31/2021, 2:44 PM
I found the issue 😉 I’m using this in my activity’s theme:
Copy code
<item name="android:windowTranslucentStatus">true</item>
Sorry @cb 😞
👍 1
c

cb

05/31/2021, 2:46 PM
Ah yeah, I could probably add a check for that
n

nglauber

05/31/2021, 2:49 PM
humm… but I can’t have a translucent for one composable and a colored status bar for a different one… 🤔 I mean…
ScreenA
is using a translucent status bar, but
ScreenB
must have a solid status bar. Is there a way to this?
Maybe I can set the activity flags…
c

Colton Idle

05/31/2021, 2:57 PM
If it makes you feel any better. I've set up edge to edge on four separate apps and every time I need to do it, it takes forever. There's always some small little issue that trips me up. Also, I've ended up finding that the window manager api or whatever that is supposed to lay you out under the system bars doesn't work as well as the Insetter library edge to edge helper call.
😩 1
n

nglauber

05/31/2021, 4:33 PM
2 Views