Search in sources :

Example 1 with KeyboardTextsSet

use of com.android.inputmethod.keyboard.internal.KeyboardTextsSet in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class KlpActionLabelTests method doTestActionKeysInLocaleWithKeyboardTextsSet.

private void doTestActionKeysInLocaleWithKeyboardTextsSet(final InputMethodSubtype subtype, final Locale labelLocale, final Locale systemLocale) {
    // Simulate system locale changing, see {@link SystemBroadcastReceiver}.
    if (!systemLocale.equals(mSystemLocale)) {
        KeyboardLayoutSet.onSystemLocaleChanged();
        mSystemLocale = systemLocale;
    }
    final KeyboardTextsSet textsSet = new KeyboardTextsSet();
    textsSet.setLocale(labelLocale, getContext());
    final ExpectedActionKey enterKey = ExpectedActionKey.newIconKey(KeyboardIconsSet.NAME_ENTER_KEY);
    final ExpectedActionKey goKey = ExpectedActionKey.newLabelKey(textsSet.getText("label_go_key"));
    final ExpectedActionKey searchKey = ExpectedActionKey.newIconKey(KeyboardIconsSet.NAME_SEARCH_KEY);
    final ExpectedActionKey sendKey = ExpectedActionKey.newLabelKey(textsSet.getText("label_send_key"));
    final ExpectedActionKey nextKey = ExpectedActionKey.newLabelKey(textsSet.getText("label_next_key"));
    final ExpectedActionKey doneKey = ExpectedActionKey.newLabelKey(textsSet.getText("label_done_key"));
    final ExpectedActionKey previousKey = ExpectedActionKey.newLabelKey(textsSet.getText("label_previous_key"));
    final String tag = "label=" + subtype.getLocale() + " system=" + systemLocale + " " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
    final RunInLocale<Void> job = new RunInLocale<Void>() {

        @Override
        public Void job(final Resources res) {
            doTestActionKeys(subtype, tag, enterKey, enterKey, goKey, searchKey, sendKey, nextKey, doneKey, previousKey);
            return null;
        }
    };
    job.runInLocale(getContext().getResources(), systemLocale);
}
Also used : Resources(android.content.res.Resources) RunInLocale(com.android.inputmethod.latin.utils.RunInLocale) KeyboardTextsSet(com.android.inputmethod.keyboard.internal.KeyboardTextsSet)

Aggregations

Resources (android.content.res.Resources)1 KeyboardTextsSet (com.android.inputmethod.keyboard.internal.KeyboardTextsSet)1 RunInLocale (com.android.inputmethod.latin.utils.RunInLocale)1