#1851 included code from fra-orolo, now using color identifier for activity and line is optional in graph

This commit is contained in:
Paulus 2019-07-09 11:42:40 +02:00
parent 4b5189403c
commit 4ff9206dad
4 changed files with 17 additions and 4 deletions

View file

@ -197,7 +197,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
Handler sLoopHandler = new Handler(); Handler sLoopHandler = new Handler();
Runnable sRefreshLoop = null; Runnable sRefreshLoop = null;
public enum CHARTTYPE {PRE, BAS, IOB, COB, DEV, SEN, DEVSLOPE} public enum CHARTTYPE {PRE, BAS, IOB, COB, DEV, SEN, ACT, DEVSLOPE}
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor(); private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
private static ScheduledFuture<?> scheduledUpdate = null; private static ScheduledFuture<?> scheduledUpdate = null;
@ -413,6 +413,14 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
item.setCheckable(true); item.setCheckable(true);
item.setChecked(SP.getBoolean("showratios", false)); item.setChecked(SP.getBoolean("showratios", false));
item = popup.getMenu().add(Menu.NONE, CHARTTYPE.ACT.ordinal(), Menu.NONE, MainApp.gs(R.string.overview_show_activity));
title = item.getTitle();
s = new SpannableString(title);
s.setSpan(new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.activity, null)), 0, s.length(), 0);
item.setTitle(s);
item.setCheckable(true);
item.setChecked(SP.getBoolean("showactivity", true));
if (MainApp.devBranch) { if (MainApp.devBranch) {
item = popup.getMenu().add(Menu.NONE, CHARTTYPE.DEVSLOPE.ordinal(), Menu.NONE, "Deviation slope"); item = popup.getMenu().add(Menu.NONE, CHARTTYPE.DEVSLOPE.ordinal(), Menu.NONE, "Deviation slope");
title = item.getTitle(); title = item.getTitle();
@ -438,6 +446,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
SP.putBoolean("showdeviations", !item.isChecked()); SP.putBoolean("showdeviations", !item.isChecked());
} else if (item.getItemId() == CHARTTYPE.SEN.ordinal()) { } else if (item.getItemId() == CHARTTYPE.SEN.ordinal()) {
SP.putBoolean("showratios", !item.isChecked()); SP.putBoolean("showratios", !item.isChecked());
} else if (item.getItemId() == CHARTTYPE.ACT.ordinal()) {
SP.putBoolean("showactivity", !item.isChecked());
} else if (item.getItemId() == CHARTTYPE.DEVSLOPE.ordinal()) { } else if (item.getItemId() == CHARTTYPE.DEVSLOPE.ordinal()) {
SP.putBoolean("showdevslope", !item.isChecked()); SP.putBoolean("showdevslope", !item.isChecked());
} }
@ -1523,8 +1533,9 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
// set manual x bounds to have nice steps // set manual x bounds to have nice steps
graphData.formatAxis(fromTime, endTime); graphData.formatAxis(fromTime, endTime);
// insulin activity if(SP.getBoolean("showactivity", true)) {
graphData.addActivity(fromTime, endTime, graphData.maxY); graphData.addActivity(fromTime, endTime, graphData.maxY);
}
// Treatments // Treatments
graphData.addTreatments(fromTime, endTime); graphData.addTreatments(fromTime, endTime);

View file

@ -367,7 +367,7 @@ public class GraphData {
actData = actArray.toArray(actData); actData = actArray.toArray(actData);
actSeries = new FixedLineGraphSeries<>(actData); actSeries = new FixedLineGraphSeries<>(actData);
actSeries.setDrawBackground(false); actSeries.setDrawBackground(false);
actSeries.setColor(MainApp.gc(R.color.mdtp_white)); actSeries.setColor(MainApp.gc(R.color.activity));
actSeries.setThickness(3); actSeries.setThickness(3);
actScale.setMultiplier(scale / 0.04d); //TODO for clarity should be fixed scale, but what max? For now 0.04d seems reasonable. actScale.setMultiplier(scale / 0.04d); //TODO for clarity should be fixed scale, but what max? For now 0.04d seems reasonable.

View file

@ -9,6 +9,7 @@
<color name="uam">#c9bd60</color> <color name="uam">#c9bd60</color>
<color name="zt">#00d2d2</color> <color name="zt">#00d2d2</color>
<color name="ratio">#FFFFFF</color> <color name="ratio">#FFFFFF</color>
<color name="activity">#d3f166</color>
<color name="devslopepos">#FFFFFF00</color> <color name="devslopepos">#FFFFFF00</color>
<color name="devslopeneg">#FFFF00FF</color> <color name="devslopeneg">#FFFF00FF</color>
<color name="inrange">#00FF00</color> <color name="inrange">#00FF00</color>

View file

@ -1001,6 +1001,7 @@
<string name="ns_autobackfill_summary">Autobackfill missig BGs from NS</string> <string name="ns_autobackfill_summary">Autobackfill missig BGs from NS</string>
<string name="key_ns_autobackfill" translatable="false">ns_autobackfill</string> <string name="key_ns_autobackfill" translatable="false">ns_autobackfill</string>
<string name="loop_smbsetbypump_label">SMB set by pump</string> <string name="loop_smbsetbypump_label">SMB set by pump</string>
<string name="overview_show_activity">Activity</string>
<string name="overview_show_sensitivity">Sensitivity</string> <string name="overview_show_sensitivity">Sensitivity</string>
<string name="overview_show_deviations">Deviations</string> <string name="overview_show_deviations">Deviations</string>
<string name="overview_show_cob">Carbs On Board</string> <string name="overview_show_cob">Carbs On Board</string>