commit 5c27c6d8726a3c4bb836b519ddf49b3ff7e0d678
parent 7728e6afb9fc7bedaacb9a85f5e216a0ac7d18dd
Author: gstraube <gstraube@mailbox.org>
Date: Sat, 8 Jul 2017 21:03:42 +0200
Move code into method
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/src/main/java/com/github/cythara/TunerView.java b/app/src/main/java/com/github/cythara/TunerView.java
@@ -35,12 +35,6 @@ public class TunerView extends View {
float y = canvas.getHeight() / 2F;
if (pitchDifference != null) {
- int color = Color.RED;
- if (pitchDifference.deviation <= MAX_ALLOWED_DEVIATION) {
- color = Color.GREEN;
- }
- background.setColor(color);
-
setBackground(canvas);
canvas.drawText(pitchDifference.closest.name(), x, y, paint);
@@ -48,6 +42,12 @@ public class TunerView extends View {
}
private void setBackground(Canvas canvas) {
+ int color = Color.RED;
+ if (pitchDifference.deviation <= MAX_ALLOWED_DEVIATION) {
+ color = Color.GREEN;
+ }
+ background.setColor(color);
+
background.setStyle(Paint.Style.FILL);
background.setAlpha(70);