diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2011-11-02 11:51:58 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-11-02 11:51:58 -0700 |
| commit | 1997fe1482ecf1ca920c7729a1ad9df5340565f3 (patch) | |
| tree | 0e6101d645a1b535f3432a2fcf6b00de4dcb1447 /core/java | |
| parent | 779c1b8507d939bd3bd6d3e758ded095d91bcd6f (diff) | |
| parent | 67578618fb7ac1bf353d7caaadf9a49c09be5d07 (diff) | |
Merge "Update KeyBoardView to reflect the interaction model in Latin IME" into ics-mr1
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/inputmethodservice/KeyboardView.java | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/core/java/android/inputmethodservice/KeyboardView.java b/core/java/android/inputmethodservice/KeyboardView.java index 5343e2a5f1bc..5143f7f4712b 100644 --- a/core/java/android/inputmethodservice/KeyboardView.java +++ b/core/java/android/inputmethodservice/KeyboardView.java @@ -1145,44 +1145,29 @@ public class KeyboardView extends View implements View.OnClickListener { @Override public boolean onHoverEvent(MotionEvent event) { - // If touch exploring is enabled we ignore touch events and transform - // the stream of hover events as touch events. This allows one consistent - // event stream to drive the keyboard since during touch exploring the - // first touch generates only hover events and tapping on the same - // location generates hover and touch events. if (mAccessibilityManager.isTouchExplorationEnabled() && event.getPointerCount() == 1) { final int action = event.getAction(); switch (action) { case MotionEvent.ACTION_HOVER_ENTER: - event.setAction(MotionEvent.ACTION_DOWN); - break; case MotionEvent.ACTION_HOVER_MOVE: - event.setAction(MotionEvent.ACTION_MOVE); + final int touchX = (int) event.getX() - mPaddingLeft; + int touchY = (int) event.getY() - mPaddingTop; + if (touchY >= -mVerticalCorrection) { + touchY += mVerticalCorrection; + } + final int keyIndex = getKeyIndices(touchX, touchY, null); + showPreview(keyIndex); break; case MotionEvent.ACTION_HOVER_EXIT: - event.setAction(MotionEvent.ACTION_UP); + showPreview(NOT_A_KEY); break; } - onTouchEventInternal(event); - event.setAction(action); } - return super.onHoverEvent(event); + return true; } @Override - public boolean onTouchEvent(MotionEvent event) { - // If touch exploring is enabled we ignore touch events and transform - // the stream of hover events as touch events. This allows one consistent - // event stream to drive the keyboard since during touch exploring the - // first touch generates only hover events and tapping on the same - // location generates hover and touch events. - if (mAccessibilityManager.isTouchExplorationEnabled()) { - return true; - } - return onTouchEventInternal(event); - } - - private boolean onTouchEventInternal(MotionEvent me) { + public boolean onTouchEvent(MotionEvent me) { // Convert multi-pointer up/down events to single up/down events to // deal with the typical multi-pointer behavior of two-thumb typing final int pointerCount = me.getPointerCount(); |
