wear highlight basals

This commit is contained in:
AdrianLxM 2016-11-20 02:31:15 +01:00
parent 95432e35e0
commit d8f4de8b22
4 changed files with 39 additions and 32 deletions

View file

@ -322,7 +322,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
mTimestamp.setText(readingAge(true));
}
boolean showStatus = sharedPrefs.getBoolean("showExternalStatus", false);
boolean showStatus = sharedPrefs.getBoolean("showExternalStatus", true);
if(showStatus){
@ -556,7 +556,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
public void setupCharts() {
if(bgDataList.size() > 0) { //Dont crash things just because we dont have values, people dont like crashy things
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "5"));
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
if (singleLine) {
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, tempWatchDataList, basalWatchDataList, pointSize, midColor, timeframe);
} else {

View file

@ -267,7 +267,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|| (sharedPrefs.getBoolean("showRawNoise", true)
&& sgvString.equals("???"));
boolean showStatus = sharedPrefs.getBoolean("showExternalStatus", false);
boolean showStatus = sharedPrefs.getBoolean("showExternalStatus", true);
if(showRaw || showStatus){
//use short forms
@ -374,7 +374,7 @@ protected abstract void setColorDark();
public void setupCharts() {
if(bgDataList.size() > 0) { //Dont crash things just because we dont have values, people dont like crashy things
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "5"));
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
if (singleLine) {
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, new ArrayList<TempWatchData>(), new ArrayList<BasalWatchData>(), pointSize, midColor, timeframe);
} else {

View file

@ -3,6 +3,7 @@ package info.nightscout.androidaps;
import android.content.Context;
import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.preference.PreferenceManager;
import android.text.format.DateFormat;
import java.text.SimpleDateFormat;
@ -125,18 +126,26 @@ public class BgGraphBuilder {
double factor = (maxChart-minChart)/maxTemp;
// in case basal is the highest, don't paint it totally at the top.
factor = Math.min(factor, ((maxChart-minChart)/maxBasal)*(2/3d));
boolean highlight = PreferenceManager
.getDefaultSharedPreferences(context)
.getBoolean("highlight_basals", false);
for (TempWatchData twd: tempWatchDataList) {
if(twd.endTime > start_time) {
lines.add(tempValuesLine(twd, (float) minChart, factor));
lines.add(tempValuesLine(twd, (float) minChart, factor, false, highlight?3:2));
if(highlight){
lines.add(tempValuesLine(twd, (float) minChart, factor, true, 1));
}
}
}
lines.add(basalLine((float) minChart, factor));
lines.add(basalLine((float) minChart, factor, highlight));
return lines;
}
private Line basalLine(float offset, double factor) {
private Line basalLine(float offset, double factor, boolean highlight) {
List<PointValue> pointValues = new ArrayList<PointValue>();
@ -152,7 +161,7 @@ public class BgGraphBuilder {
basalLine.setHasPoints(false);
basalLine.setColor(Color.parseColor("#00BFFF"));
basalLine.setPathEffect(new DashPathEffect(new float[]{4f, 3f}, 4f));
basalLine.setStrokeWidth(1);
basalLine.setStrokeWidth(highlight?2:1);
return basalLine;
@ -192,7 +201,7 @@ public class BgGraphBuilder {
}
public Line tempValuesLine(TempWatchData twd, float offset, double factor) {
public Line tempValuesLine(TempWatchData twd, float offset, double factor, boolean isHighlightLine, int strokeWidth) {
List<PointValue> lineValues = new ArrayList<PointValue>();
long begin = (long) Math.max(start_time, twd.startTime);
lineValues.add(new PointValue(fuzz(begin), offset + (float) (factor * twd.startBasal)));
@ -201,9 +210,14 @@ public class BgGraphBuilder {
lineValues.add(new PointValue(fuzz(twd.endTime), offset + (float) (factor * twd.endBasal)));
Line valueLine = new Line(lineValues);
valueLine.setHasPoints(false);
valueLine.setColor(Color.BLUE);
valueLine.setStrokeWidth(1);
valueLine.setFilled(true);
if (isHighlightLine){
valueLine.setColor(Color.parseColor("#00BFFF"));
valueLine.setStrokeWidth(1);
}else {
valueLine.setColor(Color.BLUE);
valueLine.setStrokeWidth(strokeWidth);
valueLine.setFilled(true);
}
return valueLine;
}

View file

@ -5,26 +5,9 @@
android:key="category"
android:selectable="false">
<CheckBoxPreference android:title="Dark"
android:defaultValue="true"
android:summary="Dark theme"
android:key="dark" />
<!-- TODO: reenable raw
<CheckBoxPreference android:title="Show Raw"
android:defaultValue="false"
android:summary="Show Raw."
android:key="showRaw" />
<CheckBoxPreference android:title="Show Raw on ???"
<CheckBoxPreference android:title="Show Loop Status"
android:defaultValue="true"
android:summary="Show Raw on ???."
android:key="showRawNoise" />
-->
<CheckBoxPreference android:title="Show External Status"
android:defaultValue="false"
android:summary="Show External Staus (HAPP e.g.)."
android:summary="Show Loop Staus (Temps and IOB)."
android:key="showExternalStatus" />
<ListPreference
@ -33,7 +16,17 @@
android:summary="Chart Timeframe"
android:entries="@array/chart_timeframe"
android:entryValues="@array/chart_timeframe_values"
android:defaultValue="5" />
android:defaultValue="3" />
<CheckBoxPreference android:title="Highlight Basals"
android:defaultValue="false"
android:summary="Better visible basal rate and temp basals"
android:key="highlight_basals" />
<CheckBoxPreference android:title="Dark"
android:defaultValue="true"
android:summary="Dark theme"
android:key="dark" />
<CheckBoxPreference android:title="Show Ago"
android:defaultValue="true"