diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index e1c841de7..810bd9150 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -424,8 +424,8 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack */ @Override public void setKeyboard(final Keyboard keyboard) { - // Remove any pending messages. - mKeyTimerHandler.cancelAllKeyTimers(); + // Remove any pending messages, except dismissing preview and key repeat. + mKeyTimerHandler.cancelLongPressTimers(); super.setKeyboard(keyboard); mKeyDetector.setKeyboard( keyboard, -getPaddingLeft(), -getPaddingTop() + getVerticalCorrection()); diff --git a/java/src/com/android/inputmethod/keyboard/internal/TimerHandler.java b/java/src/com/android/inputmethod/keyboard/internal/TimerHandler.java index 3298a3f24..ec7b9b024 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/TimerHandler.java +++ b/java/src/com/android/inputmethod/keyboard/internal/TimerHandler.java @@ -126,7 +126,7 @@ public final class TimerHandler extends LeakGuardHandlerWrapper imple removeMessages(MSG_LONGPRESS_SHIFT_KEY); } - private void cancelLongPressTimers() { + public void cancelLongPressTimers() { removeMessages(MSG_LONGPRESS_KEY); removeMessages(MSG_LONGPRESS_SHIFT_KEY); }