package fr.iutfbleau.dev45.wamster.tp04ex03_dimension;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;

public class Rectangle extends View {
    public static int BLEU = 0;
    public static int ROUGE = 1;
    private static int[] couleur = {0xff77b5fe, 0xfffe1b00};
    private static int etat;
    public Rectangle(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.etat = Rectangle.BLEU;
        this.setBackgroundColor(Rectangle.couleur[this.etat]);
    }

    public int getEtat(){
        return this.etat;
    }

    public void toggleEtat(){
        this.etat = (this.etat+1)%Rectangle.couleur.length;
        this.setBackgroundColor(Rectangle.couleur[this.etat]);
    }
}
