Add outputText and icon to the Key constructor

This is a follow up change for I737bacb1.

Bug: 5023981
Change-Id: I980e3e993c81afe4fbdb95c9c263d7aa52aff66c
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index c3db1b3..9cf64e1 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -192,21 +192,30 @@
         }
     }
 
+    private static int getCode(Resources res, KeyboardParams params, String popupSpec) {
+        return getRtlParenthesisCode(
+                PopupCharactersParser.getCode(res, popupSpec), params.mIsRtlKeyboard);
+    }
+
+    private static Drawable getIcon(KeyboardParams params, String popupSpec) {
+        return params.mIconsSet.getIcon(PopupCharactersParser.getIconId(popupSpec));
+    }
+
     /**
      * This constructor is being used only for key in popup mini keyboard.
      */
     public Key(Resources res, KeyboardParams params, String popupSpec,
             int x, int y, int width, int height, int edgeFlags) {
-        this(params, getRtlParenthesisCode(PopupCharactersParser.getCode(res, popupSpec),
-                params.mIsRtlKeyboard),
-                popupSpec, null, x, y, width, height, edgeFlags);
+        this(params, PopupCharactersParser.getLabel(popupSpec), null, getIcon(params, popupSpec),
+                getCode(res, params, popupSpec), PopupCharactersParser.getOutputText(popupSpec),
+                x, y, width, height, edgeFlags);
     }
 
     /**
      * This constructor is being used only for key in popup suggestions pane.
      */
-    public Key(KeyboardParams params, int code, String popupSpec, String hintLabel,
-            int x, int y, int width, int height, int edgeFlags) {
+    public Key(KeyboardParams params, CharSequence label, CharSequence hintLabel, Drawable icon,
+            int code, CharSequence outputText, int x, int y, int width, int height, int edgeFlags) {
         mHeight = height - params.mVerticalGap;
         mHorizontalGap = params.mHorizontalGap;
         mVerticalGap = params.mVerticalGap;
@@ -220,10 +229,10 @@
         mRepeatable = false;
         mPopupCharacters = null;
         mMaxPopupColumn = 0;
-        mLabel = PopupCharactersParser.getLabel(popupSpec);
-        mOutputText = PopupCharactersParser.getOutputText(popupSpec);
+        mLabel = label;
+        mOutputText = outputText;
         mCode = code;
-        mIcon = params.mIconsSet.getIcon(PopupCharactersParser.getIconId(popupSpec));
+        mIcon = icon;
         // Horizontal gap is divided equally to both sides of the key.
         mX = x + mHorizontalGap / 2;
         mY = y;
diff --git a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java
index ff4e728..e6045dc 100644
--- a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java
@@ -260,9 +260,9 @@
         public MiniKeyboard build() {
             final MiniKeyboardParams params = mParams;
             for (int n = 0; n < mPopupCharacters.length; n++) {
-                final CharSequence label = mPopupCharacters[n];
+                final String popupSpec = mPopupCharacters[n].toString();
                 final int row = n / params.mNumColumns;
-                final Key key = new Key(mResources, params, label.toString(), params.getX(n, row),
+                final Key key = new Key(mResources, params, popupSpec, params.getX(n, row),
                         params.getY(row), params.mDefaultKeyWidth, params.mDefaultRowHeight,
                         params.getRowFlags(row));
                 params.onAddKey(key);