Merge "Add element predicator to <switch><case> condition of Keyboard"
This commit is contained in:
commit
2419a31c98
2 changed files with 24 additions and 6 deletions
|
@ -294,6 +294,19 @@
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="Keyboard_Case">
|
<declare-styleable name="Keyboard_Case">
|
||||||
|
<!-- This should be aligned with KeyboardSet_Element's elementName. -->
|
||||||
|
<attr name="keyboardSetElement" format="enum|string">
|
||||||
|
<enum name="alphabet" value="0" />
|
||||||
|
<enum name="alphabetManualShifted" value="1" />
|
||||||
|
<enum name="alphabetAutomaticShifted" value="2" />
|
||||||
|
<enum name="alphabetShiftLocked" value="3" />
|
||||||
|
<enum name="alphabetShiftLockShifted" value="4" />
|
||||||
|
<enum name="symbols" value="5" />
|
||||||
|
<enum name="symbolsShifted" value="6" />
|
||||||
|
<enum name="phone" value="7" />
|
||||||
|
<enum name="phoneShifted" value="8" />
|
||||||
|
<enum name="number" value="9" />
|
||||||
|
</attr>
|
||||||
<!-- This should be aligned with KeyboardId.MODE_* -->
|
<!-- This should be aligned with KeyboardId.MODE_* -->
|
||||||
<attr name="mode" format="enum|string">
|
<attr name="mode" format="enum|string">
|
||||||
<enum name="text" value="0" />
|
<enum name="text" value="0" />
|
||||||
|
|
|
@ -1034,6 +1034,9 @@ public class Keyboard {
|
||||||
final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser),
|
final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser),
|
||||||
R.styleable.Keyboard_Case);
|
R.styleable.Keyboard_Case);
|
||||||
try {
|
try {
|
||||||
|
final boolean keyboardSetElementMatched = matchTypedValue(a,
|
||||||
|
R.styleable.Keyboard_Case_keyboardSetElement, id.mElementId,
|
||||||
|
KeyboardId.elementIdToName(id.mElementId));
|
||||||
final boolean modeMatched = matchTypedValue(a,
|
final boolean modeMatched = matchTypedValue(a,
|
||||||
R.styleable.Keyboard_Case_mode, id.mMode, KeyboardId.modeName(id.mMode));
|
R.styleable.Keyboard_Case_mode, id.mMode, KeyboardId.modeName(id.mMode));
|
||||||
final boolean navigateActionMatched = matchBoolean(a,
|
final boolean navigateActionMatched = matchBoolean(a,
|
||||||
|
@ -1062,13 +1065,15 @@ public class Keyboard {
|
||||||
R.styleable.Keyboard_Case_languageCode, id.mLocale.getLanguage());
|
R.styleable.Keyboard_Case_languageCode, id.mLocale.getLanguage());
|
||||||
final boolean countryCodeMatched = matchString(a,
|
final boolean countryCodeMatched = matchString(a,
|
||||||
R.styleable.Keyboard_Case_countryCode, id.mLocale.getCountry());
|
R.styleable.Keyboard_Case_countryCode, id.mLocale.getCountry());
|
||||||
final boolean selected = modeMatched && navigateActionMatched
|
final boolean selected = keyboardSetElementMatched && modeMatched
|
||||||
&& passwordInputMatched && hasSettingsKeyMatched && f2KeyModeMatched
|
&& navigateActionMatched && passwordInputMatched && hasSettingsKeyMatched
|
||||||
&& clobberSettingsKeyMatched && shortcutKeyEnabledMatched
|
&& f2KeyModeMatched && clobberSettingsKeyMatched
|
||||||
&& hasShortcutKeyMatched && imeActionMatched && localeCodeMatched
|
&& shortcutKeyEnabledMatched && hasShortcutKeyMatched && imeActionMatched
|
||||||
&& languageCodeMatched && countryCodeMatched;
|
&& localeCodeMatched && languageCodeMatched && countryCodeMatched;
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, String.format("<%s%s%s%s%s%s%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%s%s%s%s%s> %s", TAG_CASE,
|
||||||
|
textAttr(a.getString(R.styleable.Keyboard_Case_keyboardSetElement),
|
||||||
|
"keyboardSetElement"),
|
||||||
textAttr(a.getString(R.styleable.Keyboard_Case_mode), "mode"),
|
textAttr(a.getString(R.styleable.Keyboard_Case_mode), "mode"),
|
||||||
booleanAttr(a, R.styleable.Keyboard_Case_navigateAction, "navigateAction"),
|
booleanAttr(a, R.styleable.Keyboard_Case_navigateAction, "navigateAction"),
|
||||||
booleanAttr(a, R.styleable.Keyboard_Case_passwordInput, "passwordInput"),
|
booleanAttr(a, R.styleable.Keyboard_Case_passwordInput, "passwordInput"),
|
||||||
|
|
Loading…
Reference in a new issue