diff options
author | John Spurlock <jspurlock@google.com> | 2013-08-15 16:38:45 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-08-15 16:38:46 +0000 |
commit | ac0a1ea06f4a11550e3ee476bbb89ece2984e826 (patch) | |
tree | 54d92ca4b628b3c6f3dcb8f6d275bf2c0e4619e0 /packages/SystemUI/src | |
parent | da68124da23acadc192ba996d0e64f6d362a9a26 (diff) | |
parent | 48fa91a818e321208e90d6af234c1d4bed5a945d (diff) | |
download | frameworks_base-ac0a1ea06f4a11550e3ee476bbb89ece2984e826.zip frameworks_base-ac0a1ea06f4a11550e3ee476bbb89ece2984e826.tar.gz frameworks_base-ac0a1ea06f4a11550e3ee476bbb89ece2984e826.tar.bz2 |
Merge "Recover tracking pointer going up mid-gesture in shade." into klp-dev
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index b78239b..a19dcc4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -76,6 +76,7 @@ public class PanelView extends FrameLayout { private boolean mClosing; private boolean mRubberbanding; private boolean mTracking; + private int mTrackingPointer; private TimeAnimator mTimeAnimator; private ObjectAnimator mPeekAnimator; @@ -380,14 +381,21 @@ public class PanelView extends FrameLayout { mHandleView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { - final float y = event.getY(); - final float rawY = event.getRawY(); - if (DEBUG) logf("handle.onTouch: a=%s y=%.1f rawY=%.1f off=%.1f", + int pointerIndex = event.findPointerIndex(mTrackingPointer); + if (pointerIndex < 0) { + pointerIndex = 0; + mTrackingPointer = event.getPointerId(pointerIndex); + } + final float y = event.getY(pointerIndex); + final float rawDelta = event.getRawY() - event.getY(); + final float rawY = y + rawDelta; + if (DEBUG) logf("handle.onTouch: a=%s p=[%d,%d] y=%.1f rawY=%.1f off=%.1f", MotionEvent.actionToString(event.getAction()), + mTrackingPointer, pointerIndex, y, rawY, mTouchOffset); PanelView.this.getLocationOnScreen(mAbsPos); - switch (event.getAction()) { + switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: mTracking = true; mHandleView.setPressed(true); @@ -397,13 +405,26 @@ public class PanelView extends FrameLayout { trackMovement(event); mTimeAnimator.cancel(); // end any outstanding animations mBar.onTrackingStarted(PanelView.this); - mTouchOffset = (rawY - mAbsPos[1]) - PanelView.this.getExpandedHeight(); + mTouchOffset = (rawY - mAbsPos[1]) - mExpandedHeight; if (mExpandedHeight == 0) { mJustPeeked = true; runPeekAnimation(); } break; + case MotionEvent.ACTION_POINTER_UP: + final int upPointer = event.getPointerId(event.getActionIndex()); + if (mTrackingPointer == upPointer) { + // gesture is ongoing, find a new pointer to track + final int newIndex = event.getPointerId(0) != upPointer ? 0 : 1; + final float newY = event.getY(newIndex); + final float newRawY = newY + rawDelta; + mTrackingPointer = event.getPointerId(newIndex); + mTouchOffset = (newRawY - mAbsPos[1]) - mExpandedHeight; + mInitialTouchY = newY; + } + break; + case MotionEvent.ACTION_MOVE: final float h = rawY - mAbsPos[1] - mTouchOffset; if (h > mPeekHeight) { @@ -424,6 +445,7 @@ public class PanelView extends FrameLayout { case MotionEvent.ACTION_CANCEL: mFinalTouchY = y; mTracking = false; + mTrackingPointer = -1; mHandleView.setPressed(false); postInvalidate(); // catch the press state change mBar.onTrackingStopped(PanelView.this); |