https://kotlinlang.org logo
a

Adriano Celentano

03/01/2021, 11:20 AM
Is it possible to know the ime padding before the ime is shown ? would be cool to use the keyboard as source of truth for animations.
1
j

jim

03/01/2021, 3:03 PM
cc @Sean McQuillan [G]
s

Sean McQuillan [G]

03/01/2021, 6:07 PM
Your best bet for accurate information is insets https://github.com/chrisbanes/accompanist/tree/main/insets
a

Adriano Celentano

03/02/2021, 6:24 PM
is it possible to know the insets padding of ime before the ime is shown ? so i could interpolate other animation depending on the max ime padding, when the keyboard becomes visible
s

Sean McQuillan [G]

03/02/2021, 10:01 PM
Not sure what's possible. maybe @cb ^
a

Adriano Celentano

03/03/2021, 12:56 PM
thats a nice blogpost, i didnt see it before. But as i get its also reacting to the changing padding, like the accompanist abstraction. I guess what i had in mind is not possible yet. Maybe one day 🤞
c

cb

03/04/2021, 10:04 AM
Can you go into more detail of what you want to do?
Sounds a bit like you’re trying to implement transition?
a

Adriano Celentano

03/04/2021, 1:25 PM
I basically just want a float from 0 to 1, which is updating while the keyboard animates in or out. keyboard completely visible would be 1 and invisible would be 0. My use case is I want to drive this animations based on the state of the keyboard animation. https://twitter.com/SophosAdriano/status/1366418357646483462?s=19
c

cb

03/04/2021, 6:01 PM
Ah, well the
WindowInsetsAnimation
APIs have exactly that: https://developer.android.com/reference/android/view/WindowInsetsAnimation#getFraction()
You'll need to do all of wiring up yourself right now, although I could expose this value in Accompanist.
Thinking about it, I should probably expose both the 'animated' insets, the 'layout' insets, and the animated progress. For this example, you'd only want the 'layout' insets and the progress
a

Adriano Celentano

03/04/2021, 6:43 PM
awesome 🎉 looking forward to dig into that, thank you 🙏
c

cb

03/24/2021, 6:52 PM
FYI, this landed in Accompanist 0.7.0. You can now fetch the layout insets, animation insets, and the fraction/progress: https://github.com/google/accompanist/pull/242
🎉 1
🙏 1
4 Views