pod expiry: use let

This commit is contained in:
Andrei Vereha 2021-07-11 18:35:28 +02:00
parent 99ca414d87
commit 7a72cf2f19
2 changed files with 10 additions and 14 deletions

View file

@ -29,7 +29,6 @@ import kotlin.math.absoluteValue
sealed class ConnectionState
object Connecting: ConnectionState()
object Handshaking: ConnectionState()
object Connected : ConnectionState()
object NotConnected : ConnectionState()

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.ui
import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Bundle
import android.os.Handler
@ -284,19 +285,15 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
// Update Pod expiry time
val expiresAt = podStateManager.expiry
if (expiresAt == null) {
podInfoBinding.podExpiryDate.text = PLACEHOLDER
podInfoBinding.podExpiryDate.setTextColor(Color.WHITE)
} else {
podInfoBinding.podExpiryDate.text = readableZonedTime(expiresAt)
podInfoBinding.podExpiryDate.setTextColor(
if (DateTime.now().isAfter(expiresAt)) {
Color.RED
} else {
Color.WHITE
}
)
}
podInfoBinding.podExpiryDate.text = expiresAt?.let {
readableZonedTime(it) }
?: PLACEHOLDER
podInfoBinding.podExpiryDate.setTextColor(
if (expiresAt != null && DateTime.now().isAfter(expiresAt))
Color.RED
else
Color.WHITE
)
podStateManager.alarmType?.let {
errors.add(