https://kotlinlang.org logo
#compose
Title
# compose
k

Kshitij Patil

12/22/2020, 6:02 PM
How can I provide window insets to the main FragmentContainerView? I've TextFields on some of the pages and I want entire app to be lifted up on keyboard shows up. Currently this requires reopening keyboard for the first time for insets to get applied and it only lift the screen till the TextField, all the content below it is being hidden by the keyboard.
Here, the center area is
FragmentContainerView
c

Cyril Find

12/22/2020, 6:25 PM
you probably want to use https://chrisbanes.github.io/accompanist/insets but I can’t tell you much more ^^
k

Kshitij Patil

12/22/2020, 6:48 PM
I've used it.. and the current effect of textfield getting lifted up is the effect of accompanist only
But I want it to lift the entire screen right from the bottom
n

nickbutcher

12/23/2020, 9:36 AM
is the
windowSoftInputMode
set to
adjustResize
per https://chrisbanes.github.io/accompanist/insets/#something-not-working ?
k

Kshitij Patil

12/23/2020, 12:21 PM
I tried doing so, but seems like nothing changed. Also, I'm not using
WindowInsetsAnimations
so I suppose that's unnecessary for me
This the current behaviour. I takes 2nd attempt for window insets to act on the ime action, but once triggered, it works for all the subsequent TextFields on the screen. Also, you can see the Keyboard is hiding "Next" button. I'm going to move that button slightly upwards but there will be some validation errors shown below textfield and currently, those are getting hidden too. I'm using compose
1.0.0.-alpha09
and accompanist
0.4.1
. As mentioned earlier, the center part of this screen is FragmentContainerView which is defined in an xml and I've several Fragments written in Compose which are being rendered in that ContainerVIew. I'm correctly using
ProvideWindowInsets
in all the fragments but I'm curious whether this has something to do with interop of xml and Compose
n

nickbutcher

12/23/2020, 1:40 PM
Hmmm, that doesn't look like
adjustResize
is being applied to me. @cb have you seen this?
c

cb

12/23/2020, 1:47 PM
Looks to me like something is consuming the insets higher up in the view tree, meaning that it doesn’t reach your Compose content.
k

Kshitij Patil

12/23/2020, 7:28 PM
You mentioned prevent consuming insets in higher up in the tree. In my case, I think I need to do so with the Activity & Fragment hosting the FragmentContainerView. I've one more doubt. If you look at the video I shared, I'm getting ime insets enough to keep TextField visibile. How can I have some extra padding so that the content below TextField would also be visible. I believe there's new
imePadding()
modifier in Accompanist insets which I might add to the Parent Layout of the Composable but is that available outside AnimationAmbient ?
@cb I just realized my issue might have something to do with this issue, do you think there is any connection? Also, any thoughts my previous question?
I’ve prepared a repro for this issue, @cb would you please have a look at it. Thanks!
c

cb

01/22/2021, 11:56 AM
If you've got a repro, please add it to the bug an I'll take a look
k

Kshitij Patil

01/22/2021, 11:56 AM
You mean, issue on the repository?
8 Views