use of com.android.inputmethod.latin.utils.RunInLocale in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class Settings method loadSettings.
public void loadSettings(final Context context, final Locale locale, @Nonnull final InputAttributes inputAttributes) {
mSettingsValuesLock.lock();
mContext = context;
try {
final SharedPreferences prefs = mPrefs;
final RunInLocale<SettingsValues> job = new RunInLocale<SettingsValues>() {
@Override
protected SettingsValues job(final Resources res) {
return new SettingsValues(context, prefs, res, inputAttributes);
}
};
mSettingsValues = job.runInLocale(mRes, locale);
} finally {
mSettingsValuesLock.unlock();
}
}
use of com.android.inputmethod.latin.utils.RunInLocale in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class RichInputConnectionAndTextRangeTests method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
final RunInLocale<SpacingAndPunctuations> job = new RunInLocale<SpacingAndPunctuations>() {
@Override
protected SpacingAndPunctuations job(final Resources res) {
return new SpacingAndPunctuations(res);
}
};
final Resources res = getContext().getResources();
mSpacingAndPunctuations = job.runInLocale(res, Locale.ENGLISH);
}
use of com.android.inputmethod.latin.utils.RunInLocale 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);
}
Aggregations