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