package fr.iutfbleau.dev45.wamster.tp05ex02_arcenciel;

import android.content.Intent;
import android.view.View;
import android.widget.CheckBox;

public class EvenementBoutonValider implements View.OnClickListener {

    private Activite2 activite2;

    public EvenementBoutonValider(Activite2 activite2){
        this.activite2 = activite2;
    }

    @Override
    public void onClick(View v){
        boolean[] etatCoche = this.getEtatCoche();
        Intent intention = new Intent(this.activite2, MainActivity.class);
        this.activite2.startActivity(intention);
    }

    public boolean[] getEtatCoche(){
        CheckBox[] listeCoche = this.activite2.getListeCoche();
        boolean[] listeEtatCoche = new boolean[listeCoche.length];
        int i;
        for (i=0; i<listeEtatCoche.length; i++){
            listeEtatCoche[i] = listeCoche[i].isChecked();
        }
        return listeEtatCoche;
    }
}
