diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index 8f79bdabedc90..c0a565db34c79 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -325,10 +325,11 @@ public class SwipeHelper implements Gefingerpoken { /** * @param view The view to be dismissed * @param velocity The desired pixels/second speed at which the view should move + * @param useAccelerateInterpolator Should an accelerating Interpolator be used */ - public void dismissChild(final View view, float velocity) { + public void dismissChild(final View view, float velocity, boolean useAccelerateInterpolator) { dismissChild(view, velocity, null /* endAction */, 0 /* delay */, - velocity == 0 /* useAccelerateInterpolator */, 0 /* fixedDuration */); + useAccelerateInterpolator, 0 /* fixedDuration */); } /** @@ -569,7 +570,8 @@ public class SwipeHelper implements Gefingerpoken { if (!handleUpEvent(ev, mCurrView, velocity, getTranslation(mCurrView))) { if (isDismissGesture(ev)) { // flingadingy - dismissChild(mCurrView, swipedFastEnough() ? velocity : 0f); + dismissChild(mCurrView, velocity, + !swipedFastEnough() /* useAccelerateInterpolator */); } else { // snappity mCallback.onDragCancelled(mCurrView); @@ -615,11 +617,9 @@ public class SwipeHelper implements Gefingerpoken { protected boolean swipedFastEnough() { float velocity = getVelocity(mVelocityTracker); - float perpendicularVelocity = getPerpendicularVelocity(mVelocityTracker); float translation = getTranslation(mCurrView); - boolean ret = (Math.abs(velocity) > getEscapeVelocity()) && - (Math.abs(velocity) > Math.abs(perpendicularVelocity)) && - (velocity > 0) == (translation > 0); + boolean ret = (Math.abs(velocity) > getEscapeVelocity()) + && (velocity > 0) == (translation > 0); return ret; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 373c0e1e2384a..4a8abe68a0912 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -3548,8 +3548,9 @@ public class NotificationStackScrollLayout extends ViewGroup } @Override - public void dismissChild(final View view, float velocity) { - super.dismissChild(view, velocity); + public void dismissChild(final View view, float velocity, + boolean useAccelerateInterpolator) { + super.dismissChild(view, velocity, useAccelerateInterpolator); cancelCheckForDrag(); setSnappedToGear(false); } @@ -3585,7 +3586,8 @@ public class NotificationStackScrollLayout extends ViewGroup snapChild(animView, 0 /* leftTarget */, velocity); } else if (isDismissGesture(ev)) { // Gesture is a dismiss that's not towards the gear - dismissChild(animView, swipedFastEnough() ? velocity : 0f); + dismissChild(animView, velocity, + !swipedFastEnough() /* useAccelerateInterpolator */); } else { // Didn't move enough to dismiss or cover, snap to the gear snapToGear(animView, velocity); @@ -3610,7 +3612,8 @@ public class NotificationStackScrollLayout extends ViewGroup private void dismissOrSnapBack(View animView, float velocity, MotionEvent ev) { if (isDismissGesture(ev)) { - dismissChild(animView, swipedFastEnough() ? velocity : 0f); + dismissChild(animView, velocity, + !swipedFastEnough() /* useAccelerateInterpolator */); } else { snapChild(animView, 0 /* leftTarget */, velocity); }