is there a way to observe if an IME animation (eit...
# compose
j
is there a way to observe if an IME animation (either hiding or showing) is currently in progress? we have some code which has a slight delay after calling keyboard
hide()
before doing the next thing.. the UX feels nicer than without the delay, but the delay itself feels flimsy — in fact we probably need a condition that says we don’t have a delay on older API levels which don’t animate the IME at all. it’d be cool if there was some kind of
isImeAnimating
state I could watch for this purpose, or something I could use to create a derived state to produce my own
isImeAnimating
, but I can’t think of anything immediately and a quick search hasn’t turned anything up
d
Not sure if there's such API and there's probably a better way but couldn't you derive your delay from the value of ime window insets?
a
WindowInsets.imeAnimationTarget and WindowInsets.imeAnimationSource are recent additions that might be helpful here!
j
oh thanks for that Alex! I found the commit from Oct 4th but can’t seem to see which release it is (or will be) a part of: https://github.com/androidx/androidx/commit/977d53a595ad75ee1693140c84c052cc60bce305 is it currently in alpha releases only?
a
I think so, looks like it is in
1.4.0-alpha01
first: https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.4.0-alpha01 If WindowInsets.imeAnimationTarget and WindowInsets.imeAnimationSource are unequal, that should be a signal that there is an animation underway.
j
awesome, thank you mate! I CMD+F’d on the wrong release notes page — I was looking at
compose.ui
not
compose.foundation
🤦
165 Views