From 30bfd48b9ba66c1c278eb3974aa4cb6d45fda1a0 Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Mon, 29 Jan 2018 20:36:03 +0100 Subject: [PATCH] Make indicator point to bottom of bar instead of top as it looks better. --- .../com/health/openscale/gui/views/LinearGaugeView.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/android_app/app/src/main/java/com/health/openscale/gui/views/LinearGaugeView.java b/android_app/app/src/main/java/com/health/openscale/gui/views/LinearGaugeView.java index f5533044..b72dd4d1 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/views/LinearGaugeView.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/views/LinearGaugeView.java @@ -188,13 +188,12 @@ public class LinearGaugeView extends View { drawCenteredText(canvas, toText(maxValue), getWidth(), textY, textPaint); // Indicator - final float indicatorBottom = limitRect.bottom + 10.0f; + final float indicatorBottom = limitRect.bottom + 15.0f; Path path = new Path(); path.setFillType(Path.FillType.EVEN_ODD); - path.moveTo(valuePos, barTop); + path.moveTo(valuePos, barBottom); path.lineTo(valuePos + 10.0f, indicatorBottom); path.lineTo(valuePos - 10.0f, indicatorBottom); - path.lineTo(valuePos, barTop); path.close(); canvas.drawPath(path, indicatorPaint); @@ -203,7 +202,7 @@ public class LinearGaugeView extends View { final String valueStr = String.format(Locale.getDefault(), "%.2f", value); indicatorPaint.getTextBounds(valueStr, 0, valueStr.length(), bounds); drawCenteredText(canvas, valueStr, valuePos, - indicatorBottom + bounds.height() + textOffset, indicatorPaint); + indicatorBottom + bounds.height(), indicatorPaint); } @Override