package epson.print.widgets;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import java.util.Vector;

public class MyAdapter extends BaseAdapter {
    private AbstractListBuilder mBuilder;

    public long getItemId(int i) {
        return (long) i;
    }

    public MyAdapter(AbstractListBuilder abstractListBuilder) {
        this.mBuilder = abstractListBuilder;
    }

    public int getCount() {
        return this.mBuilder.getData().size();
    }

    public Object getItem(int i) {
        return this.mBuilder.getData().elementAt(i);
    }

    private static class ViewHolder {
        Vector<View> views;

        private ViewHolder() {
        }
    }

    public View getView(int i, View view, ViewGroup viewGroup) {
        View view2;
        ViewHolder viewHolder;
        if (view == null) {
            viewHolder = new ViewHolder();
            view2 = this.mBuilder.buildViewHolder();
            viewHolder.views = this.mBuilder.buildViewHolderContent(view2);
            view2.setTag(viewHolder);
        } else {
            view2 = view;
            viewHolder = (ViewHolder) view.getTag();
        }
        this.mBuilder.buildViewHolderContentData(i, viewHolder.views, this.mBuilder.getData());
        return view2;
    }
}
