Skip to content

Commit 26a6fdf

Browse files
eriedclaude
andcommitted
Watch: speed and details follow accent, gauge band always green/yellow/red
The big speed glyph on both pages now tints with the accent color the user picked on the phone, instead of the speed-tier color (green at low speed, red near tiltback). The gauge color band keeps its safety semantics by going green/yellow/red regardless of accent — the previous "safe segment uses accent" code looked broken when the user picked a red or pink accent because the band's safe zone visually merged with the danger zone. Details rows on the second page now show their values in accent too; disconnected dashes stay grey so the rider can tell at a glance which rows are live. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2751f09 commit 26a6fdf

2 files changed

Lines changed: 26 additions & 18 deletions

File tree

wear/src/main/java/com/eried/eucplanet/wear/ui/SpeedGauge.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ fun SpeedGauge(
8686
style = Stroke(width = arcThickness, cap = StrokeCap.Round)
8787
)
8888

89-
// Thin color band behind the arc: safe (accent) > orange > red.
89+
// Thin color band behind the arc: safe (green) > warning (yellow) >
90+
// danger (red). Hardcoded green for the safe zone so the gauge keeps
91+
// its safety semantics regardless of which accent the user picked
92+
// — using accent here meant a teal accent matched the safe zone but
93+
// a red accent made the whole band look like one long danger zone.
9094
if (showColorBand) {
9195
val bandThickness = arcThickness * 0.35f
9296
val bandRadius = arcRadius + arcThickness * 0.55f + bandThickness * 0.5f
@@ -99,11 +103,11 @@ fun SpeedGauge(
99103
val redSweep = sweepTotal * (1f - redFrac)
100104
val bandTopLeft = Offset(center.x - bandRadius, center.y - bandRadius)
101105
val bandSize = Size(bandRadius * 2, bandRadius * 2)
102-
drawArc(color = accent.copy(alpha = bandAlpha),
106+
drawArc(color = GaugeAccentGreen.copy(alpha = bandAlpha),
103107
startAngle = startAngle, sweepAngle = sweepTotal * orangeFrac,
104108
useCenter = false, topLeft = bandTopLeft, size = bandSize,
105109
style = Stroke(width = bandThickness, cap = StrokeCap.Butt))
106-
drawArc(color = GaugeAccentOrange.copy(alpha = bandAlpha),
110+
drawArc(color = GaugeAccentYellow.copy(alpha = bandAlpha),
107111
startAngle = orangeStart, sweepAngle = orangeSweep,
108112
useCenter = false, topLeft = bandTopLeft, size = bandSize,
109113
style = Stroke(width = bandThickness, cap = StrokeCap.Butt))

wear/src/main/java/com/eried/eucplanet/wear/ui/WatchApp.kt

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,10 @@ private fun MainScreen(state: WatchState, accent: Color) {
157157
text = "%.0f".format(WatchUnits.speed(state.speedKmh, state.imperialUnits)),
158158
fontSize = speedFontSp,
159159
fontWeight = FontWeight.Bold,
160-
// Disconnected: use the accent color so the dashboard
161-
// matches the gauge's safe-band tint instead of the
162-
// green-tier "0" that reads as if the wheel were idle.
163-
color = if (state.connected) speedTierColor(state.speedKmh, maxSpeed)
164-
else accent
160+
// The gauge band already encodes the safety zones via
161+
// green/yellow/red. The speed glyph follows the user's
162+
// accent so the watch identity matches their phone.
163+
color = accent
165164
)
166165
if (state.showSpeedUnit) {
167166
Spacer(Modifier.width(3.dp))
@@ -453,17 +452,21 @@ private fun DetailsScreen(state: WatchState, accent: Color) {
453452
text = "%.0f %s".format(speedDisplay, speedUnit),
454453
fontSize = speedSp,
455454
fontWeight = FontWeight.Bold,
456-
color = Color.White
455+
color = accent
457456
)
458457
Spacer(Modifier.height(4.dp))
459458
val live = state.connected
460-
DetailRow(R.string.watch_voltage_label, if (live) "%.1f V".format(state.voltage) else DASH, labelSp, valueSp, labelWidth, valueWidth)
461-
DetailRow(R.string.watch_current_label, if (live) "%.1f A".format(state.current) else DASH, labelSp, valueSp, labelWidth, valueWidth)
462-
DetailRow(R.string.watch_power_label, if (live) "%.0f W".format(powerW) else DASH, labelSp, valueSp, labelWidth, valueWidth)
463-
DetailRow(R.string.watch_pwm_label, if (live) "%.0f %%".format(state.pwmPercent) else DASH, labelSp, valueSp, labelWidth, valueWidth)
464-
DetailRow(R.string.watch_temp_label, if (live) "%.0f %s".format(tempDisplay, tempUnit) else DASH, labelSp, valueSp, labelWidth, valueWidth)
465-
DetailRow(R.string.watch_torque_label, if (live) "%.1f".format(state.torque) else DASH, labelSp, valueSp, labelWidth, valueWidth)
466-
DetailRow(R.string.watch_trip_label, if (live) "%.2f %s".format(tripDisplay, distUnit) else DASH, labelSp, valueSp, labelWidth, valueWidth)
459+
// Accent-tint live values so the page reads as a continuation of
460+
// the dashboard's accent identity. Disconnected dashes stay grey
461+
// so the rider can tell at a glance that the row isn't live.
462+
val valueColor = if (live) accent else Color(0xFF606060)
463+
DetailRow(R.string.watch_voltage_label, if (live) "%.1f V".format(state.voltage) else DASH, labelSp, valueSp, labelWidth, valueWidth, valueColor)
464+
DetailRow(R.string.watch_current_label, if (live) "%.1f A".format(state.current) else DASH, labelSp, valueSp, labelWidth, valueWidth, valueColor)
465+
DetailRow(R.string.watch_power_label, if (live) "%.0f W".format(powerW) else DASH, labelSp, valueSp, labelWidth, valueWidth, valueColor)
466+
DetailRow(R.string.watch_pwm_label, if (live) "%.0f %%".format(state.pwmPercent) else DASH, labelSp, valueSp, labelWidth, valueWidth, valueColor)
467+
DetailRow(R.string.watch_temp_label, if (live) "%.0f %s".format(tempDisplay, tempUnit) else DASH, labelSp, valueSp, labelWidth, valueWidth, valueColor)
468+
DetailRow(R.string.watch_torque_label, if (live) "%.1f".format(state.torque) else DASH, labelSp, valueSp, labelWidth, valueWidth, valueColor)
469+
DetailRow(R.string.watch_trip_label, if (live) "%.2f %s".format(tripDisplay, distUnit) else DASH, labelSp, valueSp, labelWidth, valueWidth, valueColor)
467470
}
468471
}
469472
}
@@ -475,7 +478,8 @@ private fun DetailRow(
475478
labelSp: TextUnit,
476479
valueSp: TextUnit,
477480
labelWidth: Dp,
478-
valueWidth: Dp
481+
valueWidth: Dp,
482+
valueColor: Color = Color.White
479483
) {
480484
// Fixed-width label + fixed-width value gives a tabular alignment so
481485
// values stack vertically across rows. The whole row is centred by the
@@ -495,7 +499,7 @@ private fun DetailRow(
495499
Text(
496500
text = value,
497501
fontSize = valueSp,
498-
color = Color.White,
502+
color = valueColor,
499503
fontWeight = FontWeight.Medium,
500504
textAlign = TextAlign.Start,
501505
modifier = Modifier.width(valueWidth)

0 commit comments

Comments
 (0)