diff options
author | 2013-08-07 03:02:46 -0700 | |
---|---|---|
committer | 2013-08-07 03:02:46 -0700 | |
commit | 3cbcdd3a1420686d88d69661c7188eacd31c2e9f (patch) | |
tree | afcd46008bfeb81c817e71f8240fc24c8b1a16c5 /java/src | |
parent | 3c6d5041bc1c8b14da9de916e2f99f04581c7b98 (diff) | |
parent | 2cb9a1434ea1d22a37f1396b20670c4b0589c120 (diff) | |
download | latinime-3cbcdd3a1420686d88d69661c7188eacd31c2e9f.tar.gz latinime-3cbcdd3a1420686d88d69661c7188eacd31c2e9f.tar.xz latinime-3cbcdd3a1420686d88d69661c7188eacd31c2e9f.zip |
am 2cb9a143: Merge "Make key label from supplementary code point"
* commit '2cb9a1434ea1d22a37f1396b20670c4b0589c120':
Make key label from supplementary code point
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/Key.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index 09f1145e9..61805286d 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -306,8 +306,15 @@ public class Key implements Comparable<Key> { } mActionFlags = actionFlags; + final int code = KeySpecParser.parseCode(style.getString(keyAttr, + R.styleable.Keyboard_Key_code), params.mCodesSet, CODE_UNSPECIFIED); if ((mLabelFlags & LABEL_FLAGS_FROM_CUSTOM_ACTION_LABEL) != 0) { mLabel = params.mId.mCustomActionLabel; + } else if (code >= Character.MIN_SUPPLEMENTARY_CODE_POINT) { + // This is a workaround to have a key that has a supplementary code point in its label. + // Because we can put a string in resource neither as a XML entity of a supplementary + // code point nor as a surrogate pair. + mLabel = new StringBuilder().appendCodePoint(code).toString(); } else { mLabel = KeySpecParser.toUpperCaseOfStringForLocale(style.getString(keyAttr, R.styleable.Keyboard_Key_keyLabel), needsToUpperCase, locale); @@ -320,8 +327,6 @@ public class Key implements Comparable<Key> { } String outputText = KeySpecParser.toUpperCaseOfStringForLocale(style.getString(keyAttr, R.styleable.Keyboard_Key_keyOutputText), needsToUpperCase, locale); - final int code = KeySpecParser.parseCode(style.getString(keyAttr, - R.styleable.Keyboard_Key_code), params.mCodesSet, CODE_UNSPECIFIED); // Choose the first letter of the label as primary code if not specified. if (code == CODE_UNSPECIFIED && TextUtils.isEmpty(outputText) && !TextUtils.isEmpty(mLabel)) { |