Merge "Fix issue where the notification could snap to the menu while its invisible" into oc-dev

This commit is contained in:
TreeHugger Robot
2017-04-19 18:42:31 +00:00
committed by Android (Google) Code Review
2 changed files with 15 additions and 2 deletions

View File

@@ -462,11 +462,20 @@ public class SwipeHelper implements Gefingerpoken {
int duration = SNAP_ANIM_LEN;
anim.setDuration(duration);
anim.addListener(new AnimatorListenerAdapter() {
boolean wasCancelled = false;
@Override
public void onAnimationCancel(Animator animator) {
wasCancelled = true;
}
@Override
public void onAnimationEnd(Animator animator) {
mSnappingChild = false;
updateSwipeProgressFromOffset(animView, canBeDismissed);
mCallback.onChildSnappedBack(animView, targetLeft);
if (!wasCancelled) {
updateSwipeProgressFromOffset(animView, canBeDismissed);
mCallback.onChildSnappedBack(animView, targetLeft);
}
}
});
prepareSnapBackAnimation(animView, anim);

View File

@@ -317,6 +317,10 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
}
private void dismiss(View animView, float velocity) {
if (mFadeAnimator != null) {
mFadeAnimator.cancel();
}
mHandler.removeCallbacks(mCheckForDrag);
mMenuSnappedTo = false;
mDismissing = true;
mSwipeHelper.dismiss(animView, velocity);