diff options
| author | 2015-11-25 00:55:44 +0000 | |
|---|---|---|
| committer | 2015-11-25 00:55:44 +0000 | |
| commit | bd7cafa6da19d42d39c7fdc83c29eab093abfefd (patch) | |
| tree | 17a7e0c2a083d88c29ed29d441c5b12695658ea4 | |
| parent | 21942b2240858de639ed0f727ac03f83fa8ab761 (diff) | |
| parent | 053f21864a731128c2974e89253dd67ed64271d0 (diff) | |
Merge "Don't trigger click if long press already happened"
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java index 4d268ceda4db..ba284c9f2367 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java @@ -52,6 +52,7 @@ public class KeyButtonView extends ImageView { private boolean mSupportsLongpress = true; private AudioManager mAudioManager; private boolean mGestureAborted; + private boolean mLongClicked; private final Runnable mCheckLongPress = new Runnable() { public void run() { @@ -60,9 +61,11 @@ public class KeyButtonView extends ImageView { if (isLongClickable()) { // Just an old-fashioned ImageView performLongClick(); + mLongClicked = true; } else if (mSupportsLongpress) { sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.FLAG_LONG_PRESS); sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); + mLongClicked = true; } } } @@ -155,6 +158,7 @@ public class KeyButtonView extends ImageView { switch (action) { case MotionEvent.ACTION_DOWN: mDownTime = SystemClock.uptimeMillis(); + mLongClicked = false; setPressed(true); if (mCode != 0) { sendEvent(KeyEvent.ACTION_DOWN, 0, mDownTime); @@ -181,7 +185,7 @@ public class KeyButtonView extends ImageView { removeCallbacks(mCheckLongPress); break; case MotionEvent.ACTION_UP: - final boolean doIt = isPressed(); + final boolean doIt = isPressed() && !mLongClicked; setPressed(false); if (mCode != 0) { if (doIt) { |