user-interface-samples icon indicating copy to clipboard operation
user-interface-samples copied to clipboard

Trouble to animate button with IME on API 29-

Open prouland opened this issue 4 years ago • 3 comments

Hi folks !

I tried to achieve the same thing that is applied in the ConversationFragment, but unfortunately without success.

For now, I start to integrate the samples Callback as they are. Calling them like that into my fragment :

private fun setupInsetsListeners() {
        val deferringInsetsListener = RootViewDeferringInsetsCallback(
            persistentInsetTypes = WindowInsetsCompat.Type.navigationBars(),
            deferredInsetTypes = WindowInsetsCompat.Type.ime()
        )
        ViewCompat.setWindowInsetsAnimationCallback(vb.root, deferringInsetsListener)
        ViewCompat.setOnApplyWindowInsetsListener(vb.root, deferringInsetsListener)

        ViewCompat.setWindowInsetsAnimationCallback(
            vb.nextStepButton,
            TranslateDeferringInsetsAnimationCallback(
                view = vb.nextStepButton,
                persistentInsetTypes = WindowInsetsCompat.Type.navigationBars(),
                deferredInsetTypes = WindowInsetsCompat.Type.ime(),
                dispatchMode = WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_CONTINUE_ON_SUBTREE
            )
        )
    }

The nextStepButton is well animated on API 30 but not on API 29 or 28. Some debugging let me know that the Impl21OnApplyWindowInsetsListener.onApplyWindowInsets() methods is only called on the root layout thanks to setOnApplyWindowInsetsListener.

Have you an idea on the mis-implementation I've made here ?

Regards, Pierre

prouland avatar Apr 08 '21 08:04 prouland

Hi @prouland, I have the same problem, do you have the solution? I changed the example moving the editText from the bottom to the top and adding another view to have the animation (a button). Obviously I did setWindowInsetsAnimationCallback for the button, but even if I used the example that didn't work. Maybe I am missing something, but I couldn't find the solution.

MarciaRappi avatar May 13 '21 20:05 MarciaRappi

Have the same problem. Do you have any suggestions on how to fix it? Or this is a library bug?

AlexandrSushkov avatar Oct 11 '21 12:10 AlexandrSushkov

Hi @prouland do you have any updates ? Maybe someone know how to fix this problem ?

glebjn avatar Mar 15 '22 13:03 glebjn