temptarget zero-duration cleanup
This commit is contained in:
parent
b79743588d
commit
480b832efe
3 changed files with 6 additions and 1 deletions
|
@ -624,6 +624,9 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
if(tempTarget.duration != 0) {
|
if(tempTarget.duration != 0) {
|
||||||
tempTarget.low = NSProfile.toMgdl(data.getDouble("targetBottom"), MainApp.getConfigBuilder().getActiveProfile().getProfile().getUnits());
|
tempTarget.low = NSProfile.toMgdl(data.getDouble("targetBottom"), MainApp.getConfigBuilder().getActiveProfile().getProfile().getUnits());
|
||||||
tempTarget.high = NSProfile.toMgdl(data.getDouble("targetTop"), MainApp.getConfigBuilder().getActiveProfile().getProfile().getUnits());
|
tempTarget.high = NSProfile.toMgdl(data.getDouble("targetTop"), MainApp.getConfigBuilder().getActiveProfile().getProfile().getUnits());
|
||||||
|
} else {
|
||||||
|
tempTarget.low = 0;
|
||||||
|
tempTarget.high = 0;
|
||||||
}
|
}
|
||||||
tempTarget.setTimeIndex(tempTarget.getTimeIndex());
|
tempTarget.setTimeIndex(tempTarget.getTimeIndex());
|
||||||
Dao<TempTarget, Long> dao = MainApp.getDbHelper().getDaoTempTargets();
|
Dao<TempTarget, Long> dao = MainApp.getDbHelper().getDaoTempTargets();
|
||||||
|
|
|
@ -84,6 +84,9 @@ public class TempTargetRangeFragment extends Fragment implements View.OnClickLis
|
||||||
if (tempTarget.isInProgress())
|
if (tempTarget.isInProgress())
|
||||||
holder.dateLinearLayout.setBackgroundColor(MainApp.instance().getResources().getColor(R.color.colorInProgress));
|
holder.dateLinearLayout.setBackgroundColor(MainApp.instance().getResources().getColor(R.color.colorInProgress));
|
||||||
else if (tempTarget.duration == 0){
|
else if (tempTarget.duration == 0){
|
||||||
|
holder.low.setText("");
|
||||||
|
holder.high.setText("");
|
||||||
|
holder.duration.setText(R.string.cancel);
|
||||||
holder.dateLinearLayout.setBackgroundColor(MainApp.instance().getResources().getColor(R.color.notificationUrgent));
|
holder.dateLinearLayout.setBackgroundColor(MainApp.instance().getResources().getColor(R.color.notificationUrgent));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -91,7 +91,6 @@ public class TempTargetRangePlugin implements PluginBase {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public TempTarget getTempTargetInProgress(long time) {
|
public TempTarget getTempTargetInProgress(long time) {
|
||||||
// for (int i = tempTargets.size() - 1; i >= 0; i--) {
|
|
||||||
for (int i = 0; i < tempTargets.size(); i++) {
|
for (int i = 0; i < tempTargets.size(); i++) {
|
||||||
// a zero-duration temp target will cancel all prior targets
|
// a zero-duration temp target will cancel all prior targets
|
||||||
if (tempTargets.get(i).duration == 0) return null;
|
if (tempTargets.get(i).duration == 0) return null;
|
||||||
|
|
Loading…
Reference in a new issue