Fixing animation behavior on UMO snapback

If user tries to swipe While the snapback animation is going back, we
need to cancel the ongoing animation.

Bug: 247810047
Test: Checked the snapback animation and the translation of the
UMO while swiping and releasing the UMO to go back.

Change-Id: I0d6a70a04aeda29338c28ba37b11450aedc06dec
This commit is contained in:
Michael Mikhail
2022-10-06 18:33:55 +00:00
parent 3c30076779
commit 4e512f9f98

View File

@@ -289,7 +289,10 @@ class MediaCarouselScrollHandler(
return false
}
}
if (isUp || motionEvent.action == MotionEvent.ACTION_CANCEL) {
if (motionEvent.action == MotionEvent.ACTION_MOVE) {
// cancel on going animation if there is any.
PhysicsAnimator.getInstance(this).cancel()
} else if (isUp || motionEvent.action == MotionEvent.ACTION_CANCEL) {
// It's an up and the fling didn't take it above
val relativePos = scrollView.relativeScrollX % playerWidthPlusPadding
val scrollXAmount: Int