Disable gesture detector on mini-keyboard

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: I548501f7117ca2310943cabb678c1e250e5012ce
main
Tadashi G. Takaoka 2010-10-18 21:10:11 +09:00
parent c7c2472afb
commit 28d8a488c0
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;
@ -1132,6 +1132,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;
BaseKeyboard keyboard; BaseKeyboard keyboard;
if (popupKey.popupCharacters != null) { if (popupKey.popupCharacters != null) {
@ -1304,8 +1306,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;