- changed red display of time ago (to white always)
- fixed wrong reporting of cancelled TBR
This commit is contained in:
parent
ec28f92223
commit
db6ea5c792
2 changed files with 21 additions and 15 deletions
|
@ -133,6 +133,8 @@ class OmnipodFragment : Fragment() {
|
|||
}
|
||||
}
|
||||
|
||||
omnipod_lastconnection.setTextColor(Color.WHITE)
|
||||
|
||||
setVisibilityOfPodDebugButton()
|
||||
|
||||
updateGUI()
|
||||
|
@ -343,12 +345,12 @@ class OmnipodFragment : Fragment() {
|
|||
if (pumpStatus.podAvailable) {
|
||||
// last connection
|
||||
if (pumpStatus.lastConnection != 0L) {
|
||||
val minAgo = DateUtil.minAgo(pumpStatus.lastConnection)
|
||||
//val minAgo = DateUtil.minAgo(pumpStatus.lastConnection)
|
||||
val min = (System.currentTimeMillis() - pumpStatus.lastConnection) / 1000 / 60
|
||||
if (pumpStatus.lastConnection + 60 * 1000 > System.currentTimeMillis()) {
|
||||
omnipod_lastconnection.setText(R.string.combo_pump_connected_now)
|
||||
omnipod_lastconnection.setTextColor(Color.WHITE)
|
||||
} else if (pumpStatus.lastConnection + 30 * 60 * 1000 < System.currentTimeMillis()) {
|
||||
//omnipod_lastconnection.setTextColor(Color.WHITE)
|
||||
} else { //if (pumpStatus.lastConnection + 30 * 60 * 1000 < System.currentTimeMillis()) {
|
||||
|
||||
if (min < 60) {
|
||||
omnipod_lastconnection.text = MainApp.gs(R.string.minago, min)
|
||||
|
@ -363,11 +365,12 @@ class OmnipodFragment : Fragment() {
|
|||
omnipod_lastconnection.text = (MainApp.gq(R.plurals.objective_days, d, d) + " "
|
||||
+ MainApp.gs(R.string.ago))
|
||||
}
|
||||
omnipod_lastconnection.setTextColor(Color.RED)
|
||||
} else {
|
||||
omnipod_lastconnection.text = minAgo
|
||||
omnipod_lastconnection.setTextColor(Color.WHITE)
|
||||
//omnipod_lastconnection.setTextColor(Color.RED)
|
||||
}
|
||||
// } else {
|
||||
// omnipod_lastconnection.text = minAgo
|
||||
// //omnipod_lastconnection.setTextColor(Color.WHITE)
|
||||
// }
|
||||
}
|
||||
|
||||
// last bolus
|
||||
|
|
|
@ -225,10 +225,10 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
return new PumpEnactResult().success(false).enacted(false).comment(comment);
|
||||
}
|
||||
|
||||
addSuccessToHistory(time, PodHistoryEntryType.DeactivatePod, null);
|
||||
|
||||
reportImplicitlyCanceledTbr();
|
||||
|
||||
addSuccessToHistory(time, PodHistoryEntryType.DeactivatePod, null);
|
||||
|
||||
podInitReceiver.returnInitTaskStatus(PodInitActionType.DeactivatePodWizardStep, true, null);
|
||||
|
||||
OmnipodUtil.setPodSessionState(null);
|
||||
|
@ -247,19 +247,21 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
throw new CommandInitializationException("Basal profile mapping failed", ex);
|
||||
}
|
||||
delegate.setBasalSchedule(basalSchedule, isBasalBeepsEnabled());
|
||||
// Because setting a basal profile actually suspends and then resumes delivery, TBR is implicitly cancelled
|
||||
reportImplicitlyCanceledTbr();
|
||||
addSuccessToHistory(time, PodHistoryEntryType.SetBasalSchedule, profile.getBasalValues());
|
||||
} catch (Exception ex) {
|
||||
if ((ex instanceof OmnipodException) && !((OmnipodException) ex).isCertainFailure()) {
|
||||
reportImplicitlyCanceledTbr();
|
||||
addToHistory(time, PodHistoryEntryType.SetBasalSchedule, "Uncertain failure", false);
|
||||
return new PumpEnactResult().success(false).enacted(false).comment(getStringResource(R.string.omnipod_error_set_basal_failed_uncertain));
|
||||
}
|
||||
String comment = handleAndTranslateException(ex);
|
||||
reportImplicitlyCanceledTbr();
|
||||
addFailureToHistory(time, PodHistoryEntryType.SetBasalSchedule, comment);
|
||||
return new PumpEnactResult().success(false).enacted(false).comment(comment);
|
||||
}
|
||||
|
||||
// Because setting a basal profile actually suspends and then resumes delivery, TBR is implicitly cancelled
|
||||
reportImplicitlyCanceledTbr();
|
||||
|
||||
return new PumpEnactResult().success(true).enacted(true);
|
||||
}
|
||||
|
@ -476,20 +478,21 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
long time = System.currentTimeMillis();
|
||||
try {
|
||||
delegate.setTime(isBasalBeepsEnabled());
|
||||
// Because set time actually suspends and then resumes delivery, TBR is implicitly cancelled
|
||||
reportImplicitlyCanceledTbr();
|
||||
addSuccessToHistory(time, PodHistoryEntryType.SetTime, null);
|
||||
} catch (Exception ex) {
|
||||
if ((ex instanceof OmnipodException) && !((OmnipodException) ex).isCertainFailure()) {
|
||||
reportImplicitlyCanceledTbr();
|
||||
addFailureToHistory(time, PodHistoryEntryType.SetTime, "Uncertain failure");
|
||||
return new PumpEnactResult().success(false).enacted(false).comment(getStringResource(R.string.omnipod_error_set_time_failed_uncertain));
|
||||
}
|
||||
String comment = handleAndTranslateException(ex);
|
||||
reportImplicitlyCanceledTbr();
|
||||
addFailureToHistory(time, PodHistoryEntryType.SetTime, comment);
|
||||
return new PumpEnactResult().success(false).enacted(false).comment(comment);
|
||||
}
|
||||
|
||||
// Because set time actually suspends and then resumes delivery, TBR is implicitly cancelled
|
||||
reportImplicitlyCanceledTbr();
|
||||
|
||||
return new PumpEnactResult().success(true).enacted(true);
|
||||
}
|
||||
|
||||
|
@ -521,7 +524,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
LOG.debug("Reporting implicitly cancelled TBR to Treatments plugin");
|
||||
}
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
long time = System.currentTimeMillis()-1000;
|
||||
|
||||
addSuccessToHistory(time, PodHistoryEntryType.CancelTemporaryBasal, null);
|
||||
|
||||
|
|
Loading…
Reference in a new issue