Add keyboardLayoutSet attribute to <case> condition

Change-Id: I017c4a3c1c7b2e4c6f607940078f61e120042270
This commit is contained in:
Tadashi G. Takaoka 2013-08-29 09:50:45 +09:00
parent ade725ed01
commit 41745c4995
2 changed files with 14 additions and 7 deletions

View file

@ -379,6 +379,7 @@
</declare-styleable>
<declare-styleable name="Keyboard_Case">
<attr name="keyboardLayoutSet" format="string" />
<!-- This should be aligned with KeyboardLayoutSet_Element's elementName. -->
<attr name="keyboardLayoutSetElement" format="enum|string">
<enum name="alphabet" value="0" />

View file

@ -625,6 +625,9 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
final AttributeSet attr = Xml.asAttributeSet(parser);
final TypedArray caseAttr = mResources.obtainAttributes(attr, R.styleable.Keyboard_Case);
try {
final boolean keyboardLayoutSetMatched = matchString(caseAttr,
R.styleable.Keyboard_Case_keyboardLayoutSet,
SubtypeLocaleUtils.getKeyboardLayoutSetName(id.mSubtype));
final boolean keyboardLayoutSetElementMatched = matchTypedValue(caseAttr,
R.styleable.Keyboard_Case_keyboardLayoutSetElement, id.mElementId,
KeyboardId.elementIdToName(id.mElementId));
@ -657,15 +660,18 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
R.styleable.Keyboard_Case_languageCode, id.mLocale.getLanguage());
final boolean countryCodeMatched = matchString(caseAttr,
R.styleable.Keyboard_Case_countryCode, id.mLocale.getCountry());
final boolean selected = keyboardLayoutSetElementMatched && modeMatched
&& navigateNextMatched && navigatePreviousMatched && passwordInputMatched
&& clobberSettingsKeyMatched && shortcutKeyEnabledMatched
&& shortcutKeyOnSymbolsMatched && hasShortcutKeyMatched
&& languageSwitchKeyEnabledMatched && isMultiLineMatched && imeActionMatched
&& localeCodeMatched && languageCodeMatched && countryCodeMatched;
final boolean selected = keyboardLayoutSetMatched && keyboardLayoutSetElementMatched
&& modeMatched && navigateNextMatched && navigatePreviousMatched
&& passwordInputMatched && clobberSettingsKeyMatched
&& shortcutKeyEnabledMatched && shortcutKeyOnSymbolsMatched
&& hasShortcutKeyMatched && languageSwitchKeyEnabledMatched
&& isMultiLineMatched && imeActionMatched && 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(
R.styleable.Keyboard_Case_keyboardLayoutSetElement),
"keyboardLayoutSetElement"),