package example.com.velezguiatour;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.MediaController;
import android.widget.TextView;
import android.widget.VideoView;

import com.google.android.gms.maps.model.LatLng;

public class OcioFullDescription extends Activity {
	String[] ocioAddress = {
			"CINESUR: Cartelera de cine " ,
			"AYUNTAMIENTO DE VELEZ MÁLAGA: Actos organizados por el consistorio",
			"AGENDA CONCIERTOS: Conciertos locales facilitados por el blog" +
					"de musica local BAMAX",
			"AQUAVELIS: Parque acuático",
			"APAÑAO SUB: Actividades submarinas",
			"KARTING DEL SOL: Actividades en karting. Para todas las edades"
			};
	LatLng[] latLangs = {
							new LatLng(36.753674, -4.099054),
			                new LatLng(36.781358, -4.104345),
							new LatLng(36.785907, -4.106578),
							new LatLng(36.752738, -4.096076),
							new LatLng(36.741188, -4.090705),
							new LatLng(36.730671, -4.120489)
						};
	
	String[] url = {
			"http://www.cinesur.com/home.php?id_cine=219",
			"http://www.velezmalaga.es/index.php?mod=juventud&tag=ocio-y-tiempo-libre",
			"http://www.bamax.es/",
			"http://www.aquavelis.es/",
			"http://paraelbuceo.com/",
			"http://www.kartingdelsol.es/"
	};
	
	VideoView vidio;
    MediaController mc;
    Uri uri;
    
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_ocio_full_description);
		final int posistion = getIntent().getExtras().getInt("id");
		TextView address = (TextView) findViewById(R.id.txtViewOcioAddress);
		address.setText(ocioAddress[posistion]);
		Button btnmap = (Button) findViewById(R.id.btnmap);
		
		ImageButton btnurl = (ImageButton) findViewById(R.id.url);
		
		btnurl.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				
				Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url[posistion]));
				startActivity(i);
			}
		});
		
		
		
		btnmap.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent i = new Intent(OcioFullDescription.this, MyMapp.class);
				i.putExtra("latlang", latLangs[posistion]);
				startActivity(i);
			}
		});
			

			OcioImageAdapter imageAdapter = new OcioImageAdapter(this);
			ImageView imageview = (ImageView) findViewById(R.id.fullImageView);
			imageview.setImageResource(imageAdapter.images[posistion]);			

		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.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.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}
}
