Don't call BottomUserEducationView#close() while running animation.

If while the work profile info card opening animation was
playing you pressed the Work tab repeatedly, close() was
called. That caused the animation to never complete
properly (onAnimationEnd() was never called). This CL
makes sure to not call close() if the animation is
still running.

Bug: 112471462
Bug: 112188042
Test: Manual
Change-Id: I2e62e0c5c6f1d6132ea359a85cb6aadf57639c30
This commit is contained in:
arangelov
2018-08-15 19:58:01 +01:00
parent 2bcc9ba5ef
commit e6627ebfed

View File

@@ -108,7 +108,8 @@ public abstract class AbstractSlideInView extends AbstractFloatingView
@Override
public boolean onControllerTouchEvent(MotionEvent ev) {
mSwipeDetector.onTouchEvent(ev);
if (ev.getAction() == MotionEvent.ACTION_UP && mSwipeDetector.isIdleState()) {
if (ev.getAction() == MotionEvent.ACTION_UP && mSwipeDetector.isIdleState()
&& !isOpeningAnimationRunning()) {
// If we got ACTION_UP without ever starting swipe, close the panel.
if (!getPopupContainer().isEventOverView(mContent, ev)) {
close(true);
@@ -117,6 +118,10 @@ public abstract class AbstractSlideInView extends AbstractFloatingView
return true;
}
private boolean isOpeningAnimationRunning() {
return mIsOpen && mOpenCloseAnimator.isRunning();
}
/* SwipeDetector.Listener */
@Override
@@ -154,7 +159,7 @@ public abstract class AbstractSlideInView extends AbstractFloatingView
onCloseComplete();
return;
}
if (!mIsOpen || mOpenCloseAnimator.isRunning()) {
if (!mIsOpen) {
return;
}
mOpenCloseAnimator.setValues(