diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt index 2cb57bcf15..dc582bce16 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt @@ -23,7 +23,6 @@ import io.reactivex.Single import java.io.Serializable import java.time.Duration import java.time.Instant -import java.time.LocalDateTime import java.time.ZonedDateTime import java.util.* import javax.inject.Inject diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt index a7a3f7a302..ea37bf5aeb 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt @@ -271,18 +271,21 @@ class OmnipodDashOverviewFragment : DaggerFragment() { podInfoBinding.timeOnPod.text = podStateManager.time?.let { resourceHelper.gs( R.string.omnipod_common_time_with_timezone, - dateUtil.dateAndTimeString(it.toEpochSecond()*1000), + dateUtil.dateAndTimeString(it.toEpochSecond() * 1000), podStateManager.timeZone.getDisplayName(true, TimeZone.SHORT) ) } ?: PLACEHOLDER + val timeDeviationTooBig = podStateManager.timeDrift?.let { + Duration.ofMinutes(MAX_TIME_DEVIATION_MINUTES).minus( + it.abs() + ).isNegative + } ?: false podInfoBinding.timeOnPod.setTextColor( when { !podStateManager.sameTimeZone -> Color.MAGENTA - podStateManager.timeDrift?.abs()?.minus( - Duration.ofMinutes(MAX_TIME_DEVIATION_MINUTES) - )?.isNegative ?: false -> + timeDeviationTooBig -> Color.YELLOW else -> Color.WHITE @@ -292,7 +295,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() { // Update Pod expiry time val expiresAt = podStateManager.expiry podInfoBinding.podExpiryDate.text = expiresAt?.let { - dateUtil.dateAndTimeString(it.toEpochSecond()*1000) + dateUtil.dateAndTimeString(it.toEpochSecond() * 1000) } ?: PLACEHOLDER podInfoBinding.podExpiryDate.setTextColor(