package it.unimi.di.laren.smartwash.Controller;

import it.unimi.di.laren.smartwash.R;
import it.unimi.di.laren.smartwash.View.GraphActivity;
import it.unimi.di.laren.smartwash.View.SubmitActivity;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;

public class Submit_Controller implements OnClickListener{
	private SubmitActivity subActivity = null;

	public Submit_Controller(SubmitActivity activity) {
		// TODO Auto-generated constructor stub
		subActivity = activity;
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.MoreBtn:
			Intent showMore = new Intent(Intent.ACTION_VIEW);
	        showMore.setData(Uri.parse("http://mockup.laren.dsi.unimi.it:8080/Rules/index.html"));
	        subActivity.startActivity(showMore);
			break;
		case R.id.RangeBtn:
			String range = "null";
			range = subActivity.returnRange();
			Log.i("range", ":" + range);
			Intent showGraph = new Intent(subActivity.getApplicationContext(),
					GraphActivity.class);
			showGraph.putExtra("RANGE", range);
			subActivity.startActivity(showGraph);
			break;

		default:
			break;
		}
		
	}

}
