TunerView.java (838B)
1 package com.github.cythara; 2 3 import android.content.Context; 4 import android.graphics.Canvas; 5 import android.util.AttributeSet; 6 import android.view.View; 7 8 public class TunerView extends View { 9 10 private CanvasPainter canvasPainter; 11 private PitchDifference pitchDifference; 12 13 public TunerView(Context context) { 14 super(context); 15 canvasPainter = CanvasPainter.with(getContext()); 16 } 17 18 public TunerView(Context context, AttributeSet attrs) { 19 super(context, attrs); 20 canvasPainter = CanvasPainter.with(getContext()); 21 } 22 23 @Override 24 public void onDraw(Canvas canvas) { 25 super.onDraw(canvas); 26 canvasPainter.paint(pitchDifference).on(canvas); 27 } 28 29 public void setPitchDifference(PitchDifference pitchDifference) { 30 this.pitchDifference = pitchDifference; 31 } 32 }