/**
 * 
 */
package ca.yorku.cse.mack.tiltmaze;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
//import android.widget.Button;
import android.widget.TextView;

/**
 * @author CatalinaConstantin
 * 
 */
public class ResultsActivity extends Activity
{
	final static String MYDEBUG = "MYDEBUG"; // for Log.i messages

	String block;
	int numberOfTrials;
	float time;
	float timeOffPath;
	int wallHits;
	float movementEfficiency;

	TextView blockView, numberOfTrialsView, timeView, wallHitsView, timeOffPathView, movementEfficiencyView;

	// String tripTime2, path2, numberOfTrips2, wallHits2;

	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.results);

		Bundle b = getIntent().getExtras();
		block = b.getString("block");
		numberOfTrials = b.getInt("numTrials");
		time = b.getFloat("time");
		timeOffPath = b.getFloat("timeOffPath");
		wallHits = b.getInt("wallHits");
		movementEfficiency = b.getFloat("movementEfficiency");

		init();
	}

	private void init()
	{
		blockView = (TextView)findViewById(R.id.block);
		blockView.setText(block);

		numberOfTrialsView = (TextView)findViewById(R.id.numberOfTrials);
		numberOfTrialsView.setText(String.valueOf(numberOfTrials));

		timeView = (TextView)findViewById(R.id.time);
		timeView.setText(String.format("%.1f seconds", time));

		timeOffPathView = (TextView)findViewById(R.id.path);
		timeOffPathView.setText(String.format("%.1f seconds (%.1f%%)", timeOffPath, (timeOffPath / time) * 100));

		wallHitsView = (TextView)findViewById(R.id.wallHitsValue);
		wallHitsView.setText(String.valueOf(wallHits));

		movementEfficiencyView = (TextView)findViewById(R.id.movementEfficiencyValue);
		movementEfficiencyView.setText(String.format("%.1f%%", movementEfficiency));
	}

	// Called when the "OK" button is pressed (control passes to the setup dialog)
	public void clickOK(View view)
	{
		// start setup activity
		Intent i = new Intent(getApplicationContext(), TiltMazeSetup.class);
		startActivity(i);
		finish();
	}
}
