https://kotlinlang.org logo
Title
a

alorma

07/29/2021, 5:21 AM
Sorry for bothering so much... I'm inspired today 😅 I'm trying to use
accompanist
system ui controller lib, following this: https://google.github.io/accompanist/systemuicontroller/ But i found that on light theme icons are not show :S
a

Albert Chang

07/29/2021, 5:28 AM
If you set status bar color to transparent, you have to set
WindowCompat.setDecorFitsSystemWindows(window, false)
to extend your UI and show something behind the status bar yourself, otherwise since the bar is transparent the default surface color is displayed and dark icons won't be recognizable.
a

alorma

07/29/2021, 5:29 AM
even not setting transparent color it not shows
val systemUiController = rememberSystemUiController()
            val useDarkIcons = MaterialTheme.colors.isLight
            val colorPrimary = MaterialTheme.colors.primaryVariant
            SideEffect {
                systemUiController.setStatusBarColor(
                    color = colorPrimary,
                    darkIcons = useDarkIcons,
                )
            }
still shows the status bar black
because using
android:theme="@android:style/Theme.NoTitleBar"
If I use a material theme, it shows correct
a

Albert Chang

07/29/2021, 5:33 AM
Then just use a material theme.
There is
@android:style/Theme.Material.NoActionBar
and
@android:style/Theme.Material.Light.NoActionBar
.
a

alorma

07/29/2021, 5:39 AM
mmmmm
but since which API is available? 21?
a

Albert Chang

07/29/2021, 5:39 AM
Of course. Same as Compose UI.
a

alorma

07/29/2021, 5:39 AM
awesome
thanks, never knew about
@android
version of material themes
building a project without
AppCompat
and
Material
libraries looks so... scary it has been so many years using them
👍 1
c

Colton Idle

07/29/2021, 5:41 AM
I'm going to hit this problem soon. Thanks @alorma Do you happen to know if theres an Android material daynight theme without having to pull in the entire Material lib?
a

Albert Chang

07/29/2021, 5:43 AM
You can easily create your own. values/themes.xml:
<style name="Theme.MyApp" parent="android:Theme.Material.Light.NoActionBar" />
values-night/themes.xml:
<style name="Theme.MyApp" parent="android:Theme.Material.NoActionBar" />
💯 2
a

alorma

07/29/2021, 5:50 AM
anyway, is it needed if you use a pure compose app?
1
c

Colton Idle

07/29/2021, 5:59 AM
I figured you need DayNight theme in a pure compose app so your splash screen uses the right colors.
a

Albert Chang

07/29/2021, 6:01 AM
Yes, background color, status bar color, navigation bar color, etc from your xml theme will be used when your app is starting.
👍 2