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

Commit 120b64f6 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka Committed by Android (Google) Code Review
Browse files

Merge "Add Spanish United States keyboard"

parents 97ff1714 76d4ffee
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -140,10 +140,12 @@
    <string-array name="subtype_locale_exception_keys">
        <item>en_US</item>
        <item>en_GB</item>
        <item>es_US</item>
    </string-array>
    <string-array name="subtype_locale_exception_values">
        <item>English (US)</item>
        <item>English (UK)</item>
        <item>Español (EE.UU.)</item>
    </string-array>

    <!-- Generic subtype label -->
+12 −2
Original line number Diff line number Diff line
@@ -36,7 +36,8 @@
    en_GB: English Great Britain/qwerty
    eo: Esperanto/spanish
    es: Spanish/spanish
    es_419: Spanish Latin America/qwerty
    es_US: Spanish United States/spanish
    (es_419: Spanish Latin America/qwerty)
    et: Estonian/nordic
    fa: Persian/arabic
    fi: Finnish/nordic
@@ -184,13 +185,22 @@
            android:imeSubtypeMode="keyboard"
            android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
    />
    <subtype android:icon="@drawable/ic_subtype_keyboard"
            android:label="@string/subtype_generic"
            android:subtypeId="0x84d2efc6"
            android:imeSubtypeLocale="es_US"
            android:imeSubtypeMode="keyboard"
            android:imeSubtypeExtraValue="KeyboardLayoutSet=spanish,AsciiCapable"
    />
    <!--
    <subtype android:icon="@drawable/ic_subtype_keyboard"
            android:label="@string/subtype_generic"
            android:subtypeId="0x623f9286"
            android:imeSubtypeLocale="es_419"
            android:imeSubtypeMode="keyboard"
            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
            android:imeSubtypeExtraValue="KeyboardLayoutSet=spanish,AsciiCapable"
    />
    -->
    <subtype android:icon="@drawable/ic_subtype_keyboard"
            android:label="@string/subtype_generic"
            android:subtypeId="0xec2d3955"
+13 −12
Original line number Diff line number Diff line
@@ -1030,9 +1030,10 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
    // InputMethodSubtype's display name for spacebar text in its locale.
    //        isAdditionalSubtype (T=true, F=false)
    // locale layout  | Short  Middle      Full
    // ------ ------ - ---- --------- ----------------------
    // ------ ------- - ---- --------- ----------------------
    //  en_US qwerty  F  En  English   English (US)           exception
    //  en_GB qwerty  F  En  English   English (UK)           exception
    //  es_US spanish F  Es  Español   Español (EE.UU.)       exception
    //  fr    azerty  F  Fr  Français  Français
    //  fr_CA qwerty  F  Fr  Français  Français (Canada)
    //  de    qwertz  F  De  Deutsch   Deutsch
+8 −0
Original line number Diff line number Diff line
@@ -87,6 +87,9 @@ public final class AdditionalSubtypeSettings extends PreferenceFragment {
    }

    static final class SubtypeLocaleAdapter extends ArrayAdapter<SubtypeLocaleItem> {
        private static final String TAG = SubtypeLocaleAdapter.class.getSimpleName();
        private static final boolean DEBUG_SUBTYPE_ID = false;

        public SubtypeLocaleAdapter(final Context context) {
            super(context, android.R.layout.simple_spinner_item);
            setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
@@ -97,6 +100,11 @@ public final class AdditionalSubtypeSettings extends PreferenceFragment {
            final int count = imi.getSubtypeCount();
            for (int i = 0; i < count; i++) {
                final InputMethodSubtype subtype = imi.getSubtypeAt(i);
                if (DEBUG_SUBTYPE_ID) {
                    android.util.Log.d(TAG, String.format("%-6s 0x%08x %11d %s",
                            subtype.getLocale(), subtype.hashCode(), subtype.hashCode(),
                            SubtypeLocale.getSubtypeDisplayName(subtype, context.getResources())));
                }
                if (subtype.containsExtraValueKey(ASCII_CAPABLE)) {
                    items.add(createItem(context, subtype.getLocale()));
                }
+24 −10
Original line number Diff line number Diff line
@@ -96,28 +96,42 @@ public final class RichInputMethodManager {
        return mInputMethodInfoOfThisIme.getId();
    }

    public boolean checkIfSubtypeBelongsToThisImeAndEnabled(final InputMethodSubtype ims) {
        return checkIfSubtypeBelongsToImeAndEnabled(mInputMethodInfoOfThisIme, ims);
    public boolean checkIfSubtypeBelongsToThisImeAndEnabled(final InputMethodSubtype subtype) {
        return checkIfSubtypeBelongsToImeAndEnabled(mInputMethodInfoOfThisIme, subtype);
    }

    public boolean checkIfSubtypeBelongsToThisImeAndImplicitlyEnabled(
            final InputMethodSubtype subtype) {
        final boolean subtypeEnabled = checkIfSubtypeBelongsToThisImeAndEnabled(subtype);
        final boolean subtypeExplicitlyEnabled = checkIfSubtypeBelongsToList(
                subtype, mImmWrapper.mImm.getEnabledInputMethodSubtypeList(
                        mInputMethodInfoOfThisIme, false /* allowsImplicitlySelectedSubtypes */));
        return subtypeEnabled && !subtypeExplicitlyEnabled;
    }

    public boolean checkIfSubtypeBelongsToImeAndEnabled(final InputMethodInfo imi,
            final InputMethodSubtype ims) {
        final List<InputMethodSubtype> subtypes = mImmWrapper.mImm.getEnabledInputMethodSubtypeList(
                imi, true /* allowsImplicitlySelectedSubtypes */);
        for (final InputMethodSubtype subtype : subtypes) {
            if (subtype.equals(ims)) {
            final InputMethodSubtype subtype) {
        return checkIfSubtypeBelongsToList(
                subtype, mImmWrapper.mImm.getEnabledInputMethodSubtypeList(
                        imi, true /* allowsImplicitlySelectedSubtypes */));
    }

    private static boolean checkIfSubtypeBelongsToList(final InputMethodSubtype subtype,
            final List<InputMethodSubtype> subtypes) {
        for (final InputMethodSubtype ims : subtypes) {
            if (ims.equals(subtype)) {
                return true;
            }
        }
        return false;
    }

    public boolean checkIfSubtypeBelongsToThisIme(final InputMethodSubtype ims) {
    public boolean checkIfSubtypeBelongsToThisIme(final InputMethodSubtype subtype) {
        final InputMethodInfo myImi = mInputMethodInfoOfThisIme;
        final int count = myImi.getSubtypeCount();
        for (int i = 0; i < count; i++) {
            final InputMethodSubtype subtype = myImi.getSubtypeAt(i);
            if (subtype.equals(ims)) {
            final InputMethodSubtype ims = myImi.getSubtypeAt(i);
            if (ims.equals(subtype)) {
                return true;
            }
        }
Loading