Search in sources :

Example 1 with LocaleRenderer

use of com.android.inputmethod.latin.userdictionary.UserDictionaryAddWordContents.LocaleRenderer in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class UserDictionaryAddWordFragment method updateSpinner.

private void updateSpinner() {
    final ArrayList<LocaleRenderer> localesList = mContents.getLocalesList(getActivity());
    final Spinner localeSpinner = (Spinner) mRootView.findViewById(R.id.user_dictionary_add_locale);
    final ArrayAdapter<LocaleRenderer> adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, localesList);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    localeSpinner.setAdapter(adapter);
    localeSpinner.setOnItemSelectedListener(this);
}
Also used : LocaleRenderer(com.android.inputmethod.latin.userdictionary.UserDictionaryAddWordContents.LocaleRenderer) Spinner(android.widget.Spinner) ArrayAdapter(android.widget.ArrayAdapter)

Example 2 with LocaleRenderer

use of com.android.inputmethod.latin.userdictionary.UserDictionaryAddWordContents.LocaleRenderer in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class UserDictionaryAddWordFragment method onItemSelected.

@Override
public void onItemSelected(final AdapterView<?> parent, final View view, final int pos, final long id) {
    final LocaleRenderer locale = (LocaleRenderer) parent.getItemAtPosition(pos);
    if (locale.isMoreLanguages()) {
        PreferenceActivity preferenceActivity = (PreferenceActivity) getActivity();
        preferenceActivity.startPreferenceFragment(new UserDictionaryLocalePicker(), true);
    } else {
        mContents.updateLocale(locale.getLocaleString());
    }
}
Also used : LocaleRenderer(com.android.inputmethod.latin.userdictionary.UserDictionaryAddWordContents.LocaleRenderer) PreferenceActivity(android.preference.PreferenceActivity)

Aggregations

LocaleRenderer (com.android.inputmethod.latin.userdictionary.UserDictionaryAddWordContents.LocaleRenderer)2 PreferenceActivity (android.preference.PreferenceActivity)1 ArrayAdapter (android.widget.ArrayAdapter)1 Spinner (android.widget.Spinner)1