diff options
author | 2011-02-18 15:33:44 +0900 | |
---|---|---|
committer | 2011-02-18 17:04:04 +0900 | |
commit | ea6c2e3350f21d1fc9e9866dbe13d74713d548a9 (patch) | |
tree | 0a2c1cfe9b700994fbf240685ecce6dad7fe6e59 /java/src | |
parent | d9c52ba62317aa7919483ccd157182ae0f0db7f4 (diff) | |
download | latinime-ea6c2e3350f21d1fc9e9866dbe13d74713d548a9.tar.gz latinime-ea6c2e3350f21d1fc9e9866dbe13d74713d548a9.tar.xz latinime-ea6c2e3350f21d1fc9e9866dbe13d74713d548a9.zip |
Add "languageCode" attribute to "case" tag in Keyboard XML
bug: 3451586
Change-Id: I08ca80e48648ba18543e9b8ca7362c06bb61a826
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/KeyboardParser.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardParser.java b/java/src/com/android/inputmethod/keyboard/KeyboardParser.java index 1aec686e0..70f16c21b 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardParser.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardParser.java @@ -433,10 +433,13 @@ public class KeyboardParser { // this attribute with id.mImeOptions as integer value is enough for our purpose. final boolean imeActionMatched = matchInteger(a, R.styleable.Keyboard_Case_imeAction, id.mImeAction); + final boolean languageCodeMatched = matchString(a, + R.styleable.Keyboard_Case_languageCode, id.mLocale.getLanguage()); final boolean selected = modeMatched && settingsKeyMatched && voiceEnabledMatched - && voiceKeyMatched && colorSchemeMatched && imeActionMatched; + && voiceKeyMatched && colorSchemeMatched && imeActionMatched + && languageCodeMatched; - if (DEBUG) Log.d(TAG, String.format("<%s%s%s%s%s%s%s> %s", TAG_CASE, + if (DEBUG) Log.d(TAG, String.format("<%s%s%s%s%s%s%s%s> %s", TAG_CASE, textAttr(KeyboardId.modeName( a.getInt(R.styleable.Keyboard_Case_mode, -1)), "mode"), textAttr(KeyboardId.colorSchemeName( @@ -446,6 +449,7 @@ public class KeyboardParser { booleanAttr(a, R.styleable.Keyboard_Case_hasVoiceKey, "hasVoiceKey"), textAttr(KeyboardId.imeOptionsName( a.getInt(R.styleable.Keyboard_Case_imeAction, -1)), "imeAction"), + textAttr(a.getString(R.styleable.Keyboard_Case_languageCode), "languageCode"), Boolean.toString(selected))); return selected; @@ -467,6 +471,12 @@ public class KeyboardParser { return !a.hasValue(index) || a.getBoolean(index, false) == value; } + private static boolean matchString(TypedArray a, int index, String value) { + // If <case> does not have "index" attribute, that means this <case> is wild-card for the + // attribute. + return !a.hasValue(index) || a.getString(index).equals(value); + } + private boolean parseDefault(XmlResourceParser parser, Row row, List<Key> keys) throws XmlPullParserException, IOException { if (DEBUG) Log.d(TAG, String.format("<%s>", TAG_DEFAULT)); |