Cancel update batch input timer when gesture typing has been canceled

Bug: 7594165
Change-Id: I9dc42919bd196c249c79668570004d3f541cc9ec
main
Tadashi G. Takaoka 2012-11-30 14:53:38 +09:00
parent 061da39c0f
commit b5fc0e02d0
2 changed files with 5 additions and 4 deletions

View File

@ -749,12 +749,12 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
if (getActivePointerTrackerCount() == 1) { if (getActivePointerTrackerCount() == 1) {
sInGesture = false; sInGesture = false;
sTimeRecorder.onEndBatchInput(eventTime); sTimeRecorder.onEndBatchInput(eventTime);
mTimerProxy.cancelAllUpdateBatchInputTimers();
if (!mIsTrackingCanceled) { if (!mIsTrackingCanceled) {
if (DEBUG_LISTENER) { if (DEBUG_LISTENER) {
Log.d(TAG, String.format("[%d] onEndBatchInput : batchPoints=%d", Log.d(TAG, String.format("[%d] onEndBatchInput : batchPoints=%d",
mPointerId, sAggregratedPointers.getPointerSize())); mPointerId, sAggregratedPointers.getPointerSize()));
} }
mTimerProxy.cancelAllUpdateBatchInputTimers();
mListener.onEndBatchInput(sAggregratedPointers); mListener.onEndBatchInput(sAggregratedPointers);
} }
} }

View File

@ -1464,7 +1464,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
private static final class BatchInputUpdater implements Handler.Callback { private static final class BatchInputUpdater implements Handler.Callback {
private final Handler mHandler; private final Handler mHandler;
private LatinIME mLatinIme; private LatinIME mLatinIme;
private boolean mInBatchInput; // synchornized using "this". private boolean mInBatchInput; // synchronized using "this".
private BatchInputUpdater() { private BatchInputUpdater() {
final HandlerThread handlerThread = new HandlerThread( final HandlerThread handlerThread = new HandlerThread(
@ -1496,6 +1496,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
// Run in the UI thread. // Run in the UI thread.
public synchronized void onStartBatchInput() { public synchronized void onStartBatchInput() {
mHandler.removeMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP);
mInBatchInput = true; mInBatchInput = true;
} }
@ -1503,7 +1504,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
private synchronized void updateBatchInput(final InputPointers batchPointers, private synchronized void updateBatchInput(final InputPointers batchPointers,
final LatinIME latinIme) { final LatinIME latinIme) {
if (!mInBatchInput) { if (!mInBatchInput) {
// Batch input has ended while the message was being delivered. // Batch input has ended or canceled while the message was being delivered.
return; return;
} }
final SuggestedWords suggestedWords = getSuggestedWordsGestureLocked( final SuggestedWords suggestedWords = getSuggestedWordsGestureLocked(
@ -1523,7 +1524,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
.sendToTarget(); .sendToTarget();
} }
public void onCancelBatchInput(final LatinIME latinIme) { public synchronized void onCancelBatchInput(final LatinIME latinIme) {
mInBatchInput = false; mInBatchInput = false;
latinIme.mHandler.showGesturePreviewAndSuggestionStrip( latinIme.mHandler.showGesturePreviewAndSuggestionStrip(
SuggestedWords.EMPTY, true /* dismissGestureFloatingPreviewText */); SuggestedWords.EMPTY, true /* dismissGestureFloatingPreviewText */);