fix time display
This commit is contained in:
parent
465ae7ee8a
commit
80b47f57c4
|
@ -23,7 +23,6 @@ import io.reactivex.Single
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.LocalDateTime
|
|
||||||
import java.time.ZonedDateTime
|
import java.time.ZonedDateTime
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -271,18 +271,21 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
podInfoBinding.timeOnPod.text = podStateManager.time?.let {
|
podInfoBinding.timeOnPod.text = podStateManager.time?.let {
|
||||||
resourceHelper.gs(
|
resourceHelper.gs(
|
||||||
R.string.omnipod_common_time_with_timezone,
|
R.string.omnipod_common_time_with_timezone,
|
||||||
dateUtil.dateAndTimeString(it.toEpochSecond()*1000),
|
dateUtil.dateAndTimeString(it.toEpochSecond() * 1000),
|
||||||
podStateManager.timeZone.getDisplayName(true, TimeZone.SHORT)
|
podStateManager.timeZone.getDisplayName(true, TimeZone.SHORT)
|
||||||
)
|
)
|
||||||
} ?: PLACEHOLDER
|
} ?: PLACEHOLDER
|
||||||
|
|
||||||
|
val timeDeviationTooBig = podStateManager.timeDrift?.let {
|
||||||
|
Duration.ofMinutes(MAX_TIME_DEVIATION_MINUTES).minus(
|
||||||
|
it.abs()
|
||||||
|
).isNegative
|
||||||
|
} ?: false
|
||||||
podInfoBinding.timeOnPod.setTextColor(
|
podInfoBinding.timeOnPod.setTextColor(
|
||||||
when {
|
when {
|
||||||
!podStateManager.sameTimeZone ->
|
!podStateManager.sameTimeZone ->
|
||||||
Color.MAGENTA
|
Color.MAGENTA
|
||||||
podStateManager.timeDrift?.abs()?.minus(
|
timeDeviationTooBig ->
|
||||||
Duration.ofMinutes(MAX_TIME_DEVIATION_MINUTES)
|
|
||||||
)?.isNegative ?: false ->
|
|
||||||
Color.YELLOW
|
Color.YELLOW
|
||||||
else ->
|
else ->
|
||||||
Color.WHITE
|
Color.WHITE
|
||||||
|
@ -292,7 +295,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
// Update Pod expiry time
|
// Update Pod expiry time
|
||||||
val expiresAt = podStateManager.expiry
|
val expiresAt = podStateManager.expiry
|
||||||
podInfoBinding.podExpiryDate.text = expiresAt?.let {
|
podInfoBinding.podExpiryDate.text = expiresAt?.let {
|
||||||
dateUtil.dateAndTimeString(it.toEpochSecond()*1000)
|
dateUtil.dateAndTimeString(it.toEpochSecond() * 1000)
|
||||||
}
|
}
|
||||||
?: PLACEHOLDER
|
?: PLACEHOLDER
|
||||||
podInfoBinding.podExpiryDate.setTextColor(
|
podInfoBinding.podExpiryDate.setTextColor(
|
||||||
|
|
Loading…
Reference in a new issue