From 39c5278b3725b3701b1211d03e64768a42a319f1 Mon Sep 17 00:00:00 2001 From: viktoria Date: Sat, 26 Nov 2016 20:53:00 +0100 Subject: [PATCH] wear axis in bright mode fix --- .../nightscout/androidaps/BgGraphBuilder.java | 27 +++++++++++++++---- wear/src/main/res/values/colors.xml | 12 ++++++--- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/wear/src/main/java/info/nightscout/androidaps/BgGraphBuilder.java b/wear/src/main/java/info/nightscout/androidaps/BgGraphBuilder.java index 8dff9b82bd..3e3391aa0b 100644 --- a/wear/src/main/java/info/nightscout/androidaps/BgGraphBuilder.java +++ b/wear/src/main/java/info/nightscout/androidaps/BgGraphBuilder.java @@ -1,7 +1,6 @@ package info.nightscout.androidaps; import android.content.Context; -import android.graphics.Color; import android.graphics.DashPathEffect; import android.preference.PreferenceManager; import android.support.v4.content.ContextCompat; @@ -49,6 +48,7 @@ public class BgGraphBuilder { private List lowValues = new ArrayList(); public Viewport viewport; + public BgGraphBuilder(Context context, List aBgList, List tempWatchDataList, ArrayList basalWatchDataList, int aPointSize, int aMidColor, int timespan) { end_time = new Date().getTime() + (1000 * 60 * 6 * timespan); //Now plus 30 minutes padding (for 5 hours. Less if less.) start_time = new Date().getTime() - (1000 * 60 * 60 * timespan); //timespan hours ago @@ -190,6 +190,7 @@ public class BgGraphBuilder { Line inRangeValuesLine = new Line(inRangeValues); inRangeValuesLine.setColor(midColor); if(singleLine) { + inRangeValuesLine.setHasLines(true); inRangeValuesLine.setHasLines(true); inRangeValuesLine.setHasPoints(false); inRangeValuesLine.setStrokeWidth(pointSize); @@ -283,14 +284,23 @@ public class BgGraphBuilder { } /////////AXIS RELATED////////////// + + public Axis yAxis() { Axis yAxis = new Axis(); yAxis.setAutoGenerated(true); List axisValues = new ArrayList(); yAxis.setValues(axisValues); yAxis.setHasLines(false); - yAxis.setLineColor(ContextCompat.getColor(context, R.color.yaxis_gridline)); - yAxis.setTextColor(ContextCompat.getColor(context, R.color.yaxis_txt)); + boolean themecolor = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("dark", true); + if (themecolor) { + yAxis.setLineColor(ContextCompat.getColor(context, R.color.yaxis_gridline_dark)); + yAxis.setTextColor(ContextCompat.getColor(context, R.color.yaxis_txt_dark)); + } + else { + yAxis.setLineColor(ContextCompat.getColor(context, R.color.yaxis_gridline_light)); + yAxis.setTextColor(ContextCompat.getColor(context, R.color.yaxis_txt_light)); + } return yAxis; } @@ -331,8 +341,15 @@ public class BgGraphBuilder { xAxis.setValues(xAxisValues); xAxis.setTextSize(10); xAxis.setHasLines(true); - xAxis.setLineColor(ContextCompat.getColor(context, R.color.xaxis_gridline)); - xAxis.setTextColor(ContextCompat.getColor(context, R.color.xaxis_txt)); + boolean themecolor = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("dark", true); + if (themecolor) { + xAxis.setLineColor(ContextCompat.getColor(context, R.color.xaxis_gridline_dark)); + xAxis.setTextColor(ContextCompat.getColor(context, R.color.xaxis_txt_dark)); + } + else { + xAxis.setLineColor(ContextCompat.getColor(context, R.color.xaxis_gridline_light)); + xAxis.setTextColor(ContextCompat.getColor(context, R.color.xaxis_txt_light)); + } return xAxis; } diff --git a/wear/src/main/res/values/colors.xml b/wear/src/main/res/values/colors.xml index 372c343b44..dec14192d0 100644 --- a/wear/src/main/res/values/colors.xml +++ b/wear/src/main/res/values/colors.xml @@ -41,10 +41,14 @@ @color/grey_50 - @color/grey_50 - @color/grey_50 - @color/grey_50 - @color/grey_50 + @color/grey_50 + @color/grey_50 + @color/grey_50 + @color/grey_50 + @color/black + @color/black + @color/black + @color/black @color/blue_300