Add keyboardLayoutSet attribute to <case> condition

Change-Id: I017c4a3c1c7b2e4c6f607940078f61e120042270
main
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>
<declare-styleable name="Keyboard_Case"> <declare-styleable name="Keyboard_Case">
<attr name="keyboardLayoutSet" format="string" />
<!-- This should be aligned with KeyboardLayoutSet_Element's elementName. --> <!-- This should be aligned with KeyboardLayoutSet_Element's elementName. -->
<attr name="keyboardLayoutSetElement" format="enum|string"> <attr name="keyboardLayoutSetElement" format="enum|string">
<enum name="alphabet" value="0" /> <enum name="alphabet" value="0" />

View File

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