Search in sources :

Example 46 with ListView

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();
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Bundle(android.os.Bundle) Label(com.meisolsson.githubsdk.model.Label) ArrayList(java.util.ArrayList) BaseActivity(com.github.pockethub.android.ui.BaseActivity) Activity(android.app.Activity) ListView(android.widget.ListView) DialogAction(com.afollestad.materialdialogs.DialogAction) LayoutInflater(android.view.LayoutInflater)

Example 47 with ListView

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();
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Bundle(android.os.Bundle) Milestone(com.meisolsson.githubsdk.model.Milestone) BaseActivity(com.github.pockethub.android.ui.BaseActivity) Activity(android.app.Activity) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) DialogAction(com.afollestad.materialdialogs.DialogAction) LayoutInflater(android.view.LayoutInflater)

Example 48 with ListView

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);
        }
    }
}
Also used : AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) ExpandableListView(android.widget.ExpandableListView) TextView(android.widget.TextView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) ExpandableListView(android.widget.ExpandableListView)

Example 49 with ListView

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

Example 50 with ListView

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

Aggregations

ListView (android.widget.ListView)1139 View (android.view.View)739 AdapterView (android.widget.AdapterView)444 TextView (android.widget.TextView)389 ImageView (android.widget.ImageView)167 Intent (android.content.Intent)148 AbsListView (android.widget.AbsListView)135 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)97 ArrayAdapter (android.widget.ArrayAdapter)97 ArrayList (java.util.ArrayList)81 ViewGroup (android.view.ViewGroup)75 ListAdapter (android.widget.ListAdapter)71 OnClickListener (android.view.View.OnClickListener)65 LayoutInflater (android.view.LayoutInflater)63 Bundle (android.os.Bundle)57 Button (android.widget.Button)55 LinearLayout (android.widget.LinearLayout)50 SuppressLint (android.annotation.SuppressLint)34 DialogInterface (android.content.DialogInterface)34 ScrollView (android.widget.ScrollView)31