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

Commit 99d49300 authored by Mark Renouf's avatar Mark Renouf Committed by Android Git Automerger
Browse files

am 55555a3d: Fixes rejected dismiss gestures (framework version of ag/677161)

* commit '55555a3d':
  Fixes rejected dismiss gestures (framework version of ag/677161)
parents ff1e7e01 55555a3d
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ public class SwipeDismissLayout extends FrameLayout {
    }

    private void init(Context context) {
        ViewConfiguration vc = ViewConfiguration.get(getContext());
        ViewConfiguration vc = ViewConfiguration.get(context);
        mSlop = vc.getScaledTouchSlop();
        mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
        mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
@@ -290,7 +290,7 @@ public class SwipeDismissLayout extends FrameLayout {
            float deltaX = ev.getRawX() - mDownX;
            float deltaY = ev.getRawY() - mDownY;
            if ((deltaX * deltaX) + (deltaY * deltaY) > mSlop * mSlop) {
                mSwiping = deltaX > mSlop * 2 && Math.abs(deltaY) < mSlop * 2;
                mSwiping = deltaX > mSlop * 2 && Math.abs(deltaY) < Math.abs(deltaX);
            } else {
                mSwiping = false;
            }
@@ -299,9 +299,9 @@ public class SwipeDismissLayout extends FrameLayout {

    private void updateDismiss(MotionEvent ev) {
        float deltaX = ev.getRawX() - mDownX;
        if (!mDismissed) {
        mVelocityTracker.addMovement(ev);
        mVelocityTracker.computeCurrentVelocity(1000);
        if (!mDismissed) {

            if (deltaX > (getWidth() * DISMISS_MIN_DRAG_WIDTH_RATIO) &&
                    ev.getRawX() >= mLastX) {
@@ -311,7 +311,9 @@ public class SwipeDismissLayout extends FrameLayout {
        // 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)) {
            if (deltaX < (getWidth() * DISMISS_MIN_DRAG_WIDTH_RATIO) ||
                    // or user is flinging back left
                    mVelocityTracker.getXVelocity() < -mMinFlingVelocity) {
                mDismissed = false;
            }
        }