From 3a2896c80475094f751ef447fc9c97028bfc2265 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 21 Sep 2010 16:55:18 +0900 Subject: Fix issue space key preview remains on screen and would not dismiss The space key preview should be displayed one of the following case. - Popup preview is enabled - Language switcher is in action, whether popup preview is enabled or not. For phone number keyboard, popup preview is never displayed even if popup preview is enabled. Bug: 3006612 Bug: 3021091 Change-Id: I5385c776d0e8e3981fc8d8851db9140d92599ce5 --- .../android/inputmethod/latin/LatinKeyboardBaseView.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java') diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 26b3c0581..fd25d7521 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -881,8 +881,17 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx public void showPreview(int keyIndex, PointerTracker tracker) { int oldKeyIndex = mOldPreviewKeyIndex; mOldPreviewKeyIndex = keyIndex; - // If key changed and preview is on ... - if (oldKeyIndex != keyIndex && mShowPreview) { + final boolean isLanguageSwitchEnabled = (mKeyboard instanceof LatinKeyboard) + && ((LatinKeyboard)mKeyboard).isLanguageSwitchEnabled(); + // We should re-draw popup preview when 1) we need to hide the preview, 2) we will show + // the space key preview and 3) pointer moves off the space key to other letter key, we + // should hide the preview of the previous key. + final boolean hidePreviewOrShowSpaceKeyPreview = (tracker == null) + || tracker.isSpaceKey(keyIndex) || tracker.isSpaceKey(oldKeyIndex); + // If key changed and preview is on or the key is space (language switch is enabled) + if (oldKeyIndex != keyIndex + && (mShowPreview + || (hidePreviewOrShowSpaceKeyPreview && isLanguageSwitchEnabled))) { if (keyIndex == NOT_A_KEY) { mHandler.cancelPopupPreview(); mHandler.dismissPreview(DELAY_AFTER_PREVIEW); -- cgit v1.2.3-83-g751a