wear axis in bright mode fix

This commit is contained in:
viktoria 2016-11-26 20:53:00 +01:00 committed by AdrianLxM
parent a32c3ef15e
commit 39c5278b37
2 changed files with 30 additions and 9 deletions

View file

@ -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<PointValue> lowValues = new ArrayList<PointValue>();
public Viewport viewport;
public BgGraphBuilder(Context context, List<BgWatchData> aBgList, List<TempWatchData> tempWatchDataList, ArrayList<BasalWatchData> 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<AxisValue> axisValues = new ArrayList<AxisValue>();
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;
}

View file

@ -41,10 +41,14 @@
<color name="dark_midColor">@color/grey_50</color>
<!-- graph colors -->
<color name="xaxis_gridline">@color/grey_50</color>
<color name="xaxis_txt">@color/grey_50</color>
<color name="yaxis_gridline">@color/grey_50</color>
<color name="yaxis_txt">@color/grey_50</color>
<color name="xaxis_gridline_dark">@color/grey_50</color>
<color name="xaxis_txt_dark">@color/grey_50</color>
<color name="yaxis_gridline_dark">@color/grey_50</color>
<color name="yaxis_txt_dark">@color/grey_50</color>
<color name="xaxis_gridline_light">@color/black</color>
<color name="xaxis_txt_light">@color/black</color>
<color name="yaxis_gridline_light">@color/black</color>
<color name="yaxis_txt_light">@color/black</color>
<!-- basal colors -->
<color name="basalLine_primary">@color/blue_300</color>