Android Open Source - dialogplus List Holder






From Project

Back to project page dialogplus.

License

The source code is released under:

Apache License

If you think the Android project dialogplus listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.orhanobut.dialogplus;
//from   w  w w. ja v  a2 s.c om
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;


/**
 * @author Orhan Obut
 */
public class ListHolder implements Holder, AdapterView.OnItemClickListener {

    private ListView listView;
    private OnItemClickListener listener;

    @Override
    public void addHeader(View view) {
        if (view == null) {
            return;
        }
        listView.addHeaderView(view);
    }

    @Override
    public void addFooter(View view) {
        if (view == null) {
            return;
        }
        listView.addFooterView(view);
    }

    @Override
    public void setAdapter(BaseAdapter adapter) {
        listView.setAdapter(adapter);
    }

    @Override
    public View getView(LayoutInflater inflater, ViewGroup parent) {
        View view = inflater.inflate(R.layout.dialog_list, parent, false);
        listView = (ListView) view.findViewById(R.id.list);
        listView.setOnItemClickListener(this);
        return view;
    }

    @Override
    public void setOnItemClickListener(OnItemClickListener listener) {
        this.listener = listener;
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        listener.onItemClick(parent.getItemAtPosition(position), view, position);
    }
}




Java Source Code List

com.orhanobut.android.dialogplus.ApplicationTest.java
com.orhanobut.android.dialogplussample.ApplicationTest.java
com.orhanobut.android.dialogplussample.MainActivity.java
com.orhanobut.dialogplus.BasicHolder.java
com.orhanobut.dialogplus.DialogPlus.java
com.orhanobut.dialogplus.GridHolder.java
com.orhanobut.dialogplus.Holder.java
com.orhanobut.dialogplus.ListHolder.java
com.orhanobut.dialogplus.OnItemClickListener.java
com.orhanobut.dialogplus.SimpleListView.java