Search in sources :

Example 1 with RichInputMethodManager

use of com.android.inputmethod.latin.RichInputMethodManager in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class KlpActionLabelTests method testSerbianLatinActionLabel.

public void testSerbianLatinActionLabel() {
    final RichInputMethodManager richImm = RichInputMethodManager.getInstance();
    final Locale sr_ZZ = new Locale("sr", "ZZ");
    final InputMethodSubtype srLatn = richImm.findSubtypeByLocaleAndKeyboardLayoutSet(sr_ZZ.toString(), "serbian_qwertz");
    // This is a preliminary subtype and may not exist.
    if (srLatn == null) {
        return;
    }
    // An action label should be displayed in subtype's locale regardless of the system locale.
    doTestActionKeysInLocaleWithKeyboardTextsSet(srLatn, sr_ZZ, new Locale("sr"));
    doTestActionKeysInLocaleWithKeyboardTextsSet(srLatn, sr_ZZ, Locale.US);
    doTestActionKeysInLocaleWithKeyboardTextsSet(srLatn, sr_ZZ, Locale.FRENCH);
    doTestActionKeysInLocaleWithKeyboardTextsSet(srLatn, sr_ZZ, Locale.ITALIAN);
    doTestActionKeysInLocaleWithKeyboardTextsSet(srLatn, sr_ZZ, Locale.JAPANESE);
}
Also used : Locale(java.util.Locale) RunInLocale(com.android.inputmethod.latin.utils.RunInLocale) InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) RichInputMethodManager(com.android.inputmethod.latin.RichInputMethodManager)

Example 2 with RichInputMethodManager

use of com.android.inputmethod.latin.RichInputMethodManager in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class KlpActionLabelTests method testActionLabelInOtherLocale.

public void testActionLabelInOtherLocale() {
    final RichInputMethodManager richImm = RichInputMethodManager.getInstance();
    final InputMethodSubtype italian = richImm.findSubtypeByLocaleAndKeyboardLayoutSet(Locale.ITALIAN.toString(), SubtypeLocaleUtils.QWERTY);
    // An action label should be displayed in subtype's locale regardless of the system locale.
    doTestActionKeysInLocaleWithStringResources(italian, Locale.ITALIAN, Locale.US);
    doTestActionKeysInLocaleWithStringResources(italian, Locale.ITALIAN, Locale.FRENCH);
    doTestActionKeysInLocaleWithStringResources(italian, Locale.ITALIAN, Locale.ITALIAN);
    doTestActionKeysInLocaleWithStringResources(italian, Locale.ITALIAN, Locale.JAPANESE);
}
Also used : InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) RichInputMethodManager(com.android.inputmethod.latin.RichInputMethodManager)

Example 3 with RichInputMethodManager

use of com.android.inputmethod.latin.RichInputMethodManager in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class KeyboardLayoutSetNavigateMoreKeysBase method testMoreKeysOfEnterKey.

