fix time display
This commit is contained in:
parent
465ae7ee8a
commit
80b47f57c4
2 changed files with 8 additions and 6 deletions
|
@ -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
|
||||||
|
|
|
@ -276,13 +276,16 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
)
|
)
|
||||||
} ?: 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
|
||||||
|
|
Loading…
Reference in a new issue