Don't show estimated charging time if it is zero

This commit is contained in:
MM20 2022-09-11 12:31:55 +02:00
parent 82dd0a93c2
commit 29a06dfc4f
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -150,7 +150,7 @@ class BatteryPartProvider : PartProvider {
level = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY),
charging = batteryManager.isCharging,
fullIn = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
batteryManager.computeChargeTimeRemaining().takeIf { it >= 0 }
batteryManager.computeChargeTimeRemaining().takeIf { it > 0 }
} else null,
)
)
@ -165,7 +165,7 @@ class BatteryPartProvider : PartProvider {
BatteryManager.BATTERY_STATUS_UNKNOWN
) == BatteryManager.BATTERY_STATUS_CHARGING,
fullIn = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
batteryManager.computeChargeTimeRemaining().takeIf { it >= 0 }
batteryManager.computeChargeTimeRemaining().takeIf { it > 0 }
} else null,
)
)