Disable gesture detector on mini-keyboard (DO NOT MERGE)

This is cherry-pick I548501f7 from Honeycomb.

Gesture detector, for closing keyboard by swiping down, must be
disabled not only when mini-keyboard is on the screen, but also in the
mini-keyboard itself.

Bug: 3105595
Change-Id: Ic4603637208794a1bf6cfeb0d22dadd9a1e49e81
main
Tadashi G. Takaoka 2010-10-18 21:10:11 +09:00
parent f9ac1272f2
commit 6c13b1a6c7
1 changed files with 6 additions and 3 deletions

View File

@ -226,7 +226,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
protected KeyDetector mKeyDetector = new ProximityKeyDetector(); protected KeyDetector mKeyDetector = new ProximityKeyDetector();
// Swipe gesture detector // Swipe gesture detector
private final GestureDetector mGestureDetector; private GestureDetector mGestureDetector;
private final SwipeTracker mSwipeTracker = new SwipeTracker(); private final SwipeTracker mSwipeTracker = new SwipeTracker();
private final int mSwipeThreshold; private final int mSwipeThreshold;
private final boolean mDisambiguateSwipe; private final boolean mDisambiguateSwipe;
@ -1106,6 +1106,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
}); });
// Override default ProximityKeyDetector. // Override default ProximityKeyDetector.
miniKeyboard.mKeyDetector = new MiniKeyboardKeyDetector(mMiniKeyboardSlideAllowance); miniKeyboard.mKeyDetector = new MiniKeyboardKeyDetector(mMiniKeyboardSlideAllowance);
// Remove gesture detector on mini-keyboard
miniKeyboard.mGestureDetector = null;
Keyboard keyboard; Keyboard keyboard;
if (popupKey.popupCharacters != null) { if (popupKey.popupCharacters != null) {
@ -1307,8 +1309,9 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
// Track the last few movements to look for spurious swipes. // Track the last few movements to look for spurious swipes.
mSwipeTracker.addMovement(me); mSwipeTracker.addMovement(me);
// We must disable gesture detector while mini-keyboard is on the screen. // Gesture detector must be enabled only when mini-keyboard is not on the screen.
if (mMiniKeyboard == null && mGestureDetector.onTouchEvent(me)) { if (mMiniKeyboard == null
&& mGestureDetector != null && mGestureDetector.onTouchEvent(me)) {
dismissKeyPreview(); dismissKeyPreview();
mHandler.cancelKeyTimers(); mHandler.cancelKeyTimers();
return true; return true;