Search in sources :

Example 91 with ArrayAdapter

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);
}
Also used : LocaleRenderer(com.android.inputmethod.latin.userdictionary.UserDictionaryAddWordContents.LocaleRenderer) Spinner(android.widget.Spinner) ArrayAdapter(android.widget.ArrayAdapter)

Example 92 with ArrayAdapter

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);
}
Also used : Calendar(java.util.Calendar) SimpleDateFormat(java.text.SimpleDateFormat) ArrayAdapter(android.widget.ArrayAdapter)

Example 93 with ArrayAdapter

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);
}
Also used : ArrayAdapter(android.widget.ArrayAdapter) DropdownKeyValue(org.chromium.chrome.browser.preferences.autofill.AutofillProfileBridge.DropdownKeyValue)

Example 94 with ArrayAdapter

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();
}
Also used : ViewGroup(android.view.ViewGroup) ImageView(android.widget.ImageView) View(android.view.View) CardView(android.support.v7.widget.CardView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

Example 95 with ArrayAdapter

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);
}
Also used : ListView(android.widget.ListView) ListAdapter(android.widget.ListAdapter) ArrayAdapter(android.widget.ArrayAdapter)

Aggregations

ArrayAdapter (android.widget.ArrayAdapter)309 View (android.view.View)154 TextView (android.widget.TextView)102 ListView (android.widget.ListView)92 AdapterView (android.widget.AdapterView)89 ArrayList (java.util.ArrayList)55 Spinner (android.widget.Spinner)51 ViewGroup (android.view.ViewGroup)40 Intent (android.content.Intent)33 AutoCompleteTextView (android.widget.AutoCompleteTextView)29 Button (android.widget.Button)26 ImageView (android.widget.ImageView)26 DialogInterface (android.content.DialogInterface)23 ListAdapter (android.widget.ListAdapter)21 RecyclerView (android.support.v7.widget.RecyclerView)18 LayoutInflater (android.view.LayoutInflater)18 LinearLayout (android.widget.LinearLayout)18 Bundle (android.os.Bundle)17 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)17 EditText (android.widget.EditText)15