IobCobCalculatorPlugin as a param for GraphData
This commit is contained in:
parent
0ab2d5ba38
commit
a6a937ba20
4 changed files with 16 additions and 6 deletions
|
@ -21,6 +21,7 @@ import butterknife.OnLongClick;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Overview.graphData.GraphData;
|
import info.nightscout.androidaps.plugins.Overview.graphData.GraphData;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
|
@ -56,6 +57,12 @@ public class HistoryBrowseActivity extends AppCompatActivity {
|
||||||
private int rangeToDisplay = 24; // for graph
|
private int rangeToDisplay = 24; // for graph
|
||||||
private long start;
|
private long start;
|
||||||
|
|
||||||
|
IobCobCalculatorPlugin iobCobCalculatorPlugin;
|
||||||
|
|
||||||
|
public HistoryBrowseActivity() {
|
||||||
|
iobCobCalculatorPlugin = new IobCobCalculatorPlugin();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -195,7 +202,7 @@ public class HistoryBrowseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
// ------------------ 1st graph
|
// ------------------ 1st graph
|
||||||
|
|
||||||
final GraphData graphData = new GraphData(bgGraph);
|
final GraphData graphData = new GraphData(bgGraph, IobCobCalculatorPlugin.getPlugin());
|
||||||
|
|
||||||
// **** In range Area ****
|
// **** In range Area ****
|
||||||
graphData.addInRangeArea(fromTime, toTime, lowLine, highLine);
|
graphData.addInRangeArea(fromTime, toTime, lowLine, highLine);
|
||||||
|
@ -223,7 +230,7 @@ public class HistoryBrowseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
// ------------------ 2nd graph
|
// ------------------ 2nd graph
|
||||||
|
|
||||||
final GraphData secondGraphData = new GraphData(iobGraph);
|
final GraphData secondGraphData = new GraphData(iobGraph, iobCobCalculatorPlugin);
|
||||||
|
|
||||||
boolean useIobForScale = false;
|
boolean useIobForScale = false;
|
||||||
boolean useCobForScale = false;
|
boolean useCobForScale = false;
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IobCobCalculatorPlugin() {
|
public IobCobCalculatorPlugin() {
|
||||||
MainApp.bus().register(this);
|
MainApp.bus().register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1362,7 +1362,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
// ------------------ 1st graph
|
// ------------------ 1st graph
|
||||||
Profiler.log(log, from + " - 1st graph - START", updateGUIStart);
|
Profiler.log(log, from + " - 1st graph - START", updateGUIStart);
|
||||||
|
|
||||||
final GraphData graphData = new GraphData(bgGraph);
|
final GraphData graphData = new GraphData(bgGraph, IobCobCalculatorPlugin.getPlugin());
|
||||||
|
|
||||||
// **** In range Area ****
|
// **** In range Area ****
|
||||||
graphData.addInRangeArea(fromTime, endTime, lowLine, highLine);
|
graphData.addInRangeArea(fromTime, endTime, lowLine, highLine);
|
||||||
|
@ -1393,7 +1393,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
// ------------------ 2nd graph
|
// ------------------ 2nd graph
|
||||||
Profiler.log(log, from + " - 2nd graph - START", updateGUIStart);
|
Profiler.log(log, from + " - 2nd graph - START", updateGUIStart);
|
||||||
|
|
||||||
final GraphData secondGraphData = new GraphData(iobGraph);
|
final GraphData secondGraphData = new GraphData(iobGraph, IobCobCalculatorPlugin.getPlugin());
|
||||||
|
|
||||||
boolean useIobForScale = false;
|
boolean useIobForScale = false;
|
||||||
boolean useCobForScale = false;
|
boolean useCobForScale = false;
|
||||||
|
|
|
@ -53,9 +53,12 @@ public class GraphData {
|
||||||
private String units;
|
private String units;
|
||||||
private List<Series> series = new ArrayList<>();
|
private List<Series> series = new ArrayList<>();
|
||||||
|
|
||||||
public GraphData(GraphView graph) {
|
private IobCobCalculatorPlugin iobCobCalculatorPlugin;
|
||||||
|
|
||||||
|
public GraphData(GraphView graph, IobCobCalculatorPlugin iobCobCalculatorPlugin) {
|
||||||
units = MainApp.getConfigBuilder().getProfileUnits();
|
units = MainApp.getConfigBuilder().getProfileUnits();
|
||||||
this.graph = graph;
|
this.graph = graph;
|
||||||
|
this.iobCobCalculatorPlugin = iobCobCalculatorPlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBgReadings(long fromTime, long toTime, double lowLine, double highLine, APSResult apsResult) {
|
public void addBgReadings(long fromTime, long toTime, double lowLine, double highLine, APSResult apsResult) {
|
||||||
|
|
Loading…
Reference in a new issue