diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index 4e4ccef1878a72a90278765890de8af5237bebf7..42d1fe1acd6754c1fe68ac4defc16cc2e2ac6bb4 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -73,10 +73,11 @@ public class Key { private static final int LABEL_FLAGS_WITH_ICON_RIGHT = 0x2000; private static final int LABEL_FLAGS_AUTO_X_SCALE = 0x4000; + // TODO: This should be public final /** Icon to display instead of a label. Icon takes precedence over a label */ private Drawable mIcon; /** Preview version of the icon, for the preview popup */ - private Drawable mPreviewIcon; + public final Drawable mPreviewIcon; /** Width of the key, not including the gap */ public final int mWidth; @@ -198,6 +199,7 @@ public class Key { mCode = code; mAltCode = Keyboard.CODE_DUMMY; mIcon = icon; + mPreviewIcon = null; // Horizontal gap is divided equally to both sides of the key. mX = x + mHorizontalGap / 2; mY = y; @@ -425,18 +427,11 @@ public class Key { return mIcon; } - public Drawable getPreviewIcon() { - return mPreviewIcon; - } - + // TODO: Get rid of this method. public void setIcon(Drawable icon) { mIcon = icon; } - public void setPreviewIcon(Drawable icon) { - mPreviewIcon = icon; - } - /** * Informs the key that it has been pressed, in case it needs to change its appearance or * state. diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index d2741edec5788a87d8539d5651b23dd38bc08050..ebc0d82b21da9e7230db60bc067bc495407b0a33 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -889,7 +889,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { } previewText.setText(mKeyboard.adjustLabelCase(key.mLabel)); } else { - final Drawable previewIcon = key.getPreviewIcon(); + final Drawable previewIcon = key.mPreviewIcon; previewText.setCompoundDrawables(null, null, null, previewIcon != null ? previewIcon : key.getIcon()); previewText.setText(null);