Hello! Context: - I'm using `rememberSystemUiCont...
# compose
r
Hello! Context: • I'm using
rememberSystemUiController
from accompanist
0.29.0-alpha
and I'm trying to animate from
Color.White
to
Color.Black.copy(0.5f)
for the Screen along the Status Bar at the same time, so it gives a nice dim animation altogether. But there's a small problem I'm facing More info in the 🧵
Problem: • For some reason, the Status Bar, starts the animation with a darker color and ends up in the
Color.Black 0.5f
as expected, but wonder why it starts as if it was Color.Black and transitions to
Color.Black 05f
instead of transitioning from
Color.White
to
Color.Black 0.5f
As it is: This is how it's going right now. • Screen: ◦ Initial color:
Color.White
◦ Starts animation:
Color.White
◦ Ends animation:
Color.Black.copy(0.5f)
• Status Bar: ◦ Initial color:
Color.White
◦ Starts animation:
Color.Black
(Or more darker than the ending animation color) ◦ Ends animation:
Color.Black.copy(0.5f)
Additional info: • Both have the same source of truth, wonder if I'm missing something. • I tried removing the default implementation for the
transformColorForLightContent = { ... }
from the
systemUi.statusBarColor(...)
but didn't work • I'm using a
DialogFragment
on top of it, but that shouldn't be a problem, right? Any idea? 🤔
Note: This is my first time using it, so I might be missing something obvious here
Ok, seems like it doesn't start with
Color.Black
but it reaches to a darker point than the Screen even though they have the same source of truth 🤔
a
Are you displaying content from your app underneath the status bar as well? (going edge-to-edge)
r
Not that I know nor intended at least, but let me check what happens if the status bar color is
Color.Transparent
So I didn't know anything about this edge-to-edge feature before, I think I'm going to use that instead of coordinating the status bar and the screen, it's even better lol
Thank you Alex 😉
a
You’re welcome! That was going to be my suggestion, if you use a transparent status bar and draw underneath it that’ll give more control. If you don’t, and you draw a partially transparent status bar, I’m not sure what determines the background color underneath
s
While going edge to edge is the right solution, could your animation problem be due to what is discussed in this thread? https://kotlinlang.slack.com/archives/CJLTWPH7S/p1666855799065679 Take a look yourself to see 😊
r
Not sure if it's the same because
Screen
was also getting the same color value and was being displayed correctly, so I'm assuming it might be something to do with the
Status Bar
? However, I believe there might be some relation at some level with the issue you mentioned I'm giving to the issue and will also remember the word "Alpha premultiplication" 😂 Thank you for sharing!
129 Views