package party.bami.eqfix;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Toast;

import java.util.Arrays;
import java.util.Vector;

public class EQView extends View {
    private float bass;
    private float mid;
    private float treble;

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

    private void init() {
        bass = 0.0f;
        mid = 0.0f;
        treble = 0.0f;
    }

    public void updateView(float bass, float mid, float treble) {
        this.bass = bass;
        this.mid = mid;
        this.treble = treble;
        System.out.println(bass + " " + mid + " " + treble);
        invalidate();
    }


    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        Paint pnt = new Paint();
        pnt.setARGB(255, 40, 40, 255);
        pnt.setStrokeWidth(10);

        canvas.drawLine(10, this.bass * (getHeight() / 2) + (getHeight() / 2),
                getWidth() / 2, this.mid * (getHeight() / 2) + (getHeight() / 2), pnt);
        canvas.drawLine(getWidth() / 2, this.mid * (getHeight() / 2) + (getHeight() / 2),
                getWidth() - 10, this.treble * (getHeight() / 2) + (getHeight() / 2), pnt);

    }
}