Java Code Examples for android.view.inputmethod.InputMethodInfo#getSubtypeAt()

The following examples show how to use android.view.inputmethod.InputMethodInfo#getSubtypeAt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomInputStylePreference.java    From openboard with GNU General Public License v3.0 6 votes vote down vote up
public SubtypeLocaleAdapter(final Context context) {
    super(context, android.R.layout.simple_spinner_item);
    setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    final TreeSet<SubtypeLocaleItem> items = new TreeSet<>();
    final InputMethodInfo imi = RichInputMethodManager.getInstance()
            .getInputMethodInfoOfThisIme();
    final int count = imi.getSubtypeCount();
    for (int i = 0; i < count; i++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(i);
        if (DEBUG_SUBTYPE_ID) {
            Log.d(TAG_SUBTYPE, String.format("%-6s 0x%08x %11d %s",
                    subtype.getLocale(), subtype.hashCode(), subtype.hashCode(),
                    SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(subtype)));
        }
        if (subtype.isAsciiCapable()) {
            items.add(new SubtypeLocaleItem(subtype));
        }
    }
    // TODO: Should filter out already existing combinations of locale and layout.
    addAll(items);
}
 
Example 2
Source File: CustomInputStylePreference.java    From Android-Keyboard with Apache License 2.0 6 votes vote down vote up
public SubtypeLocaleAdapter(final Context context) {
    super(context, android.R.layout.simple_spinner_item);
    setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    final TreeSet<SubtypeLocaleItem> items = new TreeSet<>();
    final InputMethodInfo imi = RichInputMethodManager.getInstance()
            .getInputMethodInfoOfThisIme();
    final int count = imi.getSubtypeCount();
    for (int i = 0; i < count; i++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(i);
        if (DEBUG_SUBTYPE_ID) {
            Log.d(TAG_SUBTYPE, String.format("%-6s 0x%08x %11d %s",
                    subtype.getLocale(), subtype.hashCode(), subtype.hashCode(),
                    SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(subtype)));
        }
        if (InputMethodSubtypeCompatUtils.isAsciiCapable(subtype)) {
            items.add(new SubtypeLocaleItem(subtype));
        }
    }
    // TODO: Should filter out already existing combinations of locale and layout.
    addAll(items);
}
 
Example 3
Source File: CustomInputStylePreference.java    From Indic-Keyboard with Apache License 2.0 6 votes vote down vote up
public SubtypeLocaleAdapter(final Context context) {
    super(context, android.R.layout.simple_spinner_item);
    setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    final TreeSet<SubtypeLocaleItem> items = new TreeSet<>();
    final InputMethodInfo imi = RichInputMethodManager.getInstance()
            .getInputMethodInfoOfThisIme();
    final int count = imi.getSubtypeCount();
    for (int i = 0; i < count; i++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(i);
        if (DEBUG_SUBTYPE_ID) {
            Log.d(TAG_SUBTYPE, String.format("%-6s 0x%08x %11d %s",
                    subtype.getLocale(), subtype.hashCode(), subtype.hashCode(),
                    SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(subtype)));
        }
        if (InputMethodSubtypeCompatUtils.isAsciiCapable(subtype)) {
            items.add(new SubtypeLocaleItem(subtype));
        }
    }
    // TODO: Should filter out already existing combinations of locale and layout.
    addAll(items);
}
 
Example 4
Source File: CustomInputStylePreference.java    From LokiBoard-Android-Keylogger with Apache License 2.0 6 votes vote down vote up
public SubtypeLocaleAdapter(final Context context) {
    super(context, android.R.layout.simple_spinner_item);
    setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    final TreeSet<SubtypeLocaleItem> items = new TreeSet<>();
    final InputMethodInfo imi = RichInputMethodManager.getInstance()
            .getInputMethodInfoOfThisIme();
    final int count = imi.getSubtypeCount();
    for (int i = 0; i < count; i++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(i);
        if (DEBUG_SUBTYPE_ID) {
            Log.d(TAG_SUBTYPE, String.format("%-6s 0x%08x %11d %s",
                    subtype.getLocale(), subtype.hashCode(), subtype.hashCode(),
                    SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(subtype)));
        }
        if (subtype.isAsciiCapable()) {
            items.add(new SubtypeLocaleItem(subtype));
        }
    }
    // TODO: Should filter out already existing combinations of locale and layout.
    addAll(items);
}
 
Example 5
Source File: InputMethodManagerService.java    From TvRemoteControl with Apache License 2.0 6 votes vote down vote up
@Override
public InputMethodSubtype getLastInputMethodSubtype() {
    if (!calledFromValidUser()) {
        return null;
    }
    synchronized (mMethodMap) {
        final Pair<String, String> lastIme = mSettings.getLastInputMethodAndSubtypeLocked();
        // TODO: Handle the case of the last IME with no subtypes
        if (lastIme == null || TextUtils.isEmpty(lastIme.first)
                || TextUtils.isEmpty(lastIme.second)) return null;
        final InputMethodInfo lastImi = mMethodMap.get(lastIme.first);
        if (lastImi == null) return null;
        try {
            final int lastSubtypeHash = Integer.valueOf(lastIme.second);
            final int lastSubtypeId =
                    InputMethodUtils.getSubtypeIdFromHashCode(lastImi, lastSubtypeHash);
            if (lastSubtypeId < 0 || lastSubtypeId >= lastImi.getSubtypeCount()) {
                return null;
            }
            return lastImi.getSubtypeAt(lastSubtypeId);
        } catch (NumberFormatException e) {
            return null;
        }
    }
}
 
Example 6
Source File: CustomInputStylePreference.java    From simple-keyboard with Apache License 2.0 6 votes vote down vote up
public SubtypeLocaleAdapter(final Context context) {
    super(context, android.R.layout.simple_spinner_item);
    setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    final TreeSet<SubtypeLocaleItem> items = new TreeSet<>();
    final InputMethodInfo imi = RichInputMethodManager.getInstance()
            .getInputMethodInfoOfThisIme();
    final int count = imi.getSubtypeCount();
    for (int i = 0; i < count; i++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(i);
        if (DEBUG_SUBTYPE_ID) {
            Log.d(TAG_SUBTYPE, String.format("%-6s 0x%08x %11d %s",
                    subtype.getLocale(), subtype.hashCode(), subtype.hashCode(),
                    SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(subtype)));
        }
        if (subtype.isAsciiCapable()) {
            items.add(new SubtypeLocaleItem(subtype));
        }
    }
    // TODO: Should filter out already existing combinations of locale and layout.
    addAll(items);
}
 
Example 7
Source File: RichInputMethodManager.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
public InputMethodSubtype findSubtypeByLocaleAndKeyboardLayoutSet(final String localeString,
        final String keyboardLayoutSetName) {
    final InputMethodInfo myImi = getInputMethodInfoOfThisIme();
    final int count = myImi.getSubtypeCount();
    for (int i = 0; i < count; i++) {
        final InputMethodSubtype subtype = myImi.getSubtypeAt(i);
        final String layoutName = SubtypeLocaleUtils.getKeyboardLayoutSetName(subtype);
        if (localeString.equals(subtype.getLocale())
                && keyboardLayoutSetName.equals(layoutName)) {
            return subtype;
        }
    }
    return null;
}
 
Example 8
Source File: RichInputMethodManager.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
public InputMethodSubtype findSubtypeByLocaleAndKeyboardLayoutSet(final String localeString,
        final String keyboardLayoutSetName) {
    final InputMethodInfo myImi = getInputMethodInfoOfThisIme();
    final int count = myImi.getSubtypeCount();
    for (int i = 0; i < count; i++) {
        final InputMethodSubtype subtype = myImi.getSubtypeAt(i);
        final String layoutName = SubtypeLocaleUtils.getKeyboardLayoutSetName(subtype);
        if (localeString.equals(subtype.getLocale())
                && keyboardLayoutSetName.equals(layoutName)) {
            return subtype;
        }
    }
    return null;
}
 
Example 9
Source File: RichInputMethodManager.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
private static boolean isAuxiliaryIme(final InputMethodInfo imi) {
    final int count = imi.getSubtypeCount();
    if (count == 0) {
        return false;
    }
    for (int index = 0; index < count; index++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(index);
        if (!subtype.isAuxiliary()) {
            return false;
        }
    }
    return true;
}
 
Example 10
Source File: InputMethodManagerService.java    From TvRemoteControl with Apache License 2.0 5 votes vote down vote up
private void setSelectedInputMethodAndSubtypeLocked(InputMethodInfo imi, int subtypeId,
        boolean setSubtypeOnly) {
    // Update the history of InputMethod and Subtype
    mSettings.saveCurrentInputMethodAndSubtypeToHistory(mCurMethodId, mCurrentSubtype);

    // Set Subtype here
    if (imi == null || subtypeId < 0) {
        mSettings.putSelectedSubtype(NOT_A_SUBTYPE_ID);
        mCurrentSubtype = null;
    } else {
        if (subtypeId < imi.getSubtypeCount()) {
            InputMethodSubtype subtype = imi.getSubtypeAt(subtypeId);
            mSettings.putSelectedSubtype(subtype.hashCode());
            mCurrentSubtype = subtype;
        } else {
            mSettings.putSelectedSubtype(NOT_A_SUBTYPE_ID);
            // If the subtype is not specified, choose the most applicable one
            mCurrentSubtype = getCurrentInputMethodSubtypeLocked();
        }
    }

    // Workaround.
    // ASEC is not ready in the IMMS constructor. Accordingly, forward-locked
    // IMEs are not recognized and considered uninstalled.
    // Actually, we can't move everything after SystemReady because
    // IMMS needs to run in the encryption lock screen. So, we just skip changing
    // the default IME here and try cheking the default IME again in systemReady().
    // TODO: Do nothing before system ready and implement a separated logic for
    // the encryption lock screen.
    // TODO: ASEC should be ready before IMMS is instantiated.
    if (mSystemReady && !setSubtypeOnly) {
        // Set InputMethod here
        mSettings.putSelectedInputMethod(imi != null ? imi.getId() : "");
    }
}
 
Example 11
Source File: KeyboardTextsSetTests.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    RichInputMethodManager.init(getContext());
    final RichInputMethodManager richImm = RichInputMethodManager.getInstance();

    final ArrayList<InputMethodSubtype> allSubtypesList = new ArrayList<>();
    final InputMethodInfo imi = richImm.getInputMethodInfoOfThisIme();
    final int subtypeCount = imi.getSubtypeCount();
    for (int index = 0; index < subtypeCount; index++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(index);
        allSubtypesList.add(subtype);
    }
    mAllSubtypesList = Collections.unmodifiableList(allSubtypesList);
}
 
Example 12
Source File: RichInputMethodManager.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
public InputMethodSubtype findSubtypeByLocaleAndKeyboardLayoutSet(final String localeString,
        final String keyboardLayoutSetName) {
    final InputMethodInfo myImi = getInputMethodInfoOfThisIme();
    final int count = myImi.getSubtypeCount();
    for (int i = 0; i < count; i++) {
        final InputMethodSubtype subtype = myImi.getSubtypeAt(i);
        final String layoutName = SubtypeLocaleUtils.getKeyboardLayoutSetName(subtype);
        if (localeString.equals(subtype.getLocale())
                && keyboardLayoutSetName.equals(layoutName)) {
            return subtype;
        }
    }
    return null;
}
 
Example 13
Source File: RichInputMethodManager.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
private static boolean isAuxiliaryIme(final InputMethodInfo imi) {
    final int count = imi.getSubtypeCount();
    if (count == 0) {
        return false;
    }
    for (int index = 0; index < count; index++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(index);
        if (!subtype.isAuxiliary()) {
            return false;
        }
    }
    return true;
}
 
Example 14
Source File: RichInputMethodManager.java    From simple-keyboard with Apache License 2.0 5 votes vote down vote up
private static boolean isAuxiliaryIme(final InputMethodInfo imi) {
    final int count = imi.getSubtypeCount();
    if (count == 0) {
        return false;
    }
    for (int index = 0; index < count; index++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(index);
        if (!subtype.isAuxiliary()) {
            return false;
        }
    }
    return true;
}
 
Example 15
Source File: RichInputMethodManager.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
public InputMethodSubtype findSubtypeByLocaleAndKeyboardLayoutSet(final String localeString,
        final String keyboardLayoutSetName) {
    final InputMethodInfo myImi = getInputMethodInfoOfThisIme();
    final int count = myImi.getSubtypeCount();
    for (int i = 0; i < count; i++) {
        final InputMethodSubtype subtype = myImi.getSubtypeAt(i);
        final String layoutName = SubtypeLocaleUtils.getKeyboardLayoutSetName(subtype);
        if (localeString.equals(subtype.getLocale())
                && keyboardLayoutSetName.equals(layoutName)) {
            return subtype;
        }
    }
    return null;
}
 
Example 16
Source File: RichInputMethodManager.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
private static boolean isAuxiliaryIme(final InputMethodInfo imi) {
    final int count = imi.getSubtypeCount();
    if (count == 0) {
        return false;
    }
    for (int index = 0; index < count; index++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(index);
        if (!subtype.isAuxiliary()) {
            return false;
        }
    }
    return true;
}
 
Example 17
Source File: RichInputMethodManager.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
private static boolean isAuxiliaryIme(final InputMethodInfo imi) {
    final int count = imi.getSubtypeCount();
    if (count == 0) {
        return false;
    }
    for (int index = 0; index < count; index++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(index);
        if (!subtype.isAuxiliary()) {
            return false;
        }
    }
    return true;
}
 
Example 18
Source File: InputMethodManagerService.java    From TvRemoteControl with Apache License 2.0 4 votes vote down vote up
void setInputMethodLocked(String id, int subtypeId) {
    InputMethodInfo info = mMethodMap.get(id);
    if (info == null) {
        throw new IllegalArgumentException("Unknown id: " + id);
    }

    // See if we need to notify a subtype change within the same IME.
    if (id.equals(mCurMethodId)) {
        final int subtypeCount = info.getSubtypeCount();
        if (subtypeCount <= 0) {
            return;
        }
        final InputMethodSubtype oldSubtype = mCurrentSubtype;
        final InputMethodSubtype newSubtype;
        if (subtypeId >= 0 && subtypeId < subtypeCount) {
            newSubtype = info.getSubtypeAt(subtypeId);
        } else {
            // If subtype is null, try to find the most applicable one from
            // getCurrentInputMethodSubtype.
            newSubtype = getCurrentInputMethodSubtypeLocked();
        }
        if (newSubtype == null || oldSubtype == null) {
            Slog.w(TAG, "Illegal subtype state: old subtype = " + oldSubtype
                    + ", new subtype = " + newSubtype);
            return;
        }
        if (newSubtype != oldSubtype) {
            setSelectedInputMethodAndSubtypeLocked(info, subtypeId, true);
            if (mCurMethod != null) {
                try {
                    refreshImeWindowVisibilityLocked();
                    mCurMethod.changeInputMethodSubtype(newSubtype);
                } catch (RemoteException e) {
                    Slog.w(TAG, "Failed to call changeInputMethodSubtype");
                }
            }
        }
        return;
    }

    // Changing to a different IME.
    final long ident = Binder.clearCallingIdentity();
    try {
        // Set a subtype to this input method.
        // subtypeId the name of a subtype which will be set.
        setSelectedInputMethodAndSubtypeLocked(info, subtypeId, false);
        // mCurMethodId should be updated after setSelectedInputMethodAndSubtypeLocked()
        // because mCurMethodId is stored as a history in
        // setSelectedInputMethodAndSubtypeLocked().
        mCurMethodId = id;

        if (ActivityManagerNative.isSystemReady()) {
            Intent intent = new Intent(Intent.ACTION_INPUT_METHOD_CHANGED);
            intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
            intent.putExtra("input_method_id", id);
            mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT);
        }
        unbindCurrentClientLocked();
    } finally {
        Binder.restoreCallingIdentity(ident);
    }
}
 
Example 19
Source File: RichInputMethodSubtypeTests.java    From Indic-Keyboard with Apache License 2.0 4 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    final Context context = getContext();
    mRes = context.getResources();
    RichInputMethodManager.init(context);
    mRichImm = RichInputMethodManager.getInstance();

    // Save and reset additional subtypes
    mSavedAddtionalSubtypes = mRichImm.getAdditionalSubtypes();
    final InputMethodSubtype[] predefinedAddtionalSubtypes =
            AdditionalSubtypeUtils.createAdditionalSubtypesArray(
                    AdditionalSubtypeUtils.createPrefSubtypes(
                            mRes.getStringArray(R.array.predefined_subtypes)));
    mRichImm.setAdditionalInputMethodSubtypes(predefinedAddtionalSubtypes);

    final InputMethodInfo imi = mRichImm.getInputMethodInfoOfThisIme();
    final int subtypeCount = imi.getSubtypeCount();
    for (int index = 0; index < subtypeCount; index++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(index);
        mSubtypesList.add(new RichInputMethodSubtype(subtype));
    }

    EN_US = new RichInputMethodSubtype(mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            Locale.US.toString(), "qwerty"));
    EN_GB = new RichInputMethodSubtype(mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            Locale.UK.toString(), "qwerty"));
    ES_US = new RichInputMethodSubtype(mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            "es_US", "spanish"));
    FR = new RichInputMethodSubtype(mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            Locale.FRENCH.toString(), "azerty"));
    FR_CA = new RichInputMethodSubtype(mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            Locale.CANADA_FRENCH.toString(), "qwerty"));
    FR_CH = new RichInputMethodSubtype(mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            "fr_CH", "swiss"));
    DE = new RichInputMethodSubtype(mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            Locale.GERMAN.toString(), "qwertz"));
    DE_CH = new RichInputMethodSubtype(mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            "de_CH", "swiss"));
    HI = new RichInputMethodSubtype(mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            "hi", "hindi"));
    SR = new RichInputMethodSubtype(mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            "sr", "south_slavic"));
    ZZ = new RichInputMethodSubtype(mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            SubtypeLocaleUtils.NO_LANGUAGE, "qwerty"));
    DE_QWERTY = new RichInputMethodSubtype(
            AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
                Locale.GERMAN.toString(), "qwerty"));
    FR_QWERTZ = new RichInputMethodSubtype(
            AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
                Locale.FRENCH.toString(), "qwertz"));
    EN_US_AZERTY = new RichInputMethodSubtype(
            AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
                Locale.US.toString(), "azerty"));
    EN_UK_DVORAK = new RichInputMethodSubtype(
            AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
                Locale.UK.toString(), "dvorak"));
    ES_US_COLEMAK = new RichInputMethodSubtype(
            AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
                "es_US", "colemak"));
    ZZ_AZERTY = new RichInputMethodSubtype(
            AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
                SubtypeLocaleUtils.NO_LANGUAGE, "azerty"));
    ZZ_PC = new RichInputMethodSubtype(
            AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
                SubtypeLocaleUtils.NO_LANGUAGE, "pcqwerty"));

    final InputMethodSubtype hiLatn = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            "hi_ZZ", "qwerty");
    if (hiLatn != null) {
        HI_LATN = new RichInputMethodSubtype(hiLatn);
        HI_LATN_DVORAK = new RichInputMethodSubtype(
                AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
                        "hi_ZZ", "dvorak"));
    }
    final InputMethodSubtype srLatn = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            "sr_ZZ", "serbian_qwertz");
    if (srLatn != null) {
        SR_LATN = new RichInputMethodSubtype(srLatn);
        SR_LATN_QWERTY = new RichInputMethodSubtype(
                AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
                        "sr_ZZ", "qwerty"));
    }
}
 
Example 20
Source File: SubtypeLocaleUtilsTests.java    From Indic-Keyboard with Apache License 2.0 4 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    final Context context = getContext();
    mRes = context.getResources();
    RichInputMethodManager.init(context);
    mRichImm = RichInputMethodManager.getInstance();

    // Save and reset additional subtypes
    mSavedAddtionalSubtypes = mRichImm.getAdditionalSubtypes();
    final InputMethodSubtype[] predefinedAddtionalSubtypes =
            AdditionalSubtypeUtils.createAdditionalSubtypesArray(
                    AdditionalSubtypeUtils.createPrefSubtypes(
                            mRes.getStringArray(R.array.predefined_subtypes)));
    mRichImm.setAdditionalInputMethodSubtypes(predefinedAddtionalSubtypes);

    final InputMethodInfo imi = mRichImm.getInputMethodInfoOfThisIme();
    final int subtypeCount = imi.getSubtypeCount();
    for (int index = 0; index < subtypeCount; index++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(index);
        mSubtypesList.add(new RichInputMethodSubtype(subtype));
    }

    EN_US = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            Locale.US.toString(), "qwerty");
    EN_GB = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            Locale.UK.toString(), "qwerty");
    ES_US = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            "es_US", "spanish");
    FR = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            Locale.FRENCH.toString(), "azerty");
    FR_CA = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            Locale.CANADA_FRENCH.toString(), "qwerty");
    FR_CH = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            "fr_CH", "swiss");
    DE = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            Locale.GERMAN.toString(), "qwertz");
    DE_CH = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            "de_CH", "swiss");
    HI = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            "hi", "hindi");
    SR = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            "sr", "south_slavic");
    ZZ = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
            SubtypeLocaleUtils.NO_LANGUAGE, "qwerty");
    DE_QWERTY = AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
            Locale.GERMAN.toString(), "qwerty");
    FR_QWERTZ = AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
            Locale.FRENCH.toString(), "qwertz");
    EN_US_AZERTY = AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
            Locale.US.toString(), "azerty");
    EN_UK_DVORAK = AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
            Locale.UK.toString(), "dvorak");
    ES_US_COLEMAK = AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
            "es_US", "colemak");
    ZZ_AZERTY = AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
            SubtypeLocaleUtils.NO_LANGUAGE, "azerty");
    ZZ_PC = AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
            SubtypeLocaleUtils.NO_LANGUAGE, "pcqwerty");

    HI_LATN = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet("hi_ZZ", "qwerty");
    if (HI_LATN != null) {
        HI_LATN_DVORAK = AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
                "hi_ZZ", "dvorak");
    }
    SR_LATN = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet("sr_ZZ", "serbian_qwertz");
    if (SR_LATN != null) {
        SR_LATN_QWERTY = AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
                "sr_ZZ", "qwerty");
    }
}