package app.brest.app.brest.ui;

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.widget.Button;

/**
 * Created by ptitcois on 23/10/16.
 */
public class RotateButton extends Button {
    private float mAngle = 45;
    public RotateButton(Context context) {
        super(context);
    }


    public RotateButton(Context context, float angle) {
        super(context);
        mAngle=angle;
    }

    public RotateButton(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        canvas.save();
        canvas.rotate(mAngle, getWidth() / 2, getHeight() / 2);
        super.onDraw(canvas);
        canvas.restore();
    }

    public float getAngle() {
        return mAngle;
    }

    public void setAngle(float mAngle) {
        this.mAngle = mAngle;
    }
}