pod expiry: use let
This commit is contained in:
parent
99ca414d87
commit
7a72cf2f19
2 changed files with 10 additions and 14 deletions
|
@ -29,7 +29,6 @@ import kotlin.math.absoluteValue
|
||||||
sealed class ConnectionState
|
sealed class ConnectionState
|
||||||
|
|
||||||
object Connecting: ConnectionState()
|
object Connecting: ConnectionState()
|
||||||
object Handshaking: ConnectionState()
|
|
||||||
object Connected : ConnectionState()
|
object Connected : ConnectionState()
|
||||||
object NotConnected : ConnectionState()
|
object NotConnected : ConnectionState()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.ui
|
package info.nightscout.androidaps.plugins.pump.omnipod.dash.ui
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.content.res.ColorStateList
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
|
@ -284,19 +285,15 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
|
|
||||||
// Update Pod expiry time
|
// Update Pod expiry time
|
||||||
val expiresAt = podStateManager.expiry
|
val expiresAt = podStateManager.expiry
|
||||||
if (expiresAt == null) {
|
podInfoBinding.podExpiryDate.text = expiresAt?.let {
|
||||||
podInfoBinding.podExpiryDate.text = PLACEHOLDER
|
readableZonedTime(it) }
|
||||||
podInfoBinding.podExpiryDate.setTextColor(Color.WHITE)
|
?: PLACEHOLDER
|
||||||
} else {
|
|
||||||
podInfoBinding.podExpiryDate.text = readableZonedTime(expiresAt)
|
|
||||||
podInfoBinding.podExpiryDate.setTextColor(
|
podInfoBinding.podExpiryDate.setTextColor(
|
||||||
if (DateTime.now().isAfter(expiresAt)) {
|
if (expiresAt != null && DateTime.now().isAfter(expiresAt))
|
||||||
Color.RED
|
Color.RED
|
||||||
} else {
|
else
|
||||||
Color.WHITE
|
Color.WHITE
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
podStateManager.alarmType?.let {
|
podStateManager.alarmType?.let {
|
||||||
errors.add(
|
errors.add(
|
||||||
|
|
Loading…
Add table
Reference in a new issue