aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2010-09-22 00:00:16 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-22 00:00:16 -0700
commit7c120ce4872398ea4f61a67aba1d069e45f1c012 (patch)
tree55b2e8bcf6c47db25f8b6a18e841f5385aa56633 /java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
parent33c13c413ad7cf30d5a12e2ba6c463e01b47e92a (diff)
parent3a2896c80475094f751ef447fc9c97028bfc2265 (diff)
downloadlatinime-7c120ce4872398ea4f61a67aba1d069e45f1c012.tar.gz
latinime-7c120ce4872398ea4f61a67aba1d069e45f1c012.tar.xz
latinime-7c120ce4872398ea4f61a67aba1d069e45f1c012.zip
am 3a2896c8: Fix issue space key preview remains on screen and would not dismiss
Merge commit '3a2896c80475094f751ef447fc9c97028bfc2265' into gingerbread-plus-aosp * commit '3a2896c80475094f751ef447fc9c97028bfc2265': Fix issue space key preview remains on screen and would not dismiss
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java13
1 files changed, 11 insertions, 2 deletions
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);