package it.unipr.mobdev;

import it.unipr.dsg.mobdev.R;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class TopBookmarkImageAdapter extends BaseAdapter {

	private Context mContext;

	public TopBookmarkImageAdapter(Context c) {
		mContext = c;
	}

	@Override
	public int getCount() {
		return mThumbIds.length;
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView imageView;
		if (convertView == null) { 
			imageView = new ImageView(mContext);
			//imageView.setLayoutParams(new GridView.LayoutParams(50, 50));
			imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
			imageView.setPadding(8, 8, 8, 8);
		} else {
			imageView = (ImageView) convertView;
		}

		imageView.setImageResource(mThumbIds[position]);
		return imageView;
	}

	// references to our images
	private Integer[] mThumbIds = {
			R.drawable.google, R.drawable.bing,
			R.drawable.tc, R.drawable.bbc
	};

	public static String[] urlList = {
		"http://www.google.com", "http://www.bing.com",
		"http://techcrunch.com/", "http://www.bbc.com"
	};
}