remove joda
This commit is contained in:
parent
d1f99bfb71
commit
465ae7ee8a
2 changed files with 9 additions and 6 deletions
|
@ -23,6 +23,7 @@ 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
|
||||
|
@ -192,7 +193,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
|
|||
val minutesSinceActivation = podState.minutesSinceActivation
|
||||
val activationTime = podState.activationTime
|
||||
if ((activationTime != null) && (minutesSinceActivation != null)) {
|
||||
return ZonedDateTime.from(Instant.ofEpochMilli(activationTime))
|
||||
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(activationTime), timeZone.toZoneId())
|
||||
.plusMinutes(minutesSinceActivation.toLong())
|
||||
.plus(Duration.ofMillis(System.currentTimeMillis() - lastUpdatedSystem))
|
||||
}
|
||||
|
@ -208,10 +209,12 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
|
|||
// TODO: Consider storing expiry datetime in pod state saving continuously recalculating to the same value
|
||||
get() {
|
||||
val podLifeInHours = podLifeInHours
|
||||
val activationTime = podState.activationTime
|
||||
if (podLifeInHours != null && activationTime != null) {
|
||||
return return ZonedDateTime.from(Instant.ofEpochMilli(activationTime))
|
||||
val minutesSinceActivation = podState.minutesSinceActivation
|
||||
if (podLifeInHours != null && minutesSinceActivation != null) {
|
||||
return ZonedDateTime.now()
|
||||
.plusHours(podLifeInHours.toLong())
|
||||
.minusMinutes(minutesSinceActivation.toLong())
|
||||
.plus(Duration.ofMillis(System.currentTimeMillis() - lastUpdatedSystem))
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
podInfoBinding.timeOnPod.text = podStateManager.time?.let {
|
||||
resourceHelper.gs(
|
||||
R.string.omnipod_common_time_with_timezone,
|
||||
dateUtil.dateAndTimeString(it.toEpochSecond()),
|
||||
dateUtil.dateAndTimeString(it.toEpochSecond()*1000),
|
||||
podStateManager.timeZone.getDisplayName(true, TimeZone.SHORT)
|
||||
)
|
||||
} ?: PLACEHOLDER
|
||||
|
@ -292,7 +292,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
// Update Pod expiry time
|
||||
val expiresAt = podStateManager.expiry
|
||||
podInfoBinding.podExpiryDate.text = expiresAt?.let {
|
||||
dateUtil.dateAndTimeString(it.toEpochSecond())
|
||||
dateUtil.dateAndTimeString(it.toEpochSecond()*1000)
|
||||
}
|
||||
?: PLACEHOLDER
|
||||
podInfoBinding.podExpiryDate.setTextColor(
|
||||
|
|
Loading…
Reference in a new issue