diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/KeyboardView.java | 5 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/LatinKeyboard.java | 18 |
2 files changed, 21 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 70267a7ff..4a3a58b94 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -174,7 +174,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { // This map caches key label text height in pixel as value and key label text size as map key. private final HashMap<Integer, Integer> mTextHeightCache = new HashMap<Integer, Integer>(); // Distance from horizontal center of the key, proportional to key label text height and width. - private final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR_CENTER = 0.55f; + private final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR_CENTER = 0.45f; private final float KEY_LABEL_VERTICAL_PADDING_FACTOR = 1.60f; private final String KEY_LABEL_REFERENCE_CHAR = "H"; private final int KEY_LABEL_OPTION_ALIGN_LEFT = 1; @@ -727,6 +727,9 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { final float centerY = (key.mHeight + padding.top - padding.bottom) / 2; baseline = centerY + labelCharHeight * KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR_CENTER; + if (DEBUG_SHOW_ALIGN) + drawHorizontalLine(canvas, (int)baseline, key.mWidth, 0xc0008000, + new Paint()); } // Horizontal label text alignment final int positionX; diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java index 0a42857ff..7cae4f1df 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java @@ -75,6 +75,9 @@ public class LatinKeyboard extends Keyboard { private static int sSpacebarVerticalCorrection; + private static final String SMALL_TEXT_SIZE_OF_LANGUAGE_ON_SPACEBAR = "small"; + private static final String MEDIUM_TEXT_SIZE_OF_LANGUAGE_ON_SPACEBAR = "medium"; + public LatinKeyboard(Context context, KeyboardId id) { super(context, id); final Resources res = context.getResources(); @@ -189,10 +192,23 @@ public class LatinKeyboard extends Keyboard { paint.setAntiAlias(true); paint.setTextAlign(Align.CENTER); + final String textSizeOfLanguageOnSpacebar = res.getString( + R.string.config_text_size_of_language_on_spacebar, + SMALL_TEXT_SIZE_OF_LANGUAGE_ON_SPACEBAR); + final int textStyle; + final int defaultTextSize; + if (MEDIUM_TEXT_SIZE_OF_LANGUAGE_ON_SPACEBAR.equals(textSizeOfLanguageOnSpacebar)) { + textStyle = android.R.style.TextAppearance_Medium; + defaultTextSize = 18; + } else { + textStyle = android.R.style.TextAppearance_Small; + defaultTextSize = 14; + } + final boolean allowVariableTextSize = true; final String language = layoutSpaceBar(paint, subtypeSwitcher.getInputLocale(), mButtonArrowLeftIcon, mButtonArrowRightIcon, width, height, - getTextSizeFromTheme(android.R.style.TextAppearance_Small, 14), + getTextSizeFromTheme(textStyle, defaultTextSize), allowVariableTextSize); // Draw language text with shadow |