summaryrefslogtreecommitdiff
path: root/java/src/com/android/inputmethod/keyboard/Key.java
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2014-10-03 23:48:53 +0000
committerKen Wakasa <kwakasa@google.com>2014-10-03 23:48:53 +0000
commitfaefad5b0fd5b188d7eefa66dfaf33c47e181c03 (patch)
tree3e2be7dda60aa1863ca851c2944a2cde9b5b2a72 /java/src/com/android/inputmethod/keyboard/Key.java
parent15dbd38283fc9c8fdfd2540f1d94d4dbf2eabcb5 (diff)
Revert "[ML14] Forward the locale list to relevant places"
This reverts commit 15dbd38283fc9c8fdfd2540f1d94d4dbf2eabcb5. Bug: 11230254 Reverting due to unit test breakage. Change-Id: Icf29ba5c808c754515aef2d1b4162d72f606acfe
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/Key.java')
-rw-r--r--java/src/com/android/inputmethod/keyboard/Key.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index 45ce6a85f..bf29b5ffe 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -278,8 +278,8 @@ public class Key implements Comparable<Key> {
mLabelFlags = style.getFlags(keyAttr, R.styleable.Keyboard_Key_keyLabelFlags)
| row.getDefaultKeyLabelFlags();
- final boolean needsToUpcase = needsToUpcase(mLabelFlags, params.mId.mElementId);
- final Locale localeForUpcasing = params.mId.getLocales()[0];
+ final boolean needsToUpperCase = needsToUpperCase(mLabelFlags, params.mId.mElementId);
+ final Locale locale = params.mId.mLocale;
int actionFlags = style.getFlags(keyAttr, R.styleable.Keyboard_Key_keyActionFlags);
String[] moreKeys = style.getStringArray(keyAttr, R.styleable.Keyboard_Key_moreKeys);
@@ -321,7 +321,7 @@ public class Key implements Comparable<Key> {
actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS;
mMoreKeys = new MoreKeySpec[moreKeys.length];
for (int i = 0; i < moreKeys.length; i++) {
- mMoreKeys[i] = new MoreKeySpec(moreKeys[i], needsToUpcase, localeForUpcasing);
+ mMoreKeys[i] = new MoreKeySpec(moreKeys[i], needsToUpperCase, locale);
}
} else {
mMoreKeys = null;
@@ -342,16 +342,16 @@ public class Key implements Comparable<Key> {
mLabel = new StringBuilder().appendCodePoint(code).toString();
} else {
mLabel = StringUtils.toUpperCaseOfStringForLocale(
- KeySpecParser.getLabel(keySpec), needsToUpcase, localeForUpcasing);
+ KeySpecParser.getLabel(keySpec), needsToUpperCase, locale);
}
if ((mLabelFlags & LABEL_FLAGS_DISABLE_HINT_LABEL) != 0) {
mHintLabel = null;
} else {
mHintLabel = StringUtils.toUpperCaseOfStringForLocale(style.getString(keyAttr,
- R.styleable.Keyboard_Key_keyHintLabel), needsToUpcase, localeForUpcasing);
+ R.styleable.Keyboard_Key_keyHintLabel), needsToUpperCase, locale);
}
String outputText = StringUtils.toUpperCaseOfStringForLocale(
- KeySpecParser.getOutputText(keySpec), needsToUpcase, localeForUpcasing);
+ KeySpecParser.getOutputText(keySpec), needsToUpperCase, locale);
// Choose the first letter of the label as primary code if not specified.
if (code == CODE_UNSPECIFIED && TextUtils.isEmpty(outputText)
&& !TextUtils.isEmpty(mLabel)) {
@@ -377,12 +377,12 @@ public class Key implements Comparable<Key> {
mCode = CODE_OUTPUT_TEXT;
}
} else {
- mCode = StringUtils.toUpperCaseOfCodeForLocale(code, needsToUpcase, localeForUpcasing);
+ mCode = StringUtils.toUpperCaseOfCodeForLocale(code, needsToUpperCase, locale);
}
final int altCodeInAttr = KeySpecParser.parseCode(
style.getString(keyAttr, R.styleable.Keyboard_Key_altCode), CODE_UNSPECIFIED);
final int altCode = StringUtils.toUpperCaseOfCodeForLocale(
- altCodeInAttr, needsToUpcase, localeForUpcasing);
+ altCodeInAttr, needsToUpperCase, locale);
mOptionalAttributes = OptionalAttributes.newInstance(outputText, altCode,
disabledIconId, visualInsetsLeft, visualInsetsRight);
mKeyVisualAttributes = KeyVisualAttributes.newInstance(keyAttr);
@@ -432,7 +432,7 @@ public class Key implements Comparable<Key> {
return (filteredMoreKeys == moreKeys) ? key : new Key(key, filteredMoreKeys);
}
- private static boolean needsToUpcase(final int labelFlags, final int keyboardElementId) {
+ private static boolean needsToUpperCase(final int labelFlags, final int keyboardElementId) {
if ((labelFlags & LABEL_FLAGS_PRESERVE_CASE) != 0) return false;
switch (keyboardElementId) {
case KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED: