Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41745c49 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Add keyboardLayoutSet attribute to <case> condition

Change-Id: I017c4a3c1c7b2e4c6f607940078f61e120042270
parent ade725ed
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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" />
+13 −7
Original line number Diff line number Diff line
@@ -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"),