diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index f7c54c7..e4051e8 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -50,15 +50,15 @@
 import com.android.inputmethod.annotations.ExternallyReferenced;
 import com.android.inputmethod.keyboard.PointerTracker.DrawingProxy;
 import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
+import com.android.inputmethod.keyboard.internal.DrawingHandler;
 import com.android.inputmethod.keyboard.internal.GestureFloatingPreviewText;
 import com.android.inputmethod.keyboard.internal.GestureTrailsPreview;
 import com.android.inputmethod.keyboard.internal.KeyDrawParams;
 import com.android.inputmethod.keyboard.internal.KeyPreviewDrawParams;
-import com.android.inputmethod.keyboard.internal.MainKeyboardViewDrawingHandler;
-import com.android.inputmethod.keyboard.internal.MainKeyboardViewTimerHandler;
 import com.android.inputmethod.keyboard.internal.NonDistinctMultitouchHelper;
 import com.android.inputmethod.keyboard.internal.PreviewPlacerView;
 import com.android.inputmethod.keyboard.internal.SlidingKeyInputPreview;
+import com.android.inputmethod.keyboard.internal.TimerHandler;
 import com.android.inputmethod.latin.Constants;
 import com.android.inputmethod.latin.LatinImeLogger;
 import com.android.inputmethod.latin.R;
@@ -120,7 +120,8 @@
  * @attr ref R.styleable#MainKeyboardView_suppressKeyPreviewAfterBatchInputDuration
  */
 public final class MainKeyboardView extends KeyboardView implements PointerTracker.KeyEventHandler,
