Merge branch 'dev' into smb

This commit is contained in:
Milos Kozak 2017-08-22 20:34:38 +02:00
commit 01a93a35b9

View file

@ -908,6 +908,34 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
return; return;
} }
Double lowLine = SP.getDouble("low_mark", 0d);
Double highLine = SP.getDouble("high_mark", 0d);
//Start with updating the BG as it is unaffected by loop.
// **** BG value ****
if (lastBG != null) {
int color = MainApp.sResources.getColor(R.color.inrange);
if (lastBG.valueToUnits(units) < lowLine)
color = MainApp.sResources.getColor(R.color.low);
else if (lastBG.valueToUnits(units) > highLine)
color = MainApp.sResources.getColor(R.color.high);
bgView.setText(lastBG.valueToUnitsToString(units));
arrowView.setText(lastBG.directionToSymbol());
bgView.setTextColor(color);
arrowView.setTextColor(color);
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
if (glucoseStatus != null) {
deltaView.setText("Δ " + Profile.toUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + " " + units);
if (avgdeltaView != null)
avgdeltaView.setText("øΔ15m: " + Profile.toUnitsString(glucoseStatus.short_avgdelta, glucoseStatus.short_avgdelta * Constants.MGDL_TO_MMOLL, units) +
" øΔ40m: " + Profile.toUnitsString(glucoseStatus.long_avgdelta, glucoseStatus.long_avgdelta * Constants.MGDL_TO_MMOLL, units));
} else {
deltaView.setText("Δ " + MainApp.sResources.getString(R.string.notavailable));
if (avgdeltaView != null)
avgdeltaView.setText("");
}
}
// open loop mode // open loop mode
final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun; final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun;
if (Config.APS && MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable) { if (Config.APS && MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable) {
@ -1101,8 +1129,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
treatmentButton.setVisibility(View.GONE); treatmentButton.setVisibility(View.GONE);
} }
Double lowLine = SP.getDouble("low_mark", 0d);
Double highLine = SP.getDouble("high_mark", 0d);
if (lowLine < 1) { if (lowLine < 1) {
lowLine = Profile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units); lowLine = Profile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units);
} }
@ -1111,28 +1138,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
} }
// **** BG value **** // **** BG value ****
if (lastBG != null) { if (lastBG == null) { //left this here as it seems you want to exit at this point if it is null...
int color = MainApp.sResources.getColor(R.color.inrange);
if (lastBG.valueToUnits(units) < lowLine)
color = MainApp.sResources.getColor(R.color.low);
else if (lastBG.valueToUnits(units) > highLine)
color = MainApp.sResources.getColor(R.color.high);
bgView.setText(lastBG.valueToUnitsToString(units));
arrowView.setText(lastBG.directionToSymbol());
bgView.setTextColor(color);
arrowView.setTextColor(color);
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
if (glucoseStatus != null) {
deltaView.setText("Δ " + Profile.toUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + " " + units);
if (avgdeltaView != null)
avgdeltaView.setText("øΔ15m: " + Profile.toUnitsString(glucoseStatus.short_avgdelta, glucoseStatus.short_avgdelta * Constants.MGDL_TO_MMOLL, units) +
" øΔ40m: " + Profile.toUnitsString(glucoseStatus.long_avgdelta, glucoseStatus.long_avgdelta * Constants.MGDL_TO_MMOLL, units));
} else {
deltaView.setText("Δ " + MainApp.sResources.getString(R.string.notavailable));
if (avgdeltaView != null)
avgdeltaView.setText("");
}
} else {
return; return;
} }
Integer flag = bgView.getPaintFlags(); Integer flag = bgView.getPaintFlags();