diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index 7cad3f507..a18371fc9 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -55,6 +55,8 @@
+
+
@@ -275,7 +277,8 @@
-
+
+
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index c3f5e7da2..6ad791b33 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -66,11 +66,14 @@ public class Key {
private static final int LABEL_FLAGS_ALIGN_LEFT_OF_CENTER = 0x08;
private static final int LABEL_FLAGS_FONT_NORMAL = 0x10;
private static final int LABEL_FLAGS_FONT_MONO_SPACE = 0x20;
- private static final int LABEL_FLAGS_FOLLOW_KEY_RATIO_MASK = 0x1C0;
+ // Start of key text ratio enum values
+ private static final int LABEL_FLAGS_FOLLOW_KEY_TEXT_RATIO_MASK = 0x1C0;
private static final int LABEL_FLAGS_FOLLOW_KEY_LARGE_LETTER_RATIO = 0x40;
private static final int LABEL_FLAGS_FOLLOW_KEY_LETTER_RATIO = 0x80;
private static final int LABEL_FLAGS_FOLLOW_KEY_LABEL_RATIO = 0xC0;
- private static final int LABEL_FLAGS_FOLLOW_KEY_HINT_LABEL_RATIO = 0x100;
+ private static final int LABEL_FLAGS_FOLLOW_KEY_LARGE_LABEL_RATIO = 0x100;
+ private static final int LABEL_FLAGS_FOLLOW_KEY_HINT_LABEL_RATIO = 0x140;
+ // End of key text ratio mask enum values
private static final int LABEL_FLAGS_HAS_POPUP_HINT = 0x200;
private static final int LABEL_FLAGS_HAS_SHIFTED_LETTER_HINT = 0x400;
private static final int LABEL_FLAGS_HAS_HINT_LABEL = 0x800;
@@ -490,18 +493,21 @@ public class Key {
}
}
- public int selectTextSize(int letter, int largeLetter, int label, int hintLabel) {
- switch (mLabelFlags & LABEL_FLAGS_FOLLOW_KEY_RATIO_MASK) {
+ public int selectTextSize(KeyboardView.KeyDrawParams params) {
+ switch (mLabelFlags & LABEL_FLAGS_FOLLOW_KEY_TEXT_RATIO_MASK) {
case LABEL_FLAGS_FOLLOW_KEY_LARGE_LETTER_RATIO:
- return largeLetter;
+ return params.mKeyLargeLetterSize;
case LABEL_FLAGS_FOLLOW_KEY_LETTER_RATIO:
- return letter;
+ return params.mKeyLetterSize;
case LABEL_FLAGS_FOLLOW_KEY_LABEL_RATIO:
- return label;
+ return params.mKeyLabelSize;
+ case LABEL_FLAGS_FOLLOW_KEY_LARGE_LABEL_RATIO:
+ return params.mKeyLargeLabelSize;
case LABEL_FLAGS_FOLLOW_KEY_HINT_LABEL_RATIO:
- return hintLabel;
+ return params.mKeyHintLabelSize;
default: // No follow key ratio flag specified.
- return StringUtils.codePointCount(mLabel) == 1 ? letter : label;
+ return StringUtils.codePointCount(mLabel) == 1
+ ? params.mKeyLetterSize : params.mKeyLabelSize;
}
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index cc0a1fb10..80e1c7a4a 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -191,6 +191,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
/* package */ final float mKeyLetterRatio;
private final float mKeyLargeLetterRatio;
private final float mKeyLabelRatio;
+ private final float mKeyLargeLabelRatio;
private final float mKeyHintLetterRatio;
private final float mKeyShiftedLetterHintRatio;
private final float mKeyHintLabelRatio;
@@ -200,6 +201,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
public int mKeyLetterSize;
public int mKeyLargeLetterSize;
public int mKeyLabelSize;
+ public int mKeyLargeLabelSize;
public int mKeyHintLetterSize;
public int mKeyShiftedLetterHintSize;
public int mKeyHintLabelSize;
@@ -219,6 +221,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
} else {
mKeyLabelRatio = getRatio(a, R.styleable.KeyboardView_keyLabelRatio);
}
+ mKeyLargeLabelRatio = getRatio(a, R.styleable.KeyboardView_keyLargeLabelRatio);
mKeyLargeLetterRatio = getRatio(a, R.styleable.KeyboardView_keyLargeLetterRatio);
mKeyHintLetterRatio = getRatio(a, R.styleable.KeyboardView_keyHintLetterRatio);
mKeyShiftedLetterHintRatio = getRatio(a,
@@ -254,6 +257,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
mKeyLetterSize = (int)(keyHeight * mKeyLetterRatio);
if (mKeyLabelRatio >= 0.0f)
mKeyLabelSize = (int)(keyHeight * mKeyLabelRatio);
+ mKeyLargeLabelSize = (int)(keyHeight * mKeyLargeLabelRatio);
mKeyLargeLetterSize = (int)(keyHeight * mKeyLargeLetterRatio);
mKeyHintLetterSize = (int)(keyHeight * mKeyHintLetterRatio);
mKeyShiftedLetterHintSize = (int)(keyHeight * mKeyShiftedLetterHintRatio);
@@ -569,8 +573,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
final String label = key.mLabel;
// For characters, use large font. For labels like "Done", use smaller font.
paint.setTypeface(key.selectTypeface(params.mKeyTextStyle));
- final int labelSize = key.selectTextSize(params.mKeyLetterSize,
- params.mKeyLargeLetterSize, params.mKeyLabelSize, params.mKeyHintLabelSize);
+ final int labelSize = key.selectTextSize(params);
paint.setTextSize(labelSize);
final float labelCharHeight = getCharHeight(KEY_LABEL_REFERENCE_CHAR, paint);
final float labelCharWidth = getCharWidth(KEY_LABEL_REFERENCE_CHAR, paint);