wear highlight basals
This commit is contained in:
parent
95432e35e0
commit
d8f4de8b22
4 changed files with 39 additions and 32 deletions
|
@ -322,7 +322,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
|
||||||
mTimestamp.setText(readingAge(true));
|
mTimestamp.setText(readingAge(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean showStatus = sharedPrefs.getBoolean("showExternalStatus", false);
|
boolean showStatus = sharedPrefs.getBoolean("showExternalStatus", true);
|
||||||
|
|
||||||
|
|
||||||
if(showStatus){
|
if(showStatus){
|
||||||
|
@ -556,7 +556,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
|
||||||
|
|
||||||
public void setupCharts() {
|
public void setupCharts() {
|
||||||
if(bgDataList.size() > 0) { //Dont crash things just because we dont have values, people dont like crashy things
|
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) {
|
if (singleLine) {
|
||||||
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, tempWatchDataList, basalWatchDataList, pointSize, midColor, timeframe);
|
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, tempWatchDataList, basalWatchDataList, pointSize, midColor, timeframe);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -267,7 +267,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
||||||
|| (sharedPrefs.getBoolean("showRawNoise", true)
|
|| (sharedPrefs.getBoolean("showRawNoise", true)
|
||||||
&& sgvString.equals("???"));
|
&& sgvString.equals("???"));
|
||||||
|
|
||||||
boolean showStatus = sharedPrefs.getBoolean("showExternalStatus", false);
|
boolean showStatus = sharedPrefs.getBoolean("showExternalStatus", true);
|
||||||
|
|
||||||
if(showRaw || showStatus){
|
if(showRaw || showStatus){
|
||||||
//use short forms
|
//use short forms
|
||||||
|
@ -374,7 +374,7 @@ protected abstract void setColorDark();
|
||||||
|
|
||||||
public void setupCharts() {
|
public void setupCharts() {
|
||||||
if(bgDataList.size() > 0) { //Dont crash things just because we dont have values, people dont like crashy things
|
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) {
|
if (singleLine) {
|
||||||
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, new ArrayList<TempWatchData>(), new ArrayList<BasalWatchData>(), pointSize, midColor, timeframe);
|
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, new ArrayList<TempWatchData>(), new ArrayList<BasalWatchData>(), pointSize, midColor, timeframe);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.DashPathEffect;
|
import android.graphics.DashPathEffect;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@ -125,18 +126,26 @@ public class BgGraphBuilder {
|
||||||
double factor = (maxChart-minChart)/maxTemp;
|
double factor = (maxChart-minChart)/maxTemp;
|
||||||
// in case basal is the highest, don't paint it totally at the top.
|
// in case basal is the highest, don't paint it totally at the top.
|
||||||
factor = Math.min(factor, ((maxChart-minChart)/maxBasal)*(2/3d));
|
factor = Math.min(factor, ((maxChart-minChart)/maxBasal)*(2/3d));
|
||||||
|
|
||||||
|
boolean highlight = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context)
|
||||||
|
.getBoolean("highlight_basals", false);
|
||||||
|
|
||||||
for (TempWatchData twd: tempWatchDataList) {
|
for (TempWatchData twd: tempWatchDataList) {
|
||||||
if(twd.endTime > start_time) {
|
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;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Line basalLine(float offset, double factor) {
|
private Line basalLine(float offset, double factor, boolean highlight) {
|
||||||
|
|
||||||
List<PointValue> pointValues = new ArrayList<PointValue>();
|
List<PointValue> pointValues = new ArrayList<PointValue>();
|
||||||
|
|
||||||
|
@ -152,7 +161,7 @@ public class BgGraphBuilder {
|
||||||
basalLine.setHasPoints(false);
|
basalLine.setHasPoints(false);
|
||||||
basalLine.setColor(Color.parseColor("#00BFFF"));
|
basalLine.setColor(Color.parseColor("#00BFFF"));
|
||||||
basalLine.setPathEffect(new DashPathEffect(new float[]{4f, 3f}, 4f));
|
basalLine.setPathEffect(new DashPathEffect(new float[]{4f, 3f}, 4f));
|
||||||
basalLine.setStrokeWidth(1);
|
basalLine.setStrokeWidth(highlight?2:1);
|
||||||
return basalLine;
|
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>();
|
List<PointValue> lineValues = new ArrayList<PointValue>();
|
||||||
long begin = (long) Math.max(start_time, twd.startTime);
|
long begin = (long) Math.max(start_time, twd.startTime);
|
||||||
lineValues.add(new PointValue(fuzz(begin), offset + (float) (factor * twd.startBasal)));
|
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)));
|
lineValues.add(new PointValue(fuzz(twd.endTime), offset + (float) (factor * twd.endBasal)));
|
||||||
Line valueLine = new Line(lineValues);
|
Line valueLine = new Line(lineValues);
|
||||||
valueLine.setHasPoints(false);
|
valueLine.setHasPoints(false);
|
||||||
valueLine.setColor(Color.BLUE);
|
if (isHighlightLine){
|
||||||
valueLine.setStrokeWidth(1);
|
valueLine.setColor(Color.parseColor("#00BFFF"));
|
||||||
valueLine.setFilled(true);
|
valueLine.setStrokeWidth(1);
|
||||||
|
}else {
|
||||||
|
valueLine.setColor(Color.BLUE);
|
||||||
|
valueLine.setStrokeWidth(strokeWidth);
|
||||||
|
valueLine.setFilled(true);
|
||||||
|
}
|
||||||
return valueLine;
|
return valueLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,26 +5,9 @@
|
||||||
android:key="category"
|
android:key="category"
|
||||||
android:selectable="false">
|
android:selectable="false">
|
||||||
|
|
||||||
<CheckBoxPreference android:title="Dark"
|
<CheckBoxPreference android:title="Show Loop Status"
|
||||||
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 ???"
|
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:summary="Show Raw on ???."
|
android:summary="Show Loop Staus (Temps and IOB)."
|
||||||
android:key="showRawNoise" />
|
|
||||||
-->
|
|
||||||
|
|
||||||
<CheckBoxPreference android:title="Show External Status"
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:summary="Show External Staus (HAPP e.g.)."
|
|
||||||
android:key="showExternalStatus" />
|
android:key="showExternalStatus" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
|
@ -33,7 +16,17 @@
|
||||||
android:summary="Chart Timeframe"
|
android:summary="Chart Timeframe"
|
||||||
android:entries="@array/chart_timeframe"
|
android:entries="@array/chart_timeframe"
|
||||||
android:entryValues="@array/chart_timeframe_values"
|
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"
|
<CheckBoxPreference android:title="Show Ago"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
|
|
Loading…
Reference in a new issue