I'm aware of imePadding. But I'm finding it insuff...
# compose-android
t
I'm aware of imePadding. But I'm finding it insufficient to work as I want. It seems like a high level once size fits all attempt to deal with keyboard visibility, but I'm finding that getting it working correctly (or rather, as desired) is tricky. Is there a more general/raw approach that one can use to cope with keyboard exposure (I rather like the way the iOS one works, you can configure callbacks for pre/postExpose and pre/postHide, and you get the height of the keyboard exposure as a parameter). What would be great is some state thing (LocalKeyboardHeight.current?) that I could access in my composition, make decisions about, and then know that a recompose will happen. Maybe I'm just missing something obvious though?
e
WindowInsets.imeAnimationSource
&
WindowInsets.imeAnimationTarget
Also
WindowInsets.ime
for the current value.
imePadding
just takes
ime
and applies it as padding.
t
Thanks, hopefully this gets me going in the right direction... little fuzzy on what exactly this means... but I'll do some digging. 😄
e
Yeah the javadoc should give an idea but... “Is the keyboard expanding?” ->
imeAnimationSource
<
imeAnimationTarget
“Is the keyboard collapsing?” ->
imeAnimationSource
>
imeAnimationTarget
In both cases,
ime
/
abs(imeAnimationSource - imeAnimationTarget)
will give the fraction of expand or collapse
t
And what are the preferred values for these two settings to keep all this working sanely?
Copy code
WindowCompat.setDecorFitsSystemWindows(window, false)
I get different results in things if I turn this off or on, but it's not clear how it's affecting things to me. The same for the manifest entry that many seem to claim is something I should do:
Copy code
android:windowSoftInputMode="adjustResize"
e
If you read any of the android dev guides to laying out content as full screen they explain why you need those two declarations
t
Yeah, where I tend to get confused is between the: 1. This is the old way of doing things, you probably don't realize you shouldn't be reading here 2. This is the new compose-ish way, read here 3. This is sort of middle ground stuff, because the compose app still operates ultimately in a "shell" provided by the original stuff, so you have to at least bridge the gap here But hey, I don't want to whine. Thank you so much for the nudges and hints here. I feel like I'm slowly figuring things out with a sort of 10 steps forward 9 steps backward rate. 😄
🎉 1