Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8592fdaf authored by Michael Kwan's avatar Michael Kwan Committed by android-build-merger
Browse files

Fix swipe-to-dismiss to properly react to swipe gestures. am: 8a9b2777 am: 4308eaa4

am: f6876c11

Change-Id: I342c832da0a91f536d9b935037d13ba23d9912a9
parents 97a29963 f6876c11
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -339,18 +339,16 @@ public class SwipeDismissLayout extends FrameLayout {
        mVelocityTracker.addMovement(ev);
        mVelocityTracker.computeCurrentVelocity(1000);
        if (!mDismissed) {

            if (deltaX > (getWidth() * DISMISS_MIN_DRAG_WIDTH_RATIO) &&
                    ev.getRawX() >= mLastX) {
            if ((deltaX > (getWidth() * DISMISS_MIN_DRAG_WIDTH_RATIO) &&
                    ev.getRawX() >= mLastX)
                    || mVelocityTracker.getXVelocity() >= mMinFlingVelocity) {
                mDismissed = true;
            }
        }
        // Check if the user tried to undo this.
        if (mDismissed && mSwiping) {
            // Check if the user's finger is actually back
            if (deltaX < (getWidth() * DISMISS_MIN_DRAG_WIDTH_RATIO) ||
                    // or user is flinging back left
                    mVelocityTracker.getXVelocity() < -mMinFlingVelocity) {
            // Check if the user's finger is actually flinging back to left
            if (mVelocityTracker.getXVelocity() < -mMinFlingVelocity) {
                mDismissed = false;
            }
        }