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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations