Travis Griggs
01/30/2024, 7:18 PMandroid:windowSoftInputMode="adjustResize"
in the application body
• place WindowCompat.setDecorFitsSystemWindows(_window_, *false*)
in my MainActivity onCreate override
Are these correct? Are there other things I'm supposed to employ? Something about ime padding at the root composable? (I am not using a Scaffold). If there's a document somewhere that describes this in one place, I haven't found it yet. :(Stylianos Gakis
01/30/2024, 7:54 PMComponentActivity.enableEdgeToEdge()
and let that call the right thing, and remove your WindowCompat function call.
After this, you should be getting the IME insets as WindowInsets.ime in your compose code and you can do whatever you want with them.
Is there something you're doing that just doesn't work for you?Travis Griggs
01/30/2024, 8:05 PMTravis Griggs
01/30/2024, 8:08 PM.onGloballyPositioned { layoutCoordinates ->
nameTop = with(density) { layoutCoordinates.positionInRoot().y.logged("ROOT")
layoutCoordinates.positionInWindow().y.logged("WINDOW")
layoutCoordinates.positionInRoot().y.toDp() }
})
to capture the top of one of my main screen composables. I have determined that 0 is at the TOP of the whole screen (i.e. under the system bar). But 0, in my BasicAlertDialog appears to be at the bottom of the system bar. I've even passed the following to my BasicAlertDialog:
properties = DialogProperties(usePlatformDefaultWidth = false, decorFitsSystemWindows = false)
Stylianos Gakis
01/30/2024, 8:15 PMTravis Griggs
01/30/2024, 8:16 PMAlex Vanyo
01/30/2024, 9:16 PMDialog
is placed into a new platform Window
, which has a bunch of fun consequences:
• each new window comes a new set of window flags to configure (fits system windows, window soft input mode, etc.)
• going edge-to-edge is window-specific - you could go edge-to-edge in an Activity with its Window
, but not in a dialog’s window, or vice versa (or neither, or both)
• window insets are window-specific - the value of window insets can differ between windows depending on their window flags
I’ve been experimenting with an alternate dialog setup in https://gist.github.com/alexvanyo/594abce742ecd9f973cb1162ec49df12 which might be interesting to take a look at. The rough goal is: Provide a type of dialog that always goes edge-to-edge, and gives the contained content the flexibility and responsibility to fill that edge-to-edge spaceTravis Griggs
01/30/2024, 9:32 PMAlex Vanyo
01/30/2024, 9:41 PMWindowInsets.systemBars
from inside the dialog, and you are using the decorFitsSystemWindows = false
dialog propertyAlex Vanyo
01/30/2024, 9:53 PMStylianos Gakis
01/31/2024, 12:58 PMAlex Vanyo
01/31/2024, 5:09 PMModalBottomSheet
based on the edge-to-edge dialog I’m experimenting with, which seems to help with some of the issues around insets tooTravis Griggs
02/01/2024, 12:57 AMAlex Vanyo
02/01/2024, 1:01 AMWindowInsets.systemBars
that is outside the dialog being called directly outside the dialog?Travis Griggs
02/01/2024, 1:03 AMif (isEditing) {
....
val topBarHeight = with(LocalDensity.current) {
WindowInsets.systemBars.getTop(LocalDensity.current).toDp().logged("SYSTEMBARPADDING IN WINDOW")
}
val focusRequester = remember { FocusRequester() }
BasicAlertDialog(
....
Travis Griggs
02/01/2024, 1:08 AMStylianos Gakis
02/01/2024, 7:26 AM