constraintlayout icon indicating copy to clipboard operation
constraintlayout copied to clipboard

[MotionLayout] Expand/Collapse animation doesn't end fully with OnClick action

Open thsaravana opened this issue 2 years ago • 2 comments

Layout: activity_main.xml Layout Scene: movie_detail_scene.xml

Minimum reproducible project: android-animation (branch: motion-layout)

Version: 2.0.2, 2.0.4, 2.1.0-beta02

The functionality is quite simple. onClick of the layout, the layout will Expand and then onClicking again it will collapse. The issue is that sometimes the expand/collapse is not done fully, and gets stuck midway. This happens 1 in 10 times in latest devices like One Plus 7T, but very frequently in much older devices.

Observations:

  1. Occurs more frequently in 2.1.0-beta02 than 2.0.4.
  2. Occurs in 2.0.2 as well.
  3. Occurs almost every time when the duration of the animation is reduced down to 50 to 100ms.
  4. Increasing the animation duration to 1000 to 1500 reduces this issue. In these cases, the constraints are stuck at the very end, and happens only 1 in 50 times or so.
  5. The issue never occurs when clickAction="jumpToStart|jumpToEnd" is set.
  6. Presence of an outer ScrollView has no impact. With or without the scrollView, the issue exists.

Expected:

Actual:

Let me know if you need any more details.

thsaravana avatar Jul 18 '21 06:07 thsaravana

Could you post the <Transition > ?

If the duration is very short using "< Transition ..... motion:motionInterpolator="linear" />" might help.

jafu888 avatar Jul 21 '21 12:07 jafu888

I kept the animation duration at 100ms to reproduce the issue more frequently. My original intention is to have it at 300ms and when I do that the issue doesn't happen often.

Irrespective of the duration or interpolators, when the animation ends, the constraints should be set properly right? In this case, the 'start' and 'end' constraints are set but the MotionLayout's height gets stuck midway instead of fully wrapping.

I tried "linear" and all other interpolators, but it's still the same.

https://user-images.githubusercontent.com/11502338/126513768-de5e02ef-c9e9-4829-bc60-499e18468496.mp4

thsaravana avatar Jul 21 '21 15:07 thsaravana