diff options
author | Joe Onorato <joeo@google.com> | 2010-11-15 13:30:12 -0800 |
---|---|---|
committer | Joe Onorato <joeo@google.com> | 2010-11-15 13:30:49 -0800 |
commit | abb27777f4763d057d37a58936232f8e17f57de1 (patch) | |
tree | 2ee98370e5e2ee1c4cedab53389dd19e7b047588 /packages | |
parent | 64f1163084433952766eed31dbd26df420ba6cfb (diff) | |
download | frameworks_base-abb27777f4763d057d37a58936232f8e17f57de1.zip frameworks_base-abb27777f4763d057d37a58936232f8e17f57de1.tar.gz frameworks_base-abb27777f4763d057d37a58936232f8e17f57de1.tar.bz2 |
Don't cancel the key buttons when you drag outside their bounds.
Bug: 3183205
Change-Id: I9e0f2e4e550b3e5b1b46099145b4c703b77aca77
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java | 20 |
1 files changed, 11 insertions, 9 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 127d1b1..aed3dc7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java @@ -100,22 +100,24 @@ public class KeyButtonView extends ImageView { if (mSending) { x = (int)ev.getX(); y = (int)ev.getY(); - if (x < 0 || x >= getWidth() || y < 0 || y >= getHeight()) { - mSending = false; - sendEvent(KeyEvent.ACTION_UP, - KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY - | KeyEvent.FLAG_CANCELED); - setPressed(false); - removeCallbacks(mCheckLongPress); - } + setPressed(x >= 0 && x < getWidth() && y >= 0 && y < getHeight()); } break; - case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: setPressed(false); if (mSending && !mLongPressed) { mSending = false; sendEvent(KeyEvent.ACTION_UP, + KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY + | KeyEvent.FLAG_CANCELED); + removeCallbacks(mCheckLongPress); + } + break; + case MotionEvent.ACTION_UP: + setPressed(false); + if (mSending && !mLongPressed) { + mSending = false; + sendEvent(KeyEvent.ACTION_UP, KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY); removeCallbacks(mCheckLongPress); } |