Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
This also brings back dialog content size animations issues :( But on all devices this time.
See attached video
Repro:
Dialog(
onDismissRequest = {
if (dialogState.canDismiss.value) {
dialogNavigator.hide()
}
},
properties = properties,
content = {
Surface(
modifier = modifier
.safeContentPadding()
.fillMaxWidth(0.8f)
.animateContentSize(),
shape = shape,
color = backgroundColor,
contentColor = contentColor,
) {
.....A composable that change it's size
}
},
)
ap...@google.com <ap...@google.com> #3
Can you give a fuller example for the animateContentSize()
problem?
ap...@google.com <ap...@google.com> #4
It does that for all the cases where the content change.
properties = DialogProperties(usePlatformDefaultWidth = false)
var show by remember { mutableStateOf(false) }
LaunchedEffect(Unit) {
delay(1000)
show = true
}
Column {
Text("X")
if (show) {
Text"Y)
}
}
Edit: This was a well known long time issue when not using usePlatformDefaultWidth = false
so we were forced to workaround with that.
Now even with it it trigger that. (Depending on the phone, it's either super slow, or laggy and jumping).
ap...@google.com <ap...@google.com> #5
I am seeing a problem with decorFitsSystemWindows = false
where it continues to invalidate the layout even after the animation completes. I don't think that's the problem you're worried about, though.
If I understand correctly, the problem you're seeing is something about it being laggy? And it didn't happen in the previous version, right?
That problem is likely due to the Window resizing on every frame, which is more expensive than the window content resizing on every frame. In a previous iteration, the window size was full screen and the content resized itself. You can resolve this yourself by doing this:
Surface(
modifier = Modifier.safeContentPadding()
.fillMaxSize()
.wrapContentHeight()
.fillMaxWidth(0.8f)
.animateContentSize(),
...
I'll see if I can fix the problem with decorFitsSystemWindows = false
invalidating layout continuously.
il...@google.com <il...@google.com> #6
There's 2 very different issue here. The main very blocking is the Samsung dialogs from a bottomsheet/popup being at the bottom and under the navigation bar. Samsung is a very large percent of users. And a full rewrite of all M3 AlerDialog to something else to workaround is a pain as most M3 things are private / internal.
The second issue is about the huge lag.
It was present since a very long time with usePlatformDefaultWidth = true
but not with usePlatformDefaultWidth = false
now it's always present.
AFAIR previously all the workaround based on .fillMaxSize()
had issues with the dialog scrim, but I'll try again if there's a fix for the Samsung devices.
e....@gmail.com <e....@gmail.com> #7
I just verified that an AlertDialog
called from a ModalBottomSheet
from a Pixel 9XL works fine. I'll see if I can find a Samsung device to test.
e....@gmail.com <e....@gmail.com> #8
Yes this is specific to Samsung as stated in first message.
I repro via Samsung testlab as I do not have a device myself, but A54 A55 with Android 14 there does reproduce the issue. (And a few different other Android 14 samsung devices from my beta users)
il...@google.com <il...@google.com> #9
I just verified that I can repro on a Samsung device.
sl...@gmail.com <sl...@gmail.com> #10
Perfect.
Just quickly tested the
.fillMaxSize()
.wrapContentHeight()
And it seems to behave correctly for the dialog scrim so works as a solution, may worth a note somewhere as cheating with usePlatformDefaultWidth = false
was often found as solution in a few posts over Internet.
A quick "mostly" related question to the dialog scrim, many users requested an option to hide the status bar in my app to be in full immersive mode, but there's no way to do that with dialogs right now. Is this something that can be requested? I have a fork of M3 BottomSheet to handle that, but handling a fork of the low level dialog requires a full copy and rewrite of everything that depends on it.
Description
Component used: Activity Version used: 1.2.0-alpha06
The APIs of
LifecycleOwner
provide us with a callback for when you reach theCREATED
state, but for activities that is often after some critical code needs to run.For example:
setTheme
to reset your theme from a branded launch themesetLocalNightMode()
These all need to be called before
super.onCreate()
and specifically the inflation of any layout.It would be nice if there was a composable way to get a callback at that exact time without needing to manually add code to
onCreate()
(which, will fine for app code, is hard to do as a library).