am 51a95613: Merge "Cancel batch input when orientation has been changed"

* commit '51a95613365b4313dff89db73de76f1cd2de5612':
  Cancel batch input when orientation has been changed
main
Tadashi G. Takaoka 2012-12-06 21:03:56 -08:00 committed by Android Git Automerger
commit 8f3ace0972
2 changed files with 20 additions and 12 deletions

View File

@ -777,6 +777,15 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
mDrawingProxy.showGesturePreviewTrail(this, isOldestTrackerInQueue(this)); mDrawingProxy.showGesturePreviewTrail(this, isOldestTrackerInQueue(this));
} }
private void cancelBatchInput() {
sPointerTrackerQueue.cancelAllPointerTracker();
sInGesture = false;
if (DEBUG_LISTENER) {
Log.d(TAG, String.format("[%d] onCancelBatchInput", mPointerId));
}
mListener.onCancelBatchInput();
}
public void processMotionEvent(final int action, final int x, final int y, final long eventTime, public void processMotionEvent(final int action, final int x, final int y, final long eventTime,
final KeyEventHandler handler) { final KeyEventHandler handler) {
switch (action) { switch (action) {
@ -892,12 +901,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
final boolean onValidArea = mGestureStrokeWithPreviewPoints.addPointOnKeyboard( final boolean onValidArea = mGestureStrokeWithPreviewPoints.addPointOnKeyboard(
x, y, gestureTime, isMajorEvent); x, y, gestureTime, isMajorEvent);
if (!onValidArea) { if (!onValidArea) {
sPointerTrackerQueue.cancelAllPointerTracker(); cancelBatchInput();
if (DEBUG_LISTENER) {
Log.d(TAG, String.format("[%d] onCancelBatchInput: batchPoints=%d",
mPointerId, sAggregratedPointers.getPointerSize()));
}
mListener.onCancelBatchInput();
return; return;
} }
mayStartBatchInput(key); mayStartBatchInput(key);
@ -1162,8 +1166,11 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
printTouchEvent("onCancelEvt:", x, y, eventTime); printTouchEvent("onCancelEvt:", x, y, eventTime);
} }
sPointerTrackerQueue.releaseAllPointersExcept(this, eventTime); if (sInGesture) {
sPointerTrackerQueue.remove(this); cancelBatchInput();
}
sPointerTrackerQueue.cancelAllPointerTracker();
sPointerTrackerQueue.releaseAllPointers(eventTime);
onCancelEventInternal(); onCancelEventInternal();
} }

View File

@ -1553,13 +1553,14 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
private void showGesturePreviewAndSuggestionStrip(final SuggestedWords suggestedWords, private void showGesturePreviewAndSuggestionStrip(final SuggestedWords suggestedWords,
final boolean dismissGestureFloatingPreviewText) { final boolean dismissGestureFloatingPreviewText) {
final String batchInputText = suggestedWords.isEmpty()
? null : suggestedWords.getWord(0);
final KeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
mainKeyboardView.showGestureFloatingPreviewText(batchInputText);
showSuggestionStrip(suggestedWords, null); showSuggestionStrip(suggestedWords, null);
final KeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
if (dismissGestureFloatingPreviewText) { if (dismissGestureFloatingPreviewText) {
mainKeyboardView.dismissGestureFloatingPreviewText(); mainKeyboardView.dismissGestureFloatingPreviewText();
} else {
final String batchInputText = suggestedWords.isEmpty()
? null : suggestedWords.getWord(0);
mainKeyboardView.showGestureFloatingPreviewText(batchInputText);
} }
} }