use of com.android.inputmethod.latin.RichInputMethodSubtype in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class RichInputMethodSubtypeTests method setUp.
@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"));
}
}
use of com.android.inputmethod.latin.RichInputMethodSubtype in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class LanguageOnSpacebarUtilsTests method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
final Context context = getContext();
RichInputMethodManager.init(context);
mRichImm = RichInputMethodManager.getInstance();
EN_US_QWERTY = findSubtypeOf(Locale.US.toString(), "qwerty");
EN_GB_QWERTY = findSubtypeOf(Locale.UK.toString(), "qwerty");
FR_AZERTY = findSubtypeOf(Locale.FRENCH.toString(), "azerty");
FR_CA_QWERTY = findSubtypeOf(Locale.CANADA_FRENCH.toString(), "qwerty");
FR_CH_SWISS = findSubtypeOf("fr_CH", "swiss");
FR_CH_QWERTZ = new RichInputMethodSubtype(AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype("fr_CH", "qwertz"));
FR_CH_QWERTY = new RichInputMethodSubtype(AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype("fr_CH", "qwerty"));
IW_HEBREW = findSubtypeOf("iw", "hebrew");
ZZ_QWERTY = findSubtypeOf(SubtypeLocaleUtils.NO_LANGUAGE, "qwerty");
}
use of com.android.inputmethod.latin.RichInputMethodSubtype in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class LanguageOnSpacebarUtilsTests method enableSubtypes.
private static void enableSubtypes(final RichInputMethodSubtype... subtypes) {
final ArrayList<InputMethodSubtype> enabledSubtypes = new ArrayList<>();
for (final RichInputMethodSubtype subtype : subtypes) {
enabledSubtypes.add(subtype.getRawSubtype());
}
LanguageOnSpacebarUtils.setEnabledSubtypes(enabledSubtypes);
}
use of com.android.inputmethod.latin.RichInputMethodSubtype in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class SubtypeLocaleUtilsTests method setUp.
@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");
}
}
use of com.android.inputmethod.latin.RichInputMethodSubtype in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class RichInputMethodSubtypeTests method testAllFullDisplayNameForSpacebar.
public void testAllFullDisplayNameForSpacebar() {
for (final RichInputMethodSubtype subtype : mSubtypesList) {
final String subtypeName = SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(subtype.getRawSubtype());
final String spacebarText = subtype.getFullDisplayName();
final String languageName = SubtypeLocaleUtils.getSubtypeLocaleDisplayName(subtype.getLocale().toString());
if (subtype.isNoLanguage()) {
assertFalse(subtypeName, spacebarText.contains(languageName));
} else {
assertTrue(subtypeName, spacebarText.contains(languageName));
}
}
}
Aggregations