Don't draw key top letter when key preview is showing

Bug: 11518021
Change-Id: Ibd33e892b21189a7d044099942845379aa010484
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index 984e19e..9ba4620 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -396,6 +396,8 @@
                         previewTextView.setVisibility(INVISIBLE);
                         mainKeyboardView.mFreeKeyPreviewTextViews.add(previewTextView);
                     }
+                    // To redraw key top letter.
+                    mainKeyboardView.invalidateKey(key);
                 }
                 break;
             case MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT:
@@ -1174,6 +1176,12 @@
         if (key.altCodeWhileTyping() && key.isEnabled()) {
             params.mAnimAlpha = mAltCodeKeyWhileTypingAnimAlpha;
         }
+        // Don't draw key top letter when key preview is showing.
+        if (mShowingKeyPreviewTextViews.containsKey(key)) {
+            // TODO: Fade out animation for the key top letter, and fade in animation for the key
+            // background color when the user presses the key.
+            return;
+        }
         final int code = key.getCode();
         if (code == Constants.CODE_SPACE) {
             drawSpacebar(key, canvas, paint);