package fr.iutfbleau.dev41.wamster.tp06ex01_desoxyribonucleique;

import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class EventButton implements View.OnClickListener{

    private EditText output;
    private Button[] listButton;

    public EventButton(Button[] listButton, EditText output){
        this.listButton = listButton;
        this.output = output;
    }

    @Override
    public void onClick(View v){
        for (Button button : listButton) {
            if (((Button) v).equals(button)) {
                String texteBouton = ((Button) v).getText().toString();
                this.addText(texteBouton);
            }
        }
    }

    public void addText(String text){
        this.output.setText(this.output.getText()+text);
    }
}
