diff options
author | 2014-05-13 03:41:18 +0000 | |
---|---|---|
committer | 2014-05-13 03:41:18 +0000 | |
commit | 78deb93ec18d2c7e04d688d8e73af947de1699bf (patch) | |
tree | abd4d8e118931c84e7e86c4a1ab02c159d7779c8 /java/src | |
parent | f87811157c6d393944761f3faf8d294d5ba0d7d8 (diff) | |
parent | 9e39c603d3a723aa84cdcd3da9b8b1ffcbe9a43a (diff) | |
download | latinime-78deb93ec18d2c7e04d688d8e73af947de1699bf.tar.gz latinime-78deb93ec18d2c7e04d688d8e73af947de1699bf.tar.xz latinime-78deb93ec18d2c7e04d688d8e73af947de1699bf.zip |
am 9e39c603: Merge "Add isIconDefined predicate to Keyboard_Case attribute"
* commit '9e39c603d3a723aa84cdcd3da9b8b1ffcbe9a43a':
Add isIconDefined predicate to Keyboard_Case attribute
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java index dfe0df04c..2aeeed87f 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java @@ -664,6 +664,8 @@ public class KeyboardBuilder<KP extends KeyboardParams> { R.styleable.Keyboard_Case_isMultiLine, id.isMultiLine()); final boolean imeActionMatched = matchInteger(caseAttr, R.styleable.Keyboard_Case_imeAction, id.imeAction()); + final boolean isIconDefinedMatched = isIconDefined(caseAttr, + R.styleable.Keyboard_Case_isIconDefined, mParams.mIconsSet); final boolean localeCodeMatched = matchString(caseAttr, R.styleable.Keyboard_Case_localeCode, id.mLocale.toString()); final boolean languageCodeMatched = matchString(caseAttr, @@ -675,10 +677,11 @@ public class KeyboardBuilder<KP extends KeyboardParams> { && passwordInputMatched && clobberSettingsKeyMatched && supportsSwitchingToShortcutImeMatched && hasShortcutKeyMatched && languageSwitchKeyEnabledMatched && isMultiLineMatched && imeActionMatched - && localeCodeMatched && languageCodeMatched && countryCodeMatched; + && isIconDefinedMatched && localeCodeMatched && languageCodeMatched + && countryCodeMatched; if (DEBUG) { - startTag("<%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s>%s", TAG_CASE, + startTag("<%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s>%s", TAG_CASE, textAttr(caseAttr.getString( R.styleable.Keyboard_Case_keyboardLayoutSet), "keyboardLayoutSet"), textAttr(caseAttr.getString( @@ -704,6 +707,8 @@ public class KeyboardBuilder<KP extends KeyboardParams> { "languageSwitchKeyEnabled"), booleanAttr(caseAttr, R.styleable.Keyboard_Case_isMultiLine, "isMultiLine"), + textAttr(caseAttr.getString(R.styleable.Keyboard_Case_isIconDefined), + "isIconDefined"), textAttr(caseAttr.getString(R.styleable.Keyboard_Case_localeCode), "localeCode"), textAttr(caseAttr.getString(R.styleable.Keyboard_Case_languageCode), @@ -755,6 +760,16 @@ public class KeyboardBuilder<KP extends KeyboardParams> { return false; } + private static boolean isIconDefined(final TypedArray a, final int index, + final KeyboardIconsSet iconsSet) { + if (!a.hasValue(index)) { + return true; + } + final String iconName = a.getString(index); + final int iconId = KeyboardIconsSet.getIconId(iconName); + return iconsSet.getIconDrawable(iconId) != null; + } + private boolean parseDefault(final XmlPullParser parser, final KeyboardRow row, final boolean skip) throws XmlPullParserException, IOException { if (DEBUG) startTag("<%s>", TAG_DEFAULT); |