diff options
author | 2011-06-22 17:11:07 -0700 | |
---|---|---|
committer | 2011-06-30 11:59:35 -0700 | |
commit | 87d7929d142f7c5f1937e12d6fd32a43ab00740e (patch) | |
tree | 0c70162130fef28c0e605653b0fe2372e5895761 /java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java | |
parent | 7e7244873a1317ba898e498526b963f7d41caa86 (diff) | |
download | latinime-87d7929d142f7c5f1937e12d6fd32a43ab00740e.tar.gz latinime-87d7929d142f7c5f1937e12d6fd32a43ab00740e.tar.xz latinime-87d7929d142f7c5f1937e12d6fd32a43ab00740e.zip |
Added text navigation gestures for keyboard touch exploration.
Bug: 4905427
Change-Id: I9b44d65e4503e46ce71322a3c325c55d188e34a0
Diffstat (limited to 'java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java')
-rw-r--r-- | java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java index 96f7fc9f2..a87ff9891 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java @@ -42,6 +42,7 @@ public class AccessibleKeyboardViewProxy { private int mScaledEdgeSlop; private KeyboardView mView; private AccessibleKeyboardActionListener mListener; + private FlickGestureDetector mGestureDetector; private int mLastHoverKeyIndex = KeyDetector.NOT_A_KEY; private int mLastX = -1; @@ -71,6 +72,7 @@ public class AccessibleKeyboardViewProxy { paint.setAntiAlias(true); paint.setColor(Color.YELLOW); + mGestureDetector = new KeyboardFlickGestureDetector(context); mScaledEdgeSlop = ViewConfiguration.get(context).getScaledEdgeSlop(); } @@ -110,7 +112,10 @@ public class AccessibleKeyboardViewProxy { * @return {@code true} if the event is handled */ public boolean onHoverEvent(MotionEvent event, PointerTracker tracker) { - return onTouchExplorationEvent(event, tracker); + if (mGestureDetector.onHoverEvent(event, this, tracker)) + return true; + + return onHoverEventInternal(event, tracker); } public boolean dispatchTouchEvent(MotionEvent event) { @@ -128,7 +133,7 @@ public class AccessibleKeyboardViewProxy { * @param event The touch exploration hover event. * @return {@code true} if the event was handled */ - private boolean onTouchExplorationEvent(MotionEvent event, PointerTracker tracker) { + /*package*/ boolean onHoverEventInternal(MotionEvent event, PointerTracker tracker) { final int x = (int) event.getX(); final int y = (int) event.getY(); @@ -198,4 +203,18 @@ public class AccessibleKeyboardViewProxy { tracker.onDownEvent(x, y, eventTime, null); tracker.onUpEvent(x, y, eventTime + DELAY_KEY_PRESS, null); } + + private class KeyboardFlickGestureDetector extends FlickGestureDetector { + public KeyboardFlickGestureDetector(Context context) { + super(context); + } + + @Override + public boolean onFlick(MotionEvent e1, MotionEvent e2, int direction) { + if (mListener != null) { + mListener.onFlickGesture(direction); + } + return true; + } + } } |