diff options
author | Selim Cinek <cinek@google.com> | 2014-11-18 18:33:44 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-18 18:33:44 +0000 |
commit | b510a1cb7633364a0303d69f615c74acc1715ca9 (patch) | |
tree | aedf0334cbf13b786543130ea8e7c205c2821642 | |
parent | b2d73807a93495e132e6b12e5612cbaaeea06fd9 (diff) | |
parent | 652afdf504cacaae8dcc334b0f1a9e282a95d768 (diff) | |
download | frameworks_base-b510a1cb7633364a0303d69f615c74acc1715ca9.zip frameworks_base-b510a1cb7633364a0303d69f615c74acc1715ca9.tar.gz frameworks_base-b510a1cb7633364a0303d69f615c74acc1715ca9.tar.bz2 |
am 652afdf5: Increases the falsing threshold when for the keyguard affordances
* commit '652afdf504cacaae8dcc334b0f1a9e282a95d768':
Increases the falsing threshold when for the keyguard affordances
-rw-r--r-- | packages/SystemUI/res/values/dimens.xml | 2 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java | 49 |
2 files changed, 21 insertions, 30 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index fabdf29..fcdc015 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -320,7 +320,7 @@ <dimen name="heads_up_window_height">250dp</dimen> <!-- The minimum amount the user needs to swipe to go to the camera / phone. --> - <dimen name="keyguard_min_swipe_amount">90dp</dimen> + <dimen name="keyguard_min_swipe_amount">110dp</dimen> <!-- The minimum background radius when swiping to a side for the camera / phone affordances. --> <dimen name="keyguard_affordance_min_background_radius">30dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java index 6653254..f1dcffb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java @@ -46,7 +46,6 @@ public class KeyguardAffordanceHelper { private FlingAnimationUtils mFlingAnimationUtils; private Callback mCallback; - private int mTrackingPointer; private VelocityTracker mVelocityTracker; private boolean mSwipingInProgress; private float mInitialTouchX; @@ -65,6 +64,7 @@ public class KeyguardAffordanceHelper { private Animator mSwipeAnimator; private int mMinBackgroundRadius; private boolean mMotionPerformedByUser; + private boolean mMotionCancelled; private AnimatorListenerAdapter mFlingEndListener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { @@ -117,13 +117,11 @@ public class KeyguardAffordanceHelper { } public boolean onTouchEvent(MotionEvent event) { - int pointerIndex = event.findPointerIndex(mTrackingPointer); - if (pointerIndex < 0) { - pointerIndex = 0; - mTrackingPointer = event.getPointerId(pointerIndex); + if (mMotionCancelled && event.getActionMasked() != MotionEvent.ACTION_DOWN) { + return false; } - final float y = event.getY(pointerIndex); - final float x = event.getX(pointerIndex); + final float y = event.getY(); + final float x = event.getX(); boolean isUp = false; switch (event.getActionMasked()) { @@ -137,22 +135,12 @@ public class KeyguardAffordanceHelper { initVelocityTracker(); trackMovement(event); mMotionPerformedByUser = false; + mMotionCancelled = false; 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 newX = event.getX(newIndex); - mTrackingPointer = event.getPointerId(newIndex); - mInitialTouchY = newY; - mInitialTouchX = newX; - mTranslationOnDown = mTranslation; - } + case MotionEvent.ACTION_POINTER_DOWN: + mMotionCancelled = true; + endMotion(event, true /* forceSnapBack */); break; - case MotionEvent.ACTION_MOVE: final float w = x - mInitialTouchX; trackMovement(event); @@ -174,20 +162,23 @@ public class KeyguardAffordanceHelper { case MotionEvent.ACTION_UP: isUp = true; case MotionEvent.ACTION_CANCEL: - mTrackingPointer = -1; trackMovement(event); - if (mSwipingInProgress) { - flingWithCurrentVelocity(!isUp); - } - if (mVelocityTracker != null) { - mVelocityTracker.recycle(); - mVelocityTracker = null; - } + endMotion(event, !isUp); break; } return true; } + private void endMotion(MotionEvent event, boolean forceSnapBack) { + if (mSwipingInProgress) { + flingWithCurrentVelocity(forceSnapBack); + } + if (mVelocityTracker != null) { + mVelocityTracker.recycle(); + mVelocityTracker = null; + } + } + private void setSwipingInProgress(boolean inProgress) { mSwipingInProgress = inProgress; if (inProgress) { |