package viewbg;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.SimpleAdapter;

public class EventItemAdapter extends SimpleAdapter{

	private Context context;
	private List<EventItem> items;
	private int eIconId;
	private ArrayList<Integer> e_idres;

	public EventItemAdapter(Context context, List data,  
			               int resource, String[] from, int[] to,  
			                int iconId,ArrayList<Integer> idres) {
		super(context,data,resource,from,to);
		// TODO Auto-generated constructor stub
		this.context=context;
		this.items=data;
		this.eIconId=iconId;
		this.e_idres=idres;
		
	}

	
	
	public int getCount() {
		// TODO Auto-generated method stub
		return super.getCount();
	}

	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return super.getItem(position);
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return super.getItemId(position);
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		/*
		 * EventItemView eiv;
		if(convertView==null)
		{
			String[] event_attr=new String[]{items.get(position).getName(),items.get(position).getTime(),items.get(position).getAddr()};
			eiv=new EventItemView(context,event_attr,items.get(position).getImg());
		}
		else
		{
			eiv=(EventItemView)convertView;
			eiv.setName(items.get(position).getName());
			eiv.setTime(items.get(position).getTime());
			eiv.setAddr(items.get(position).getAddr());
			eiv.setImg(items.get(position).getImg());
		}
		
		return eiv;
		*/
		View v=super.getView(position, convertView, parent);
		ImageView img=(ImageView)v.findViewById(eIconId);
		img.setImageResource(e_idres.get(position));
		return v;
		
	}
	


}
