package example.com.velezguiatour;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;

import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

public class MyMapp extends Activity {
	Button mapJ, mapf, mapr;
	private GoogleMap map;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_my_mapp);

		map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
				.getMap();
		map.setMapType(GoogleMap.MAP_TYPE_NORMAL);

		LatLng latLang = getIntent().getExtras().getParcelable("latlang");
		map.addMarker(new MarkerOptions().position(latLang).title(
				"find me here"));
		CameraUpdate update = CameraUpdateFactory.newLatLngZoom(latLang, 12);
		map.animateCamera(update);

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;

	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.

		//Aqui se modifica el action bar para que se puedan seleccionar los difrentes tipos de mapas
		switch (item.getItemId()) {
			case R.id.Hibrido:
				map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
				return true;

			case R.id.Satelital:
				map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
				return true;

			case R.id.Terreno:
				map.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
				return true;
			case R.id.Normal:
				map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
				return true;
			case R.id.Ninguno:
				map.setMapType(GoogleMap.MAP_TYPE_NONE);
				return true;
			default:


				return super.onOptionsItemSelected(item);
		}


	}
}
