package com.manubet.android.touristAndroid;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.drawable.Drawable;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

public class PlacesOverlay extends ItemizedOverlay<OverlayItem> {


		private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
		private Context context;

		public PlacesOverlay(Drawable defaultMarker, Context context) {
			super(boundCenterBottom(defaultMarker));
			this.context = context;
		}

		public void updateOverlay(OverlayItem overlay) {
			mOverlays.clear();
			mOverlays.add(overlay);
			populate();
		}
		public void addOverlay(OverlayItem overlay) {
			mOverlays.add(overlay);
			populate();
		}

		@Override
		protected OverlayItem createItem(int i) {
			return (OverlayItem) mOverlays.get(i);
		}

		@Override
		public int size() {
			return mOverlays.size();
		}

		@Override
		protected boolean onTap(int i) {
			InfoDialog customizeDialog = new InfoDialog(context,InfoProvider.getPlaces().get(i));
			customizeDialog.show();
			return true;
		}

		public Context getContext() {
			return context;
		}
		public void setContext(Context context) {
			this.context = context;
		}

	


}
