fix: hide battery indicator when level is 0 (never reported) (#5595)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
James Rich
2026-05-25 13:12:32 -07:00
committed by GitHub
parent 5eb62cdcfc
commit 684c4a9678
2 changed files with 8 additions and 6 deletions
@@ -254,11 +254,13 @@ private fun NodeBatteryPositionRow(
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
MaterialBatteryInfo(
level = thatNode.batteryLevel ?: 0,
voltage = thatNode.voltage ?: 0f,
contentColor = contentColor,
)
if ((thatNode.batteryLevel ?: 0) > 0) {
MaterialBatteryInfo(
level = thatNode.batteryLevel ?: 0,
voltage = thatNode.voltage ?: 0f,
contentColor = contentColor,
)
}
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) {
if (distance != null) {
@@ -200,7 +200,7 @@ fun NodeItemCompact(
verticalArrangement = Arrangement.spacedBy(4.dp),
) {
NodeChip(node = thatNode)
if (showPower && thatNode.batteryLevel != null) {
if (showPower && (thatNode.batteryLevel ?: 0) > 0) {
MaterialBatteryInfo(
level = thatNode.batteryLevel ?: 0,
voltage = thatNode.voltage ?: 0f,