Loading java/res/values/attrs.xml +9 −1 Original line number Diff line number Diff line Loading @@ -293,7 +293,7 @@ <attr name="keyLabelFlags" format="integer"> <!-- This should be aligned with Key.LABEL_FLAGS__* --> <flag name="alignIconToBottom" value="0x04" /> <flag name="alignLeftOfCenter" value="0x08" /> <flag name="alignLabelOffCenter" value="0x08" /> <flag name="fontNormal" value="0x10" /> <flag name="fontMonoSpace" value="0x20" /> <flag name="fontDefault" value="0x30" /> Loading Loading @@ -368,6 +368,14 @@ <attr name="keyHintLabelRatio" format="fraction" /> <!-- Size of the text for shifted letter hint, in the proportion of key height. --> <attr name="keyShiftedLetterHintRatio" format="fraction" /> <!-- The label's horizontal offset to the center of the key. Negative is to left and positive is to right. The value is in proportion of the width of TypefaceUtils.KEY_LABEL_REFERENCE_CHAR. --> <attr name="keyLabelOffCenterRatio" format="fraction" /> <!-- The hint label's horizontal offset to the center of the key. Negative is to left and positive is to right. The value is in proportion of the width of TypefaceUtils.KEY_LABEL_REFERENCE_CHAR. --> <attr name="keyHintLabelOffCenterRatio" format="fraction" /> <!-- Color to use for the label in a key. --> <attr name="keyTextColor" format="color" /> <attr name="keyTextShadowColor" format="color" /> Loading java/res/values/themes-common.xml +2 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,8 @@ <item name="keyHintLetterRatio">@fraction/config_key_hint_letter_ratio</item> <item name="keyHintLabelRatio">@fraction/config_key_hint_label_ratio</item> <item name="keyShiftedLetterHintRatio">@fraction/config_key_shifted_letter_hint_ratio</item> <item name="keyLabelOffCenterRatio">-175%</item> <item name="keyHintLabelOffCenterRatio">200%</item> <item name="keyTypeface">normal</item> <!-- A negative value to disable key text shadow layer. --> <item name="keyTextShadowRadius">-1.0</item> Loading java/res/xml/key_styles_number.xml +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ latin:parentStyle="numKeyBaseStyle" /> <key-style latin:styleName="numberKeyStyle" latin:keyLabelFlags="alignLeftOfCenter|hasHintLabel" latin:keyLabelFlags="alignLabelOffCenter|hasHintLabel" latin:parentStyle="numKeyStyle" /> <key-style latin:styleName="num0KeyStyle" Loading java/src/com/android/inputmethod/keyboard/Key.java +3 −3 Original line number Diff line number Diff line Loading @@ -59,7 +59,7 @@ public class Key implements Comparable<Key> { /** Flags of the label */ private final int mLabelFlags; private static final int LABEL_FLAGS_ALIGN_ICON_TO_BOTTOM = 0x04; private static final int LABEL_FLAGS_ALIGN_LEFT_OF_CENTER = 0x08; private static final int LABEL_FLAGS_ALIGN_LABEL_OFF_CENTER = 0x08; // Font typeface specification. private static final int LABEL_FLAGS_FONT_MASK = 0x30; private static final int LABEL_FLAGS_FONT_NORMAL = 0x10; Loading Loading @@ -648,8 +648,8 @@ public class Key implements Comparable<Key> { return (mLabelFlags & LABEL_FLAGS_ALIGN_ICON_TO_BOTTOM) != 0; } public final boolean isAlignLeftOfCenter() { return (mLabelFlags & LABEL_FLAGS_ALIGN_LEFT_OF_CENTER) != 0; public final boolean isAlignLabelOffCenter() { return (mLabelFlags & LABEL_FLAGS_ALIGN_LABEL_OFF_CENTER) != 0; } public final boolean hasPopupHint() { Loading java/src/com/android/inputmethod/keyboard/KeyboardView.java +5 −8 Original line number Diff line number Diff line Loading @@ -369,9 +369,9 @@ public class KeyboardView extends View { final float baseline = centerY + labelCharHeight / 2.0f; // Horizontal label text alignment if (key.isAlignLeftOfCenter()) { // TODO: Parameterise this? positionX = centerX - labelCharWidth * 7.0f / 4.0f; if (key.isAlignLabelOffCenter()) { // The label is placed off center of the key. Used mainly on "phone number" layout. positionX = centerX + params.mLabelOffCenterRatio * labelCharWidth; paint.setTextAlign(Align.LEFT); } else { positionX = centerX; Loading Loading @@ -418,15 +418,12 @@ public class KeyboardView extends View { blendAlpha(paint, params.mAnimAlpha); final float labelCharHeight = TypefaceUtils.getReferenceCharHeight(paint); final float labelCharWidth = TypefaceUtils.getReferenceCharWidth(paint); final KeyVisualAttributes visualAttr = key.getVisualAttributes(); final float adjustmentY = (visualAttr == null) ? 0.0f : visualAttr.mHintLabelVerticalAdjustment * labelCharHeight; 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. // TODO: Generalize the following calculations. hintX = positionX + labelCharWidth * 2.0f; hintX = positionX + params.mHintLabelOffCenterRatio * labelCharWidth; hintY = centerY + labelCharHeight / 2.0f; paint.setTextAlign(Align.LEFT); } else if (key.hasShiftedLetterHint()) { Loading Loading
java/res/values/attrs.xml +9 −1 Original line number Diff line number Diff line Loading @@ -293,7 +293,7 @@ <attr name="keyLabelFlags" format="integer"> <!-- This should be aligned with Key.LABEL_FLAGS__* --> <flag name="alignIconToBottom" value="0x04" /> <flag name="alignLeftOfCenter" value="0x08" /> <flag name="alignLabelOffCenter" value="0x08" /> <flag name="fontNormal" value="0x10" /> <flag name="fontMonoSpace" value="0x20" /> <flag name="fontDefault" value="0x30" /> Loading Loading @@ -368,6 +368,14 @@ <attr name="keyHintLabelRatio" format="fraction" /> <!-- Size of the text for shifted letter hint, in the proportion of key height. --> <attr name="keyShiftedLetterHintRatio" format="fraction" /> <!-- The label's horizontal offset to the center of the key. Negative is to left and positive is to right. The value is in proportion of the width of TypefaceUtils.KEY_LABEL_REFERENCE_CHAR. --> <attr name="keyLabelOffCenterRatio" format="fraction" /> <!-- The hint label's horizontal offset to the center of the key. Negative is to left and positive is to right. The value is in proportion of the width of TypefaceUtils.KEY_LABEL_REFERENCE_CHAR. --> <attr name="keyHintLabelOffCenterRatio" format="fraction" /> <!-- Color to use for the label in a key. --> <attr name="keyTextColor" format="color" /> <attr name="keyTextShadowColor" format="color" /> Loading
java/res/values/themes-common.xml +2 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,8 @@ <item name="keyHintLetterRatio">@fraction/config_key_hint_letter_ratio</item> <item name="keyHintLabelRatio">@fraction/config_key_hint_label_ratio</item> <item name="keyShiftedLetterHintRatio">@fraction/config_key_shifted_letter_hint_ratio</item> <item name="keyLabelOffCenterRatio">-175%</item> <item name="keyHintLabelOffCenterRatio">200%</item> <item name="keyTypeface">normal</item> <!-- A negative value to disable key text shadow layer. --> <item name="keyTextShadowRadius">-1.0</item> Loading
java/res/xml/key_styles_number.xml +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ latin:parentStyle="numKeyBaseStyle" /> <key-style latin:styleName="numberKeyStyle" latin:keyLabelFlags="alignLeftOfCenter|hasHintLabel" latin:keyLabelFlags="alignLabelOffCenter|hasHintLabel" latin:parentStyle="numKeyStyle" /> <key-style latin:styleName="num0KeyStyle" Loading
java/src/com/android/inputmethod/keyboard/Key.java +3 −3 Original line number Diff line number Diff line Loading @@ -59,7 +59,7 @@ public class Key implements Comparable<Key> { /** Flags of the label */ private final int mLabelFlags; private static final int LABEL_FLAGS_ALIGN_ICON_TO_BOTTOM = 0x04; private static final int LABEL_FLAGS_ALIGN_LEFT_OF_CENTER = 0x08; private static final int LABEL_FLAGS_ALIGN_LABEL_OFF_CENTER = 0x08; // Font typeface specification. private static final int LABEL_FLAGS_FONT_MASK = 0x30; private static final int LABEL_FLAGS_FONT_NORMAL = 0x10; Loading Loading @@ -648,8 +648,8 @@ public class Key implements Comparable<Key> { return (mLabelFlags & LABEL_FLAGS_ALIGN_ICON_TO_BOTTOM) != 0; } public final boolean isAlignLeftOfCenter() { return (mLabelFlags & LABEL_FLAGS_ALIGN_LEFT_OF_CENTER) != 0; public final boolean isAlignLabelOffCenter() { return (mLabelFlags & LABEL_FLAGS_ALIGN_LABEL_OFF_CENTER) != 0; } public final boolean hasPopupHint() { Loading
java/src/com/android/inputmethod/keyboard/KeyboardView.java +5 −8 Original line number Diff line number Diff line Loading @@ -369,9 +369,9 @@ public class KeyboardView extends View { final float baseline = centerY + labelCharHeight / 2.0f; // Horizontal label text alignment if (key.isAlignLeftOfCenter()) { // TODO: Parameterise this? positionX = centerX - labelCharWidth * 7.0f / 4.0f; if (key.isAlignLabelOffCenter()) { // The label is placed off center of the key. Used mainly on "phone number" layout. positionX = centerX + params.mLabelOffCenterRatio * labelCharWidth; paint.setTextAlign(Align.LEFT); } else { positionX = centerX; Loading Loading @@ -418,15 +418,12 @@ public class KeyboardView extends View { blendAlpha(paint, params.mAnimAlpha); final float labelCharHeight = TypefaceUtils.getReferenceCharHeight(paint); final float labelCharWidth = TypefaceUtils.getReferenceCharWidth(paint); final KeyVisualAttributes visualAttr = key.getVisualAttributes(); final float adjustmentY = (visualAttr == null) ? 0.0f : visualAttr.mHintLabelVerticalAdjustment * labelCharHeight; 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. // TODO: Generalize the following calculations. hintX = positionX + labelCharWidth * 2.0f; hintX = positionX + params.mHintLabelOffCenterRatio * labelCharWidth; hintY = centerY + labelCharHeight / 2.0f; paint.setTextAlign(Align.LEFT); } else if (key.hasShiftedLetterHint()) { Loading