public void testMoreKeysOfEnterKey() {
    final RichInputMethodManager richImm = RichInputMethodManager.getInstance();
    final InputMethodSubtype subtype = richImm.findSubtypeByLocaleAndKeyboardLayoutSet(Locale.US.toString(), SubtypeLocaleUtils.QWERTY);
    // Password field.
    doTestNavigationMoreKeysOf(Constants.CODE_ENTER, subtype, KeyboardId.ELEMENT_ALPHABET, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    // Email field.
    doTestNavigationMoreKeysOf(Constants.CODE_ENTER, subtype, KeyboardId.ELEMENT_ALPHABET, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
    // Url field.
    doTestNavigationMoreKeysOf(Constants.CODE_ENTER, subtype, KeyboardId.ELEMENT_ALPHABET, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
    // Phone number field.
    doTestNavigationMoreKeysOf(Constants.CODE_ENTER, subtype, KeyboardId.ELEMENT_PHONE, InputType.TYPE_CLASS_PHONE);
    // Number field.
    doTestNavigationMoreKeysOf(Constants.CODE_ENTER, subtype, KeyboardId.ELEMENT_NUMBER, InputType.TYPE_CLASS_NUMBER);
    // Date-time field.
    doTestNavigationMoreKeysOf(Constants.CODE_ENTER, subtype, KeyboardId.ELEMENT_NUMBER, InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_NORMAL);
    // Date field.
    doTestNavigationMoreKeysOf(Constants.CODE_ENTER, subtype, KeyboardId.ELEMENT_NUMBER, InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_DATE);
    // Time field.
    doTestNavigationMoreKeysOf(Constants.CODE_ENTER, subtype, KeyboardId.ELEMENT_NUMBER, InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_TIME);
    // Text field.
    if (isPhone()) {
        // The enter key has an Emoji key as one of more keys.
        doTestNavigationWithEmojiMoreKeysOf(Constants.CODE_ENTER, subtype, KeyboardId.ELEMENT_ALPHABET, InputType.TYPE_CLASS_TEXT);
    } else {
        // Tablet has a dedicated Emoji key, so the Enter key has no Emoji more key.
        doTestNavigationMoreKeysOf(Constants.CODE_ENTER, subtype, KeyboardId.ELEMENT_ALPHABET, InputType.TYPE_CLASS_TEXT);
    }
    // Short message field.
    if (isPhone()) {
        // Enter key is switched to Emoji key on a short message field.
        // Emoji key has no navigation more keys.
        doTestNoNavigationMoreKeysOf(Constants.CODE_EMOJI, subtype, KeyboardId.ELEMENT_ALPHABET, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE);
    } else {
        doTestNavigationMoreKeysOf(Constants.CODE_ENTER, subtype, KeyboardId.ELEMENT_ALPHABET, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE);
    }
}
Also used : InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) RichInputMethodManager(com.android.inputmethod.latin.RichInputMethodManager)

Example 4 with RichInputMethodManager

use of com.android.inputmethod.latin.RichInputMethodManager in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class KlpActionLabelTests method testNoLanguageSubtypeActionLabel.

public void testNoLanguageSubtypeActionLabel() {
    final RichInputMethodManager richImm = RichInputMethodManager.getInstance();
    final InputMethodSubtype noLanguage = richImm.findSubtypeByLocaleAndKeyboardLayoutSet(SubtypeLocaleUtils.NO_LANGUAGE, SubtypeLocaleUtils.QWERTY);
    // An action label of no language keyboard should be displayed in the system locale.
    doTestActionKeysInLocaleWithStringResources(noLanguage, Locale.US, Locale.US);
    doTestActionKeysInLocaleWithStringResources(noLanguage, Locale.FRENCH, Locale.FRENCH);
    doTestActionKeysInLocaleWithStringResources(noLanguage, Locale.ITALIAN, Locale.ITALIAN);
    doTestActionKeysInLocaleWithStringResources(noLanguage, Locale.JAPANESE, Locale.JAPANESE);
}
Also used : InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) RichInputMethodManager(com.android.inputmethod.latin.RichInputMethodManager)

Example 5 with RichInputMethodManager

use of com.android.inputmethod.latin.RichInputMethodManager in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class KlpActionLabelTests method testHinglishActionLabel.

public void testHinglishActionLabel() {
    final RichInputMethodManager richImm = RichInputMethodManager.getInstance();
    final Locale hi_ZZ = new Locale("hi", "ZZ");
    final InputMethodSubtype hiLatn = richImm.findSubtypeByLocaleAndKeyboardLayoutSet(hi_ZZ.toString(), SubtypeLocaleUtils.QWERTY);
    // This is a preliminary subtype and may not exist.
    if (hiLatn == null) {
        return;
    }
    // An action label should be displayed in subtype's locale regardless of the system locale.
    doTestActionKeysInLocaleWithKeyboardTextsSet(hiLatn, hi_ZZ, new Locale("hi"));
    doTestActionKeysInLocaleWithKeyboardTextsSet(hiLatn, hi_ZZ, Locale.US);
    doTestActionKeysInLocaleWithKeyboardTextsSet(hiLatn, hi_ZZ, Locale.FRENCH);
    doTestActionKeysInLocaleWithKeyboardTextsSet(hiLatn, hi_ZZ, Locale.ITALIAN);
    doTestActionKeysInLocaleWithKeyboardTextsSet(hiLatn, hi_ZZ, Locale.JAPANESE);
}
Also used : Locale(java.util.Locale) RunInLocale(com.android.inputmethod.latin.utils.RunInLocale) InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) RichInputMethodManager(com.android.inputmethod.latin.RichInputMethodManager)

Aggregations

InputMethodSubtype (android.view.inputmethod.InputMethodSubtype)6 RichInputMethodManager (com.android.inputmethod.latin.RichInputMethodManager)6 RunInLocale (com.android.inputmethod.latin.utils.RunInLocale)2 Locale (java.util.Locale)2 InputMethodInfo (android.view.inputmethod.InputMethodInfo)1 ArrayList (java.util.ArrayList)1