// Path: autoadapter/src/main/java/com/benny/library/autoadapter/listener/DataSetChangedNotifier.java
// public interface DataSetChangedNotifier {
//     void notifyDataSetChanged();
// }
// 
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/viewcreator/IViewCreator.java
// public interface IViewCreator<T> {
//     View view(ViewGroup container);
//     int viewTypeFor(T data, int position, int itemCount);
//     int viewTypeCount();
// }
// 
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/viewholder/DataGetter.java
// public class DataGetter<T> {
//     final public T previous;
//     final public T next;
//     final public T data;
// 
//     public DataGetter(T previous, T data, T next) {
//         this.previous = previous;
//         this.next = next;
//         this.data = data;
//     }
// }
// 
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/viewholder/IViewHolder.java
// public interface IViewHolder<T> {
//     void bind(View view);
//     void onDataChange(DataGetter<T> getter, int position);
// }


import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import com.benny.library.autoadapter.listener.DataSetChangedNotifier;
import com.benny.library.autoadapter.viewcreator.IViewCreator;
import com.benny.library.autoadapter.viewholder.DataGetter;
import com.benny.library.autoadapter.viewholder.IViewHolder;
import java.util.List;
    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @SuppressWarnings("unchecked")
    @Override
    public Object instantiateItem(ViewGroup container, final int position) {
        viewCreator.viewTypeFor(getItem(position), position, getCount());
        final View itemView = viewCreator.view(container);
        container.addView(itemView);
        if(itemClickListener != null) {
            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    itemClickListener.onItemClick(null, itemView, position, 0);
                }
            });
        }

        if(itemLongClickListener != null) {
            itemView.setOnLongClickListener(new View.OnLongClickListener() {
                @Override
                public boolean onLongClick(View v) {
                    itemLongClickListener.onItemLongClick(null, itemView, position, 0);
                    return false;
                }
            });
        }

// Path: autoadapter/src/main/java/com/benny/library/autoadapter/listener/DataSetChangedNotifier.java
// public interface DataSetChangedNotifier {
//     void notifyDataSetChanged();
// }
// 
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/viewcreator/IViewCreator.java
// public interface IViewCreator<T> {
//     View view(ViewGroup container);
//     int viewTypeFor(T data, int position, int itemCount);
//     int viewTypeCount();
// }
// 
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/viewholder/DataGetter.java
// public class DataGetter<T> {
//     final public T previous;
//     final public T next;
//     final public T data;
// 
//     public DataGetter(T previous, T data, T next) {
//         this.previous = previous;
//         this.next = next;
//         this.data = data;
//     }
// }
// 
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/viewholder/IViewHolder.java
// public interface IViewHolder<T> {
//     void bind(View view);
//     void onDataChange(DataGetter<T> getter, int position);
// }


// Path: autoadapter/src/main/java/com/benny/library/autoadapter/AutoPagerAdapter.java
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import com.benny.library.autoadapter.listener.DataSetChangedNotifier;
import com.benny.library.autoadapter.viewcreator.IViewCreator;
import com.benny.library.autoadapter.viewholder.DataGetter;
import com.benny.library.autoadapter.viewholder.IViewHolder;
import java.util.List;

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @SuppressWarnings("unchecked")
    @Override
    public Object instantiateItem(ViewGroup container, final int position) {
        viewCreator.viewTypeFor(getItem(position), position, getCount());
        final View itemView = viewCreator.view(container);
        container.addView(itemView);
        if(itemClickListener != null) {
            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    itemClickListener.onItemClick(null, itemView, position, 0);
                }
            });
        }

        if(itemLongClickListener != null) {
            itemView.setOnLongClickListener(new View.OnLongClickListener() {
                @Override
                public boolean onLongClick(View v) {
                    itemLongClickListener.onItemLongClick(null, itemView, position, 0);
                    return false;
                }
            });
        }

        ((IViewHolder<T>)itemView.getTag()).onDataChange(new DataGetter<T>(getItem(position - 1), getItem(position), getItem(position + 1)), position);