Hello folks :wave: I need some advice about a curi...
# compose-android
d
Hello folks 👋 I need some advice about a curious case. We have an Activity in immersive mode with inside a Fragment, with inside a Composable. While it would be ideal to get rid of the Fragment, it is a core part of the app, so this will not change for a while. From this Composable, we need to show a Dialog. We tried using a
androidx.compose.ui.window.Dialog
but the overlay is not going till the edges of the screen ignoring the insets -even using
decorFitsSystemWindows
-, but it stops before the area where the status and navigation bars are supposed to be (which are not, hence the immersive mode). Any ideas?
We used a custom solution till now, that attaches an
AbstractComposeView
to the decor View, but it started to give some troubles in the latest Compose release, complaining that
disposeComposition
should be called only once; so we’re trying to avoid such workaround and solve it in a proper way
a
I’ve been experimenting with an edge-to-edge dialog implementation in https://gist.github.com/alexvanyo/594abce742ecd9f973cb1162ec49df12 which might be useful as a reference
d
Thank you, I took a quick look for now. If I didn’t misunderstand, the approach is similar to what we used, with a few differences in the implementation details. In our case, the exception is thrown here (ref from your gist)
Copy code
DisposableEffect(dialog) {
    dialog.show()

    onDispose {
        dialog.dismiss()
        dialog.disposeComposition() // <== 💥
    }
}
a
Interesting - I haven’t seen that issue, most of the code in the gist is a fork of the built-in `Dialog`: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]android.kt;l=200;drc=83e8ce16b650cf9278fd59c1f56651579df24f7f
d
In our case we have
java.lang.IllegalStateException
Release should only be called once
at
androidx.compose.foundation.lazy.layout.LazyLayoutPinnableItem.release (LazyLayoutPinnableItem.kt:159)
I’m investigating our git history to check whether we introduced something strange on the consumer side. Do you have any clue of what could tickle this?
It is happening during Activity destruction
a
I’d report a bug for that - it seems like the normal built-in dialog would probably have the same issue if the
disposeComposition()
is causing an issue
d
Thank you for the support, I will collect more data and file a bug 🙏
a
Have you tried setting
usePlatformDefaultWidth = false
?
d
Yes, the width is fine, but the height doesn’t reach the edges
@Alex Vanyo I didn’t spot any possible cause in our implementation, but we updated from Compose 1.5.4 to 1.6-rc01. I saw this change for 1.6.1: https://android.googlesource.com/platform/frameworks/support/+/31ce3be612d118cbe53543f5af8965a665e5f7d9%5E%21/ Could it have fixed it? We haven’t released with 1.6.1 yet, that’s why I’m asking 🙂 I’m not pinging Andrei, but please let me know in case I should 🙏
It seems like 1.6.1 didn’t fix it, since crash reports are still coming our way. I filed a report with the little information we have about it https://issuetracker.google.com/issues/325932416
150 Views