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

Commit 1c36cfd2 authored by Winson Chung's avatar Winson Chung Committed by Android Git Automerger
Browse files

am d8fed39f: am c7a873e3: Merge "Ensure we update the active pointer id on...

am d8fed39f: am c7a873e3: Merge "Ensure we update the active pointer id on pointer up/down." into mnc-dr-dev

* commit 'd8fed39f':
  Ensure we update the active pointer id on pointer up/down.
parents 9c8abd1d d8fed39f
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -162,6 +162,14 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
                mVelocityTracker.addMovement(createMotionEventForStackScroll(ev));
                break;
            }
            case MotionEvent.ACTION_POINTER_DOWN: {
                final int index = ev.getActionIndex();
                mActivePointerId = ev.getPointerId(index);
                mLastMotionX = (int) ev.getX(index);
                mLastMotionY = (int) ev.getY(index);
                mLastP = mSv.mLayoutAlgorithm.screenYToCurveProgress(mLastMotionY);
                break;
            }
            case MotionEvent.ACTION_MOVE: {
                if (mActivePointerId == INACTIVE_POINTER_ID) break;

@@ -187,6 +195,20 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
                mLastP = mSv.mLayoutAlgorithm.screenYToCurveProgress(mLastMotionY);
                break;
            }
            case MotionEvent.ACTION_POINTER_UP: {
                int pointerIndex = ev.getActionIndex();
                int pointerId = ev.getPointerId(pointerIndex);
                if (pointerId == mActivePointerId) {
                    // Select a new active pointer id and reset the motion state
                    final int newPointerIndex = (pointerIndex == 0) ? 1 : 0;
                    mActivePointerId = ev.getPointerId(newPointerIndex);
                    mLastMotionX = (int) ev.getX(newPointerIndex);
                    mLastMotionY = (int) ev.getY(newPointerIndex);
                    mLastP = mSv.mLayoutAlgorithm.screenYToCurveProgress(mLastMotionY);
                    mVelocityTracker.clear();
                }
                break;
            }
            case MotionEvent.ACTION_CANCEL:
            case MotionEvent.ACTION_UP: {
                // Animate the scroll back if we've cancelled