-        PointerTracker.DrawingProxy, MoreKeysPanel.Controller {
+        PointerTracker.DrawingProxy, MoreKeysPanel.Controller, DrawingHandler.Callbacks,
+        TimerHandler.Callbacks {
     private static final String TAG = MainKeyboardView.class.getSimpleName();
 
     /** Listener for {@link KeyboardActionListener}. */
@@ -196,14 +197,14 @@
     // TODO: Make this parameter customizable by user via settings.
     private int mGestureFloatingPreviewTextLingerTimeout;
 
-    private KeyDetector mKeyDetector;
+    private final KeyDetector mKeyDetector;
     private final NonDistinctMultitouchHelper mNonDistinctMultitouchHelper;
 
-    private final MainKeyboardViewTimerHandler mKeyTimerHandler;
+    private final TimerHandler mKeyTimerHandler;
     private final int mLanguageOnSpacebarHorizontalMargin;
 
-    private final MainKeyboardViewDrawingHandler mDrawingHandler =
-            new MainKeyboardViewDrawingHandler(this);
+    private final DrawingHandler mDrawingHandler =
+            new DrawingHandler(this);
 
     public MainKeyboardView(final Context context, final AttributeSet attrs) {
         this(context, attrs, R.attr.mainKeyboardViewStyle);
@@ -256,7 +257,12 @@
                 R.styleable.MainKeyboardView_keyHysteresisDistanceForSlidingModifier, 0.0f);
         mKeyDetector = new KeyDetector(
                 keyHysteresisDistance, keyHysteresisDistanceForSlidingModifier);
-        mKeyTimerHandler = new MainKeyboardViewTimerHandler(this, mainKeyboardViewAttr);
+        final int ignoreAltCodeKeyTimeout = mainKeyboardViewAttr.getInt(
+                R.styleable.MainKeyboardView_ignoreAltCodeKeyTimeout, 0);
+        final int gestureRecognitionUpdateTime = mainKeyboardViewAttr.getInt(
+                R.styleable.MainKeyboardView_gestureRecognitionUpdateTime, 0);
+        mKeyTimerHandler = new TimerHandler(
+                this, ignoreAltCodeKeyTimeout, gestureRecognitionUpdateTime);
         mKeyPreviewOffset = mainKeyboardViewAttr.getDimensionPixelOffset(
                 R.styleable.MainKeyboardView_keyPreviewOffset, 0);
         mKeyPreviewHeight = mainKeyboardViewAttr.getDimensionPixelSize(
@@ -344,11 +350,14 @@
         animatorToStart.setCurrentPlayTime(startTime);
     }
 
+    // Implements {@link TimerHander.Callbacks} method.
+    @Override
     public void startWhileTypingFadeinAnimation() {
         cancelAndStartAnimators(
                 mAltCodeKeyWhileTypingFadeoutAnimator, mAltCodeKeyWhileTypingFadeinAnimator);
     }
 
+    @Override
     public void startWhileTypingFadeoutAnimation() {
         cancelAndStartAnimators(
                 mAltCodeKeyWhileTypingFadeinAnimator, mAltCodeKeyWhileTypingFadeoutAnimator);
@@ -521,6 +530,8 @@
         return previewTextView;
     }
 
+    // Implements {@link DrawingHandler.Callbacks} method.
+    @Override
     public void dismissAllKeyPreviews() {
         for (final Key key : new HashSet<Key>(mShowingKeyPreviewTextViews.keySet())) {
             dismissKeyPreviewWithoutDelay(key);
@@ -714,7 +725,9 @@
         return zoomOutAnimation;
     }
 
+    // Implements {@link TimerHandler.Callbacks} method.
     // TODO: Take this method out of this class.
+    @Override
     public void dismissKeyPreviewWithoutDelay(final Key key) {
         if (key == null) {
             return;
@@ -773,6 +786,8 @@
         mGestureTrailsPreview.setPreviewEnabled(isGestureTrailEnabled);
     }
 
+    // Implements {@link DrawingHandler.Callbacks} method.
+    @Override
     public void showGestureFloatingPreviewText(final SuggestedWords suggestedWords) {
         locatePreviewPlacerView();
         mGestureFloatingPreviewText.setSuggetedWords(suggestedWords);
@@ -848,10 +863,12 @@
         return moreKeysKeyboardView;
     }
 
+    // Implements {@link TimerHandler.Callbacks} method.
     /**
      * Called when a key is long pressed.
      * @param tracker the pointer tracker which pressed the parent key
      */
+    @Override
     public void onLongPress(final PointerTracker tracker) {
         if (isShowingMoreKeysPanel()) {
             return;
diff --git a/java/src/com/android/inputmethod/keyboard/internal/MainKeyboardViewDrawingHandler.java b/java/src/com/android/inputmethod/keyboard/internal/DrawingHandler.java
similarity index 67%
rename from java/src/com/android/inputmethod/keyboard/internal/MainKeyboardViewDrawingHandler.java
rename to java/src/com/android/inputmethod/keyboard/internal/DrawingHandler.java
index fb1f789..df82bec 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/MainKeyboardViewDrawingHandler.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/DrawingHandler.java
@@ -19,30 +19,37 @@
 import android.os.Message;
 
 import com.android.inputmethod.keyboard.Key;
-import com.android.inputmethod.keyboard.MainKeyboardView;
+import com.android.inputmethod.keyboard.internal.DrawingHandler.Callbacks;
 import com.android.inputmethod.latin.SuggestedWords;
 import com.android.inputmethod.latin.utils.LeakGuardHandlerWrapper;
 
-public class MainKeyboardViewDrawingHandler extends LeakGuardHandlerWrapper<MainKeyboardView> {
+// TODO: Separate this class into KeyPreviewHandler and BatchInputPreviewHandler or so.
+public class DrawingHandler extends LeakGuardHandlerWrapper<Callbacks> {
+    public interface Callbacks {
+        public void dismissKeyPreviewWithoutDelay(Key key);
+        public void dismissAllKeyPreviews();
+        public void showGestureFloatingPreviewText(SuggestedWords suggestedWords);
+    }
+
     private static final int MSG_DISMISS_KEY_PREVIEW = 0;
     private static final int MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT = 1;
 
-    public MainKeyboardViewDrawingHandler(final MainKeyboardView ownerInstance) {
+    public DrawingHandler(final Callbacks ownerInstance) {
         super(ownerInstance);
     }
 
     @Override
     public void handleMessage(final Message msg) {
-        final MainKeyboardView mainKeyboardView = getOwnerInstance();
-        if (mainKeyboardView == null) {
+        final Callbacks callbacks = getOwnerInstance();
+        if (callbacks == null) {
             return;
         }
         switch (msg.what) {
         case MSG_DISMISS_KEY_PREVIEW:
-            mainKeyboardView.dismissKeyPreviewWithoutDelay((Key)msg.obj);
+            callbacks.dismissKeyPreviewWithoutDelay((Key)msg.obj);
             break;
         case MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT:
-            mainKeyboardView.showGestureFloatingPreviewText(SuggestedWords.EMPTY);
+            callbacks.showGestureFloatingPreviewText(SuggestedWords.EMPTY);
             break;
         }
     }
@@ -53,11 +60,11 @@
 
     private void cancelAllDismissKeyPreviews() {
         removeMessages(MSG_DISMISS_KEY_PREVIEW);
-        final MainKeyboardView mainKeyboardView = getOwnerInstance();
-        if (mainKeyboardView == null) {
+        final Callbacks callbacks = getOwnerInstance();
+        if (callbacks == null) {
             return;
         }
-        mainKeyboardView.dismissAllKeyPreviews();
+        callbacks.dismissAllKeyPreviews();
     }
 
     public void dismissGestureFloatingPreviewText(final long delay) {
diff --git a/java/src/com/android/inputmethod/keyboard/internal/MainKeyboardViewTimerHandler.java b/java/src/com/android/inputmethod/keyboard/internal/TimerHandler.java
similarity index 81%
rename from java/src/com/android/inputmethod/keyboard/internal/MainKeyboardViewTimerHandler.java
rename to java/src/com/android/inputmethod/keyboard/internal/TimerHandler.java
index 9b275ea..966cb95 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/MainKeyboardViewTimerHandler.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/TimerHandler.java
@@ -16,21 +16,25 @@
 
 package com.android.inputmethod.keyboard.internal;
 
-import android.content.res.TypedArray;
 import android.os.Message;
 import android.os.SystemClock;
 import android.view.ViewConfiguration;
 
 import com.android.inputmethod.keyboard.Key;
-import com.android.inputmethod.keyboard.MainKeyboardView;
 import com.android.inputmethod.keyboard.PointerTracker;
 import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
+import com.android.inputmethod.keyboard.internal.TimerHandler.Callbacks;
 import com.android.inputmethod.latin.Constants;
-import com.android.inputmethod.latin.R;
 import com.android.inputmethod.latin.utils.LeakGuardHandlerWrapper;
 
-public final class MainKeyboardViewTimerHandler extends LeakGuardHandlerWrapper<MainKeyboardView>
-        implements TimerProxy {
+// TODO: Separate this class into KeyTimerHandler and BatchInputTimerHandler or so.
+public final class TimerHandler extends LeakGuardHandlerWrapper<Callbacks> implements TimerProxy {
+    public interface Callbacks {
+        public void startWhileTypingFadeinAnimation();
+        public void startWhileTypingFadeoutAnimation();
+        public void onLongPress(PointerTracker tracker);
+    }
+
     private static final int MSG_TYPING_STATE_EXPIRED = 0;
     private static final int MSG_REPEAT_KEY = 1;
     private static final int MSG_LONGPRESS_KEY = 2;
@@ -40,32 +44,29 @@
     private final int mIgnoreAltCodeKeyTimeout;
     private final int mGestureRecognitionUpdateTime;
 
-    public MainKeyboardViewTimerHandler(final MainKeyboardView ownerInstance,
-            final TypedArray mainKeyboardViewAttr) {
+    public TimerHandler(final Callbacks ownerInstance, final int ignoreAltCodeKeyTimeout,
+            final int gestureRecognitionUpdateTime) {
         super(ownerInstance);
-
-        mIgnoreAltCodeKeyTimeout = mainKeyboardViewAttr.getInt(
-                R.styleable.MainKeyboardView_ignoreAltCodeKeyTimeout, 0);
-        mGestureRecognitionUpdateTime = mainKeyboardViewAttr.getInt(
-                R.styleable.MainKeyboardView_gestureRecognitionUpdateTime, 0);
+        mIgnoreAltCodeKeyTimeout = ignoreAltCodeKeyTimeout;
+        mGestureRecognitionUpdateTime = gestureRecognitionUpdateTime;
     }
 
     @Override
     public void handleMessage(final Message msg) {
-        final MainKeyboardView mainKeyboardView = getOwnerInstance();
-        if (mainKeyboardView == null) {
+        final Callbacks callbacks = getOwnerInstance();
+        if (callbacks == null) {
             return;
         }
         final PointerTracker tracker = (PointerTracker) msg.obj;
         switch (msg.what) {
         case MSG_TYPING_STATE_EXPIRED:
-            mainKeyboardView.startWhileTypingFadeinAnimation();
+            callbacks.startWhileTypingFadeinAnimation();
             break;
         case MSG_REPEAT_KEY:
             tracker.onKeyRepeat(msg.arg1 /* code */, msg.arg2 /* repeatCount */);
             break;
         case MSG_LONGPRESS_KEY:
-            mainKeyboardView.onLongPress(tracker);
+            callbacks.onLongPress(tracker);
             break;
         case MSG_UPDATE_BATCH_INPUT:
             tracker.updateBatchInputByTimer(SystemClock.uptimeMillis());
@@ -114,8 +115,8 @@
 
         final boolean isTyping = isTypingState();
         removeMessages(MSG_TYPING_STATE_EXPIRED);
-        final MainKeyboardView mainKeyboardView = getOwnerInstance();
-        if (mainKeyboardView == null) {
+        final Callbacks callbacks = getOwnerInstance();
+        if (callbacks == null) {
             return;
         }
 
@@ -123,7 +124,7 @@
         final int typedCode = typedKey.getCode();
         if (typedCode == Constants.CODE_SPACE || typedCode == Constants.CODE_ENTER) {
             if (isTyping) {
-                mainKeyboardView.startWhileTypingFadeinAnimation();
+                callbacks.startWhileTypingFadeinAnimation();
             }
             return;
         }
@@ -133,7 +134,7 @@
         if (isTyping) {
             return;
         }
-        mainKeyboardView.startWhileTypingFadeoutAnimation();
+        callbacks.startWhileTypingFadeoutAnimation();
     }
 
     @Override
