package example.com.velezguiatour;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
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;

public class HotelFullDescription extends Activity {
	
	String[] hotelsAddress = {
			"Casa Africano, Vélez-Málaga",
			"Apartamentos Proamar, Paseo Marítimo Poniente, Torre del Mar",
			"PATIO ANDALUZ VELEZ MALAGA",
			"Hotel Avenida JC, Avenida Vivar Téllez, Vélez-Málaga",
			"Hotel Palacio Blanco, Vélez-Málaga",
			"Hotel Torremar, Torre del Mar",
			"Hotel Mainake, Torre del Mar",
			"La Casa de Las Titas, Vélez-Málaga",
			"Hotel Dila, Vélez-Málaga"
			};
	String[] url = {
			"http://www.booking.com/hotel/es/casa-africano.es.html?aid=311090;label=hotelhusamainake-yZwwH57Sd1IYEDRY1QrhfQS28568516220%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap1t1%3Aneg%3Afi%3Atiaud-146342137510%3Akwd-7233469607%3Alp1005493%3Ali%3Adec%3Adm;sid=d402b5c59502fbee75231ab21607946c;dcid=1;dist=0;group_adults=2;room1=A%2CA;sb_price_type=total;srfid=c2925d0f5d17f54b4b53c181595f2f8d60b1bb07X8;type=total;ucfs=1&",
			"http://www.booking.com/hotel/es/apartamentos-proamar.es.html?aid=311090;label=hotelhusamainake-yZwwH57Sd1IYEDRY1QrhfQS28568516220%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap1t1%3Aneg%3Afi%3Atiaud-146342137510%3Akwd-7233469607%3Alp1005493%3Ali%3Adec%3Adm;sid=d402b5c59502fbee75231ab21607946c;dcid=1;dist=0;group_adults=2;room1=A%2CA;sb_price_type=total;spdest=ci%2F-406825;spdist=4.7;srfid=c2925d0f5d17f54b4b53c181595f2f8d60b1bb07X14;type=total;ucfs=1&",
			"http://www.booking.com/hotel/es/el-patio-andaluz.es.html?aid=311090;label=hotelhusamainake-yZwwH57Sd1IYEDRY1QrhfQS28568516220%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap1t1%3Aneg%3Afi%3Atiaud-146342137510%3Akwd-7233469607%3Alp1005493%3Ali%3Adec%3Adm;sid=d402b5c59502fbee75231ab21607946c;dcid=1;dist=0;group_adults=2;room1=A%2CA;sb_price_type=total;srfid=c2925d0f5d17f54b4b53c181595f2f8d60b1bb07X13;type=total;ucfs=1&",
			"http://www.booking.com/hotel/es/avenida-velez-malaga.es.html?aid=311090;label=hotelhusamainake-yZwwH57Sd1IYEDRY1QrhfQS28568516220%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap1t1%3Aneg%3Afi%3Atiaud-146342137510%3Akwd-7233469607%3Alp1005493%3Ali%3Adec%3Adm;sid=d402b5c59502fbee75231ab21607946c;dcid=1;dist=0;group_adults=2;room1=A%2CA;sb_price_type=total;srfid=c2925d0f5d17f54b4b53c181595f2f8d60b1bb07X3;type=total;ucfs=1&",
			"http://www.booking.com/hotel/es/palacio-blanco-velez-malaga1.es.html?aid=311090;label=hotelhusamainake-yZwwH57Sd1IYEDRY1QrhfQS28568516220%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap1t1%3Aneg%3Afi%3Atiaud-146342137510%3Akwd-7233469607%3Alp1005493%3Ali%3Adec%3Adm;sid=d402b5c59502fbee75231ab21607946c;dcid=1;dist=0;group_adults=2;room1=A%2CA;sb_price_type=total;srfid=c2925d0f5d17f54b4b53c181595f2f8d60b1bb07X6;type=total;ucfs=1&",
			"http://www.booking.com/hotel/es/torremar.es.html?aid=311090;label=hotelhusamainake-yZwwH57Sd1IYEDRY1QrhfQS28568516220%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap1t1%3Aneg%3Afi%3Atiaud-146342137510%3Akwd-7233469607%3Alp1005493%3Ali%3Adec%3Adm;sid=d402b5c59502fbee75231ab21607946c;dcid=1;dist=0;group_adults=2;room1=A%2CA;sb_price_type=total;spdest=ci%2F-406825;spdist=4.0;srfid=c2925d0f5d17f54b4b53c181595f2f8d60b1bb07X17;type=total;ucfs=1&",
			"http://www.booking.com/hotel/es/hotelhusamainake.es.html?aid=311090;label=hotelhusamainake-yZwwH57Sd1IYEDRY1QrhfQS28568516220%3Apl%3",
			"http://www.booking.com/hotel/es/la-casa-de-las-titas.es.html?aid=311090;label=hotelhusamainake-yZwwH57Sd1IYEDRY1QrhfQS28568516220%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap1t1%3Aneg%3Afi%3Atiaud-146342137510%3Akwd-7233469607%3Alp1005493%3Ali%3Adec%3Adm;sid=d402b5c59502fbee75231ab21607946c;dcid=1;dist=0;group_adults=2;room1=A%2CA;sb_price_type=total;srfid=c2925d0f5d17f54b4b53c181595f2f8d60b1bb07X5;type=total;ucfs=1&",
	"http://www.booking.com/hotel/es/dila.es.html?aid=311090;label=hotelhusamainake-yZwwH57Sd1IYEDRY1QrhfQS28568516220%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap1t1%3Aneg%3Afi%3Atiaud-146342137510%3Akwd-7233469607%3Alp1005493%3Ali%3Adec%3Adm;sid=d402b5c59502fbee75231ab21607946c;dcid=4;dist=0;group_adults=2;room1=A%2CA;sb_price_type=total;srfid=c2925d0f5d17f54b4b53c181595f2f8d60b1bb07X2;type=total;ucfs=1&#availability_target",
	};

	VideoView vidio;
    MediaController mc;
    Uri uri;
    Button btnclose;
    
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_hotel_full_description);
		final int posistion = getIntent().getExtras().getInt("id");
         btnclose = (Button) findViewById(R.id.btnclose);
		TextView address = (TextView) findViewById(R.id.txtViewHotelAddress);
		address.setText(hotelsAddress[posistion]);


		btnclose.setOnClickListener(new OnClickListener() {

			 @Override
			 public void onClick(View v) {
				 LocationLoader ll = new LocationLoader();
				 ll.execute(new String[]{});
			 }
		 });

		
		

			HotelGalleryAdapter hotelGallery = new HotelGalleryAdapter(this);
			ImageView imageview = (ImageView) findViewById(R.id.fullImageView);
			imageview.setImageResource(hotelGallery.hotels[posistion]);
		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);
			}
		});
					

	}

	@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);
	}
	
	
	/**
	 * 
	 * @author BETELS
	 *
	 */
	private class LocationLoader extends AsyncTask<String, Void, String>{

		@Override
		protected String doInBackground(String... params) {
			Intent i = new Intent(HotelFullDescription.this,ClosestService.class); 
			startActivity(i);
			return null;
		}
		
	}
}
