use of android.widget.ArrayAdapter 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);
}
use of android.widget.ArrayAdapter in project AndroidChromium by JackyAndroid.
the class AutofillLocalCardEditor method addSpinnerAdapters.
void addSpinnerAdapters() {
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getActivity(), android.R.layout.simple_spinner_item);
// Populate the month dropdown.
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, 1);
SimpleDateFormat formatter = new SimpleDateFormat("MMMM (MM)", Locale.getDefault());
for (int month = 0; month < 12; month++) {
calendar.set(Calendar.MONTH, month);
adapter.add(formatter.format(calendar.getTime()));
}
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mExpirationMonth.setAdapter(adapter);
// Populate the year dropdown.
adapter = new ArrayAdapter<CharSequence>(getActivity(), android.R.layout.simple_spinner_item);
int initialYear = calendar.get(Calendar.YEAR);
for (int year = initialYear; year < initialYear + 10; year++) {
adapter.add(Integer.toString(year));
}
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mExpirationYear.setAdapter(adapter);
}
use of android.widget.ArrayAdapter in project AndroidChromium by JackyAndroid.
the class AutofillProfileEditor method populateCountriesDropdown.
private void populateCountriesDropdown() {
List<DropdownKeyValue> countries = AutofillProfileBridge.getSupportedCountries();
mCountryCodes = new ArrayList<String>();
for (DropdownKeyValue country : countries) {
mCountryCodes.add(country.getKey());
}
ArrayAdapter<DropdownKeyValue> countriesAdapter = new ArrayAdapter<DropdownKeyValue>(getActivity(), android.R.layout.simple_spinner_item, countries);
countriesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mCountriesDropdown.setAdapter(countriesAdapter);
}
use of android.widget.ArrayAdapter in project Gadgetbridge by Freeyourgadget.
the class GBDeviceAdapterv2 method justifyListViewHeightBasedOnChildren.
public void justifyListViewHeightBasedOnChildren(ListView listView) {
ArrayAdapter adapter = (ArrayAdapter) listView.getAdapter();
if (adapter == null) {
return;
}
ViewGroup vg = listView;
int totalHeight = 0;
for (int i = 0; i < adapter.getCount(); i++) {
View listItem = adapter.getView(i, null, vg);
listItem.measure(0, 0);
totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams par = listView.getLayoutParams();
par.height = totalHeight + (listView.getDividerHeight() * (adapter.getCount() - 1));
listView.setLayoutParams(par);
listView.requestLayout();
}
use of android.widget.ArrayAdapter in project UltimateAndroid by cymcsg.
the class ActivityTransitionActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_transition_first);
ListView list = (ListView) this.findViewById(R.id.listView);
ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, _animationList);
list.setAdapter(adapter);
list.setOnItemClickListener(this);
}
Aggregations