diff options
author | 2014-07-07 16:54:00 +0900 | |
---|---|---|
committer | 2014-07-07 16:57:11 +0900 | |
commit | 649de3f544d8e320ab812e829f637cd5f78b3d55 (patch) | |
tree | 28acc64d34a91f400f3622f82c1cb07ac2d96351 | |
parent | 59016206abe0e457ef8dd44b84d4aeac67824a07 (diff) | |
download | latinime-649de3f544d8e320ab812e829f637cd5f78b3d55.tar.gz latinime-649de3f544d8e320ab812e829f637cd5f78b3d55.tar.xz latinime-649de3f544d8e320ab812e829f637cd5f78b3d55.zip |
Fix Sinhala keyboard for tablet device
This CL introduces fontDefault flag to keyLabelFlags of Key attribute
to reset font specification to keyTypeface attribute.
This is a followup of I065824f3fa.
Bug: 6911143
Change-Id: I33bd4a23aaea73e2b17175ddd39053ec915d5451
-rw-r--r-- | java/res/values/attrs.xml | 1 | ||||
-rw-r--r-- | java/res/xml-sw600dp/keys_exclamation_question.xml | 6 | ||||
-rw-r--r-- | java/res/xml-sw600dp/rows_sinhala.xml | 3 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/Key.java | 15 |
4 files changed, 18 insertions, 7 deletions
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 3206413ca..396c166ab 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -298,6 +298,7 @@ <flag name="alignLeftOfCenter" value="0x08" /> <flag name="fontNormal" value="0x10" /> <flag name="fontMonoSpace" value="0x20" /> + <flag name="fontDefault" value="0x30" /> <flag name="followKeyLargeLetterRatio" value="0x40" /> <flag name="followKeyLetterRatio" value="0x80" /> <flag name="followKeyLabelRatio" value="0xC0" /> diff --git a/java/res/xml-sw600dp/keys_exclamation_question.xml b/java/res/xml-sw600dp/keys_exclamation_question.xml index 97bd95d6a..cf2c61ead 100644 --- a/java/res/xml-sw600dp/keys_exclamation_question.xml +++ b/java/res/xml-sw600dp/keys_exclamation_question.xml @@ -23,8 +23,10 @@ > <Key latin:keySpec="!" - latin:moreKeys="!text/morekeys_exclamation" /> + latin:moreKeys="!text/morekeys_exclamation" + latin:keyLabelFlags="fontDefault" /> <Key latin:keySpec="\?" - latin:moreKeys="!text/morekeys_question" /> + latin:moreKeys="!text/morekeys_question" + latin:keyLabelFlags="fontDefault" /> </merge> diff --git a/java/res/xml-sw600dp/rows_sinhala.xml b/java/res/xml-sw600dp/rows_sinhala.xml index 23c3f3aab..d3a5ca535 100644 --- a/java/res/xml-sw600dp/rows_sinhala.xml +++ b/java/res/xml-sw600dp/rows_sinhala.xml @@ -25,6 +25,7 @@ latin:keyboardLayout="@xml/key_styles_common" /> <Row latin:keyWidth="8.182%p" + latin:keyLabelFlags="fontNormal|autoXScale" > <include latin:keyboardLayout="@xml/rowkeys_sinhala1" /> @@ -34,6 +35,7 @@ </Row> <Row latin:keyWidth="8.182%p" + latin:keyLabelFlags="fontNormal|autoXScale" > <include latin:keyboardLayout="@xml/rowkeys_sinhala2" /> @@ -43,6 +45,7 @@ </Row> <Row latin:keyWidth="8.182%p" + latin:keyLabelFlags="fontNormal|autoXScale" > <Key latin:keyStyle="shiftKeyStyle" diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index 88cde1111..ed3b2b347 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -62,8 +62,11 @@ public class Key implements Comparable<Key> { private static final int LABEL_FLAGS_ALIGN_RIGHT = 0x02; private static final int LABEL_FLAGS_ALIGN_BUTTOM = 0x04; private static final int LABEL_FLAGS_ALIGN_LEFT_OF_CENTER = 0x08; + // Font typeface specification. + private static final int LABEL_FLAGS_FONT_MASK = 0x30; 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_FONT_DEFAULT = 0x30; // 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; @@ -567,14 +570,16 @@ public class Key implements Comparable<Key> { } public final Typeface selectTypeface(final KeyDrawParams params) { - // TODO: Handle "bold" here too? - if ((mLabelFlags & LABEL_FLAGS_FONT_NORMAL) != 0) { + switch (mLabelFlags & LABEL_FLAGS_FONT_MASK) { + case LABEL_FLAGS_FONT_NORMAL: return Typeface.DEFAULT; - } - if ((mLabelFlags & LABEL_FLAGS_FONT_MONO_SPACE) != 0) { + case LABEL_FLAGS_FONT_MONO_SPACE: return Typeface.MONOSPACE; + case LABEL_FLAGS_FONT_DEFAULT: + default: + // The type-face is specified by keyTypeface attribute. + return params.mTypeface; } - return params.mTypeface; } public final int selectTextSize(final KeyDrawParams params) { |