mirror of
https://github.com/vide/matedroid.git
synced 2026-01-20 00:03:17 +08:00
fix: improve battery card visual indicators
- Only show charging bolt icon when actively charging, not just plugged in - Change battery color thresholds: red < 20%, yellow < 40%, neutral otherwise - Add warning icon when battery level > 90% 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
e2bcfc9902
commit
e95070dfdd
@@ -21,6 +21,7 @@ import androidx.compose.material.icons.filled.EvStation
|
||||
import androidx.compose.material.icons.filled.Lock
|
||||
import androidx.compose.material.icons.filled.LockOpen
|
||||
import androidx.compose.material.icons.filled.LocationOn
|
||||
import androidx.compose.material.icons.filled.Warning
|
||||
import androidx.compose.material.icons.filled.Power
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material.icons.filled.Speed
|
||||
@@ -320,9 +321,9 @@ private fun StatusIndicatorsRow(status: CarStatus) {
|
||||
private fun BatteryCard(status: CarStatus) {
|
||||
val batteryLevel = status.batteryLevel ?: 0
|
||||
val batteryColor = when {
|
||||
batteryLevel >= 60 -> StatusSuccess
|
||||
batteryLevel >= 20 -> StatusWarning
|
||||
else -> StatusError
|
||||
batteryLevel < 20 -> StatusError
|
||||
batteryLevel < 40 -> StatusWarning
|
||||
else -> MaterialTheme.colorScheme.onPrimaryContainer
|
||||
}
|
||||
|
||||
Card(
|
||||
@@ -352,7 +353,7 @@ private fun BatteryCard(status: CarStatus) {
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = batteryColor
|
||||
)
|
||||
if (status.pluggedIn == true) {
|
||||
if (status.isCharging) {
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Icon(
|
||||
imageVector = Icons.Filled.ElectricBolt,
|
||||
@@ -360,6 +361,14 @@ private fun BatteryCard(status: CarStatus) {
|
||||
tint = StatusSuccess
|
||||
)
|
||||
}
|
||||
if (batteryLevel > 90) {
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Icon(
|
||||
imageVector = Icons.Filled.Warning,
|
||||
contentDescription = "High charge level",
|
||||
tint = StatusWarning
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
||||
Reference in New Issue
Block a user