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

import it.unimi.di.laren.smartwash.R;
import it.unimi.di.laren.smartwash.View.InstructionActivity;
import android.view.View;
import android.view.View.OnClickListener;

public class Instruction_Controller implements OnClickListener{
	private InstructionActivity instrActivity = null;
	
	public Instruction_Controller(InstructionActivity activity){
		instrActivity = activity;
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()){
		case R.id.arrLeft: 
			if (instrActivity.step == 1){
			}
			else if (instrActivity.step == 2){
				instrActivity.img.setImageResource(R.drawable.instr1);
				instrActivity.left.setVisibility(View.GONE);
				instrActivity.step--;
			}
			else if (instrActivity.step == 3){
				instrActivity.img.setImageResource(R.drawable.instr2);
				instrActivity.step--;
			}
			else if (instrActivity.step == 4){
				instrActivity.img.setImageResource(R.drawable.instr3);
				instrActivity.step--;
			}
			else if (instrActivity.step == 5){
				instrActivity.img.setImageResource(R.drawable.instr4);
				instrActivity.step--;
			}
			else if (instrActivity.step == 6){
				instrActivity.img.setImageResource(R.drawable.instr5);
				instrActivity.step--;
				instrActivity.right.setVisibility(View.VISIBLE);
			}
		break;
		case R.id.arrRight: 
			if (instrActivity.step == 1){
				instrActivity.img.setImageResource(R.drawable.instr2);
				instrActivity.step++;
				instrActivity.left.setVisibility(View.VISIBLE);
			}
			else if (instrActivity.step == 2){
				instrActivity.img.setImageResource(R.drawable.instr3);
				instrActivity.step++;
			}
			else if (instrActivity.step == 3){
				instrActivity.img.setImageResource(R.drawable.instr4);
				instrActivity.step++;
			}
			else if (instrActivity.step == 4){
				instrActivity.img.setImageResource(R.drawable.instr5);
				instrActivity.step++;
			}
			else if (instrActivity.step == 5){
				instrActivity.img.setImageResource(R.drawable.instr6);
				instrActivity.step++;
				instrActivity.right.setVisibility(View.GONE);
			}
			else if (instrActivity.step == 6){
			}
		break;
		
		}
		
	}
	

}
