use of android.widget.ListView in project PocketHub by pockethub.
the class LabelsDialogFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
Bundle arguments = getArguments();
Activity activity = getActivity();
ArrayList<Label> choices = getChoices();
boolean[] selectedChoices = arguments.getBooleanArray(ARG_SELECTED_CHOICES);
List<String> selected = new ArrayList<>();
if (selectedChoices != null) {
for (int i = 0; i < choices.size(); i++) {
if (selectedChoices[i]) {
selected.add(choices.get(i).name());
}
}
}
arguments.putStringArrayList(ARG_SELECTED, (ArrayList<String>) selected);
LayoutInflater inflater = activity.getLayoutInflater();
ListView view = (ListView) inflater.inflate(R.layout.dialog_list_view, null);
LabelListAdapter adapter = new LabelListAdapter(inflater, choices.toArray(new Label[choices.size()]), selectedChoices);
view.setAdapter(adapter);
view.setOnItemClickListener(adapter);
return new MaterialDialog.Builder(activity).cancelable(true).cancelListener(this).negativeText(R.string.cancel).onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
LabelsDialogFragment.this.onClick(dialog, BUTTON_NEGATIVE);
}
}).neutralText(R.string.clear).onNeutral(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
LabelsDialogFragment.this.onClick(dialog, BUTTON_NEUTRAL);
}
}).positiveText(R.string.apply).onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
LabelsDialogFragment.this.onClick(dialog, BUTTON_POSITIVE);
}
}).title(getTitle()).content(getMessage()).customView(view, false).build();
}
use of android.widget.ListView in project PocketHub by pockethub.
the class MilestoneDialogFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
Activity activity = getActivity();
Bundle arguments = getArguments();
final MaterialDialog.Builder dialogBuilder = createDialogBuilder().negativeText(R.string.cancel).onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
MilestoneDialogFragment.this.onClick(dialog, BUTTON_NEGATIVE);
}
}).neutralText(R.string.clear).onNeutral(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
MilestoneDialogFragment.this.onClick(dialog, BUTTON_NEUTRAL);
}
});
LayoutInflater inflater = activity.getLayoutInflater();
ListView view = (ListView) inflater.inflate(R.layout.dialog_list_view, null);
view.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
onClick(getDialog(), position);
}
});
ArrayList<Milestone> choices = getChoices();
int selected = arguments.getInt(ARG_SELECTED_CHOICE);
MilestoneListAdapter adapter = new MilestoneListAdapter(inflater, choices.toArray(new Milestone[choices.size()]), selected);
view.setAdapter(adapter);
if (selected >= 0) {
view.setSelection(selected);
}
dialogBuilder.customView(view, false);
return dialogBuilder.build();
}
use of android.widget.ListView in project androidquery by androidquery.
the class ImageLoadingList4Activity method work.
public void work() {
AQUtility.cleanCacheAsync(this, 0, 0);
BitmapAjaxCallback.clearCache();
String url = "https://picasaweb.google.com/data/feed/base/featured?max-results=48";
aq.progress(R.id.progress).ajax(url, XmlDom.class, this, "renderPhotos");
View list = aq.id(R.id.list).getView();
if (list instanceof ListView) {
ListView lv = (ListView) list;
for (int i = 0; i < 5; i++) {
TextView tv = new TextView(this);
tv.setText("Header View " + i);
lv.addHeaderView(tv);
}
for (int i = 0; i < 5; i++) {
TextView tv = new TextView(this);
tv.setText("Footer View " + i);
lv.addFooterView(tv);
}
}
}
use of android.widget.ListView in project platform_frameworks_base by android.
the class TransparentListActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setBackgroundDrawable(getResources().getDrawable(R.drawable.gradient));
setContentView(R.layout.list_activity);
ListAdapter adapter = new SimpleListAdapter(this);
ListView list = (ListView) findViewById(R.id.list);
list.setAdapter(adapter);
list.setCacheColorHint(0);
list.setVerticalFadingEdgeEnabled(true);
registerForContextMenu(list);
}
use of android.widget.ListView in project platform_frameworks_base by android.
the class ViewLayersActivity4 method setupList.
private void setupList(int listId) {
final ListView list = (ListView) findViewById(listId);
list.setAdapter(new SimpleListAdapter(this));
list.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
Aggregations