am 1c7e6f8d: Merge "Revert "Align hint label to bottom"" into lmp-dev

* commit '1c7e6f8d6ec82a09e2231ba822676fef56250f78':
  Revert "Align hint label to bottom"
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index bfe3856..8b3687a 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -292,7 +292,6 @@
         <!-- The key label flags. -->
         <attr name="keyLabelFlags" format="integer">
             <!-- This should be aligned with Key.LABEL_FLAGS__* -->
-            <flag name="alignHintLabelToBottom" value="0x02" />
             <flag name="alignIconToBottom" value="0x04" />
             <flag name="alignLabelOffCenter" value="0x08" />
             <flag name="fontNormal" value="0x10" />
diff --git a/java/res/values/themes-lxx.xml b/java/res/values/themes-lxx.xml
index 1c33cd6..f4e7933 100644
--- a/java/res/values/themes-lxx.xml
+++ b/java/res/values/themes-lxx.xml
@@ -26,10 +26,9 @@
     >
         <item name="keyTypeface">normal</item>
         <item name="keyLargeLetterRatio">@fraction/config_key_large_letter_ratio_lxx</item>
-        <item name="keyLabelOffCenterRatio">-80%</item>
+        <item name="keyLabelOffCenterRatio">-100%</item>
         <item name="keyHintLabelRatio">@fraction/config_key_hint_label_ratio_lxx</item>
-        <item name="keyHintLabelOffCenterRatio">300%</item>
-        <item name="keyLabelFlags">alignHintLabelToBottom</item>
+        <item name="keyHintLabelOffCenterRatio">400%</item>
         <item name="spacebarIconWidthRatio">0.9</item>
         <!-- No popup hint letter -->
         <item name="keyPopupHintLetter"></item>
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index 618d389..f8c0058 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -58,7 +58,6 @@
     private final String mHintLabel;
     /** Flags of the label */
     private final int mLabelFlags;
-    private static final int LABEL_FLAGS_ALIGN_HINT_LABEL_TO_BOTTOM = 0x02;
     private static final int LABEL_FLAGS_ALIGN_ICON_TO_BOTTOM = 0x04;
     private static final int LABEL_FLAGS_ALIGN_LABEL_OFF_CENTER = 0x08;
     // Font typeface specification.
@@ -642,10 +641,6 @@
         return Typeface.DEFAULT_BOLD;
     }
 
-    public final boolean isAlignHintLabelToBottom(final int defaultFlags) {
-        return ((mLabelFlags | defaultFlags) & LABEL_FLAGS_ALIGN_HINT_LABEL_TO_BOTTOM) != 0;
-    }
-
     public final boolean isAlignIconToBottom() {
         return (mLabelFlags & LABEL_FLAGS_ALIGN_ICON_TO_BOTTOM) != 0;
     }
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 075cd90..72b2547 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -48,7 +48,6 @@
  * @attr ref R.styleable#KeyboardView_functionalKeyBackground
  * @attr ref R.styleable#KeyboardView_spacebarBackground
  * @attr ref R.styleable#KeyboardView_spacebarIconWidthRatio
- * @attr ref R.styleable#Keyboard_Key_keyLabelFlags
  * @attr ref R.styleable#KeyboardView_keyHintLetterPadding
  * @attr ref R.styleable#KeyboardView_keyPopupHintLetter
  * @attr ref R.styleable#KeyboardView_keyPopupHintLetterPadding
@@ -63,8 +62,6 @@
  * @attr ref R.styleable#Keyboard_Key_keyHintLetterRatio
  * @attr ref R.styleable#Keyboard_Key_keyShiftedLetterHintRatio
  * @attr ref R.styleable#Keyboard_Key_keyHintLabelRatio
- * @attr ref R.styleable#Keyboard_Key_keyLabelOffCenterRatio
- * @attr ref R.styleable#Keyboard_Key_keyHintLabelOffCenterRatio
  * @attr ref R.styleable#Keyboard_Key_keyPreviewTextRatio
  * @attr ref R.styleable#Keyboard_Key_keyTextColor
  * @attr ref R.styleable#Keyboard_Key_keyTextColorDisabled
@@ -78,9 +75,6 @@
 public class KeyboardView extends View {
     // XML attributes
     private final KeyVisualAttributes mKeyVisualAttributes;
-    // Default keyLabelFlags from {@link KeyboardTheme}.
-    // Currently only "alignHintLabelToBottom" is supported.
-    private final int mDefaultKeyLabelFlags;
     private final float mKeyHintLetterPadding;
     private final String mKeyPopupHintLetter;
     private final float mKeyPopupHintLetterPadding;
@@ -152,7 +146,6 @@
 
         final TypedArray keyAttr = context.obtainStyledAttributes(attrs,
                 R.styleable.Keyboard_Key, defStyle, R.style.KeyboardView);
-        mDefaultKeyLabelFlags = keyAttr.getInt(R.styleable.Keyboard_Key_keyLabelFlags, 0);
         mKeyVisualAttributes = KeyVisualAttributes.newInstance(keyAttr);
         keyAttr.recycle();
 
@@ -364,8 +357,7 @@
 
         // Draw key label.
         final Drawable icon = key.getIcon(mKeyboard.mIconsSet, params.mAnimAlpha);
-        float labelX = centerX;
-        float labelBaseline = centerY;
+        float positionX = centerX;
         final String label = key.getLabel();
         if (label != null) {
             paint.setTypeface(key.selectTypeface(params));
@@ -374,15 +366,15 @@
             final float labelCharWidth = TypefaceUtils.getReferenceCharWidth(paint);
 
             // Vertical label text alignment.
-            labelBaseline = centerY + labelCharHeight / 2.0f;
+            final float baseline = centerY + labelCharHeight / 2.0f;
 
             // Horizontal label text alignment
             if (key.isAlignLabelOffCenter()) {
                 // The label is placed off center of the key. Used mainly on "phone number" layout.
-                labelX = centerX + params.mLabelOffCenterRatio * labelCharWidth;
+                positionX = centerX + params.mLabelOffCenterRatio * labelCharWidth;
                 paint.setTextAlign(Align.LEFT);
             } else {
-                labelX = centerX;
+                positionX = centerX;
                 paint.setTextAlign(Align.CENTER);
             }
             if (key.needsAutoXScale()) {
@@ -410,7 +402,7 @@
                 paint.clearShadowLayer();
             }
             blendAlpha(paint, params.mAnimAlpha);
-            canvas.drawText(label, 0, label.length(), labelX, labelBaseline, paint);
+            canvas.drawText(label, 0, label.length(), positionX, baseline, paint);
             // Turn off drop shadow and reset x-scale.
             paint.clearShadowLayer();
             paint.setTextScaleX(1.0f);
@@ -426,22 +418,19 @@
             blendAlpha(paint, params.mAnimAlpha);
             final float labelCharHeight = TypefaceUtils.getReferenceCharHeight(paint);
             final float labelCharWidth = TypefaceUtils.getReferenceCharWidth(paint);
-            final float hintX, hintBaseline;
+            final float adjustmentY = params.mHintLabelVerticalAdjustment * labelCharHeight;
+            final float hintX, hintY;
             if (key.hasHintLabel()) {
                 // The hint label is placed just right of the key label. Used mainly on
                 // "phone number" layout.
-                hintX = labelX + params.mHintLabelOffCenterRatio * labelCharWidth;
-                if (key.isAlignHintLabelToBottom(mDefaultKeyLabelFlags)) {
-                    hintBaseline = labelBaseline;
-                } else {
-                    hintBaseline = centerY + labelCharHeight / 2.0f;
-                }
+                hintX = positionX + params.mHintLabelOffCenterRatio * labelCharWidth;
+                hintY = centerY + labelCharHeight / 2.0f;
                 paint.setTextAlign(Align.LEFT);
             } else if (key.hasShiftedLetterHint()) {
                 // The hint label is placed at top-right corner of the key. Used mainly on tablet.
                 hintX = keyWidth - mKeyShiftedLetterHintPadding - labelCharWidth / 2.0f;
                 paint.getFontMetrics(mFontMetrics);
-                hintBaseline = -mFontMetrics.top;
+                hintY = -mFontMetrics.top;
                 paint.setTextAlign(Align.CENTER);
             } else { // key.hasHintLetter()
                 // The hint letter is placed at top-right corner of the key. Used mainly on phone.
@@ -449,12 +438,10 @@
                 final float hintLabelWidth = TypefaceUtils.getStringWidth(hintLabel, paint);
                 hintX = keyWidth - mKeyHintLetterPadding
                         - Math.max(hintDigitWidth, hintLabelWidth) / 2.0f;
-                hintBaseline = -paint.ascent();
+                hintY = -paint.ascent();
                 paint.setTextAlign(Align.CENTER);
             }
-            final float adjustmentY = params.mHintLabelVerticalAdjustment * labelCharHeight;
-            canvas.drawText(
-                    hintLabel, 0, hintLabel.length(), hintX, hintBaseline + adjustmentY, paint);
+            canvas.drawText(hintLabel, 0, hintLabel.length(), hintX, hintY + adjustmentY, paint);
         }
 
         // Draw key icon.