diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
index e3bad80..4007c2b 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
@@ -178,6 +178,7 @@
     /** Listener for {@link OnKeyboardActionListener}. */
     private OnKeyboardActionListener mKeyboardActionListener;
 
+    private static final int DELAY_BEFORE_PREVIEW = 0;
     private static final int DELAY_AFTER_PREVIEW = 70;
     private static final int DEBOUNCE_TIME = 70;
 
@@ -244,15 +245,19 @@
     UIHandler mHandler = new UIHandler();
 
     class UIHandler extends Handler {
-        private static final int MSG_DISMISS_PREVIEW = 0;
-        private static final int MSG_REPEAT_KEY = 1;
-        private static final int MSG_LOGPRESS_KEY = 2;
+        private static final int MSG_POPUP_PREVIEW = 1;
+        private static final int MSG_DISMISS_PREVIEW = 2;
+        private static final int MSG_REPEAT_KEY = 3;
+        private static final int MSG_LOGPRESS_KEY = 4;
 
         private boolean mInKeyRepeat;
 
         @Override
         public void handleMessage(Message msg) {
             switch (msg.what) {
+                case MSG_POPUP_PREVIEW:
+                    showKey(msg.arg1);
+                    break;
                 case MSG_DISMISS_PREVIEW:
                     mPreviewText.setVisibility(INVISIBLE);
                     break;
@@ -266,6 +271,15 @@
             }
         }
 
+        public void popupPreview(int keyIndex, long delay) {
+            removeMessages(MSG_POPUP_PREVIEW);
+            sendMessageDelayed(obtainMessage(MSG_POPUP_PREVIEW, keyIndex, 0), delay);
+        }
+
+        public void cancelPopupPreview() {
+            removeMessages(MSG_POPUP_PREVIEW);
+        }
+
         public void dismissPreview(long delay) {
             sendMessageDelayed(obtainMessage(MSG_DISMISS_PREVIEW), delay);
         }
@@ -304,6 +318,7 @@
 
         public void cancelAllMessages() {
             cancelKeyTimers();
+            cancelPopupPreview();
             cancelDismissPreview();
         }
     };
@@ -598,6 +613,7 @@
         }
         // Remove any pending messages, except dismissing preview
         mHandler.cancelKeyTimers();
+        mHandler.cancelPopupPreview();
         mKeyboard = keyboard;
         LatinImeLogger.onSetKeyboard(mKeyboard);
         List<Key> keys = mKeyboard.getKeys();
@@ -969,11 +985,17 @@
         // If key changed and preview is on ...
         if (oldKeyIndex != mCurrentKeyIndex && mShowPreview) {
             if (keyIndex == NOT_A_KEY) {
+                mHandler.cancelPopupPreview();
                 if (previewPopup.isShowing()) {
                     mHandler.dismissPreview(DELAY_AFTER_PREVIEW);
                 }
             } else {
-                showKey(keyIndex);
+                if (previewPopup.isShowing() && mPreviewText.getVisibility() == VISIBLE) {
+                    // Show right away, if it's already visible and finger is moving around
+                    showKey(keyIndex);
+                } else {
+                    mHandler.popupPreview(keyIndex, DELAY_BEFORE_PREVIEW);
+                }
             }
         }
     }
@@ -1350,6 +1372,7 @@
         int keyIndex = mProximityKeyDetector.getKeyIndexAndNearbyCodes(touchX, touchY, null);
         boolean wasInKeyRepeat = mHandler.isInKeyRepeat();
         mHandler.cancelKeyTimers();
+        mHandler.cancelPopupPreview();
         if (mDebouncer.isMinorMoveBounce(touchX, touchY, keyIndex, mCurrentKey)) {
             mDebouncer.updateTimeDebouncing(eventTime);
         } else {
@@ -1372,6 +1395,7 @@
 
     private void onCancelEvent(int touchX, int touchY, long eventTime) {
         mHandler.cancelKeyTimers();
+        mHandler.cancelPopupPreview();
         dismissPopupKeyboard();
         mAbortKey = true;
         showPreview(NOT_A_KEY);
