Search in sources :

Example 41 with ArrayAdapter

use of android.widget.ArrayAdapter in project cw-omnibus by commonsguy.

the class RowController method onTouch.

@Override
public boolean onTouch(View v, MotionEvent event) {
    if ((event.getButtonState() & MotionEvent.BUTTON_SECONDARY) != 0 && event.getAction() == MotionEvent.ACTION_DOWN) {
        adapter.onChecked(position, true, true);
        String[] items = itemView.getContext().getResources().getStringArray(R.array.popup);
        ArrayAdapter<String> adapter = new ArrayAdapter<>(itemView.getContext(), android.R.layout.simple_list_item_1, items);
        final ListPopupWindow popup = new ListPopupWindow(itemView.getContext());
        popup.setAnchorView(itemView);
        popup.setHorizontalOffset((int) event.getX());
        popup.setVerticalOffset((int) event.getY() - itemView.getHeight());
        popup.setAdapter(adapter);
        popup.setWidth(measureContentWidth(itemView.getContext(), adapter));
        popup.setOnItemClickListener(new AdapterView.OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if (position == 0) {
                    ((MainActivity) itemView.getContext()).playVideo(videoUri);
                } else {
                    ((MainActivity) itemView.getContext()).showLargeThumbnail(videoUri);
                }
                popup.dismiss();
            }
        });
        popup.show();
        return (true);
    }
    return (false);
}
Also used : ListPopupWindow(android.widget.ListPopupWindow) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ArrayAdapter(android.widget.ArrayAdapter)

Example 42 with ArrayAdapter

use of android.widget.ArrayAdapter in project zxingfragmentlib by mitoyarzun.

the class LoadPackagesAsyncTask method onPostExecute.

@Override
protected void onPostExecute(final List<AppInfo> results) {
    ListAdapter listAdapter = new ArrayAdapter<AppInfo>(activity, R.layout.app_picker_list_item, R.id.app_picker_list_item_label, results) {

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View view = super.getView(position, convertView, parent);
            Drawable icon = results.get(position).getIcon();
            if (icon != null) {
                ((ImageView) view.findViewById(R.id.app_picker_list_item_icon)).setImageDrawable(icon);
            }
            return view;
        }
    };
    activity.setListAdapter(listAdapter);
}
Also used : ViewGroup(android.view.ViewGroup) Drawable(android.graphics.drawable.Drawable) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) ListAdapter(android.widget.ListAdapter) ArrayAdapter(android.widget.ArrayAdapter)

Example 43 with ArrayAdapter

use of android.widget.ArrayAdapter in project zxing-lib by kennydude.

the class LoadPackagesAsyncTask method onPostExecute.

@Override
protected synchronized void onPostExecute(List<String[]> results) {
    List<String> labels = new ArrayList<String>(results.size());
    for (String[] result : results) {
        labels.add(result[0]);
    }
    ListAdapter listAdapter = new ArrayAdapter<String>(activity, android.R.layout.simple_list_item_1, labels);
    activity.setListAdapter(listAdapter);
}
Also used : ArrayList(java.util.ArrayList) ListAdapter(android.widget.ListAdapter) ArrayAdapter(android.widget.ArrayAdapter)

Example 44 with ArrayAdapter

use of android.widget.ArrayAdapter in project qksms by moezbhatti.

the class QKDialog method setDoubleLineItems.

public QKDialog setDoubleLineItems(String[] titles, String[] bodies, final OnItemClickListener onClickListener) {
    int size = Math.min(titles.length, bodies.length);
    DoubleLineListItem[] doubleLineListItems = new DoubleLineListItem[size];
    for (int i = 0; i < size; i++) {
        doubleLineListItems[i] = new DoubleLineListItem();
        doubleLineListItems[i].title = titles[i];
        doubleLineListItems[i].body = bodies[i];
    }
    ArrayAdapter adapter = new DoubleLineArrayAdapter(mContext, doubleLineListItems);
    ListView listView = new ListView(mContext);
    listView.setAdapter(adapter);
    listView.setDivider(null);
    listView.setPadding(0, Units.dpToPx(mContext, 8), 0, Units.dpToPx(mContext, 8));
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (onClickListener != null) {
                onClickListener.onItemClick(parent, view, position, id);
                dismiss();
            }
        }
    });
    return setCustomView(listView);
}
Also used : ListView(android.widget.ListView) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) QKTextView(com.moez.QKSMS.ui.view.QKTextView) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(android.support.v7.widget.RecyclerView) ScrollView(android.widget.ScrollView) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

Example 45 with ArrayAdapter

use of android.widget.ArrayAdapter in project qksms by moezbhatti.

the class MMSDialogFragment method setDoubleLineItems.

public MMSDialogFragment setDoubleLineItems(String[] titles, String[] bodies) {
    int size = Math.min(titles.length, bodies.length);
    DoubleLineListItem[] doubleLineListItems = new DoubleLineListItem[size];
    for (int i = 0; i < size; i++) {
        doubleLineListItems[i] = new DoubleLineListItem();
        doubleLineListItems[i].title = titles[i];
        doubleLineListItems[i].body = bodies[i];
    }
    ArrayAdapter adapter = new DoubleLineArrayAdapter(mContext, doubleLineListItems);
    ListView listView = new ListView(mContext);
    listView.setAdapter(adapter);
    listView.setDivider(null);
    listView.setPadding(0, Units.dpToPx(mContext, 8), 0, Units.dpToPx(mContext, 8));
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            onListResult(LIST_ITEM_CLICK_RESULT, position);
            dismiss();
        }
    });
    return setCustomView(listView);
}
Also used : ListView(android.widget.ListView) AdapterView(android.widget.AdapterView) QKTextView(com.moez.QKSMS.ui.view.QKTextView) ScrollView(android.widget.ScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) 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