Search in sources :

Example 96 with InputMethodSubtype

use of android.view.inputmethod.InputMethodSubtype in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class LxxActionNextTests method testActionNext.

public void testActionNext() {
    final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(KeyboardIconsSet.NAME_NEXT_KEY);
    for (final InputMethodSubtype subtype : getAllSubtypesList()) {
        final String tag = "next " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
        doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_NEXT, expectedKey);
    }
}
Also used : InputMethodSubtype(android.view.inputmethod.InputMethodSubtype)

Example 97 with InputMethodSubtype

use of android.view.inputmethod.InputMethodSubtype in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class LxxActionSendTests method testActionSend.

public void testActionSend() {
    final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(KeyboardIconsSet.NAME_SEND_KEY);
    for (final InputMethodSubtype subtype : getAllSubtypesList()) {
        final String tag = "send " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
        doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_SEND, expectedKey);
    }
}
Also used : InputMethodSubtype(android.view.inputmethod.InputMethodSubtype)

Example 98 with InputMethodSubtype

use of android.view.inputmethod.InputMethodSubtype in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class LxxActionUnspecifiedTests method testActionUnspecified.

public void testActionUnspecified() {
    final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(KeyboardIconsSet.NAME_ENTER_KEY);
    for (final InputMethodSubtype subtype : getAllSubtypesList()) {
        final String tag = "unspecifiled " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
        doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_UNSPECIFIED, expectedKey);
    }
}
Also used : InputMethodSubtype(android.view.inputmethod.InputMethodSubtype)

Example 99 with InputMethodSubtype

use of android.view.inputmethod.InputMethodSubtype in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class CryptKeeper method hasMultipleEnabledIMEsOrSubtypes.

/**
 * Method adapted from com.android.inputmethod.latin.Utils
 *
 * @param imm The input method manager
 * @param shouldIncludeAuxiliarySubtypes
 * @return true if we have multiple IMEs to choose from
 */
private boolean hasMultipleEnabledIMEsOrSubtypes(InputMethodManager imm, final boolean shouldIncludeAuxiliarySubtypes) {
    final List<InputMethodInfo> enabledImis = imm.getEnabledInputMethodList();
    // Number of the filtered IMEs
    int filteredImisCount = 0;
    for (InputMethodInfo imi : enabledImis) {
        // We can return true immediately after we find two or more filtered IMEs.
        if (filteredImisCount > 1)
            return true;
        final List<InputMethodSubtype> subtypes = imm.getEnabledInputMethodSubtypeList(imi, true);
        // IMEs that have no subtypes should be counted.
        if (subtypes.isEmpty()) {
            ++filteredImisCount;
            continue;
        }
        int auxCount = 0;
        for (InputMethodSubtype subtype : subtypes) {
            if (subtype.isAuxiliary()) {
                ++auxCount;
            }
        }
        final int nonAuxCount = subtypes.size() - auxCount;
        // subtypes should be counted as well.
        if (nonAuxCount > 0 || (shouldIncludeAuxiliarySubtypes && auxCount > 1)) {
            ++filteredImisCount;
            continue;
        }
    }
    return filteredImisCount > 1 || // input method subtype (The current IME should be LatinIME.)
    imm.getEnabledInputMethodSubtypeList(null, false).size() > 1;
}
Also used : InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Example 100 with InputMethodSubtype

use of android.view.inputmethod.InputMethodSubtype in project robolectric by robolectric.

the class ShadowInputMethodManagerTest method setCurrentInputMethodSubtype_isReturned.

/**
 * The builder is only available for 19+.
 */
@Config(minSdk = KITKAT)
@Test
public void setCurrentInputMethodSubtype_isReturned() {
    InputMethodSubtype inputMethodSubtype = new InputMethodSubtypeBuilder().build();
    shadow.setCurrentInputMethodSubtype(inputMethodSubtype);
    assertThat(manager.getCurrentInputMethodSubtype()).isEqualTo(inputMethodSubtype);
}
Also used : InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) InputMethodSubtypeBuilder(android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Aggregations

InputMethodSubtype (android.view.inputmethod.InputMethodSubtype)216 InputMethodInfo (android.view.inputmethod.InputMethodInfo)112 ArrayList (java.util.ArrayList)49 InputMethodManager (android.view.inputmethod.InputMethodManager)21 Locale (java.util.Locale)17 LocaleList (android.os.LocaleList)15 ImeSubtypeListItem (com.android.internal.inputmethod.InputMethodSubtypeSwitchingController.ImeSubtypeListItem)15 Context (android.content.Context)12 SmallTest (android.test.suitebuilder.annotation.SmallTest)10 Cursor (android.database.Cursor)9 PreferenceScreen (android.support.v7.preference.PreferenceScreen)9 View (android.view.View)9 TextView (android.widget.TextView)9 TreeSet (java.util.TreeSet)9 PreferenceCategory (android.support.v7.preference.PreferenceCategory)8 RichInputMethodSubtype (com.android.inputmethod.latin.RichInputMethodSubtype)8 List (java.util.List)8 Intent (android.content.Intent)7 Pair (android.util.Pair)7 AlertDialog (android.app.AlertDialog)6