Skip to content

Commit 4fd6062

Browse files
eriedclaude
andcommitted
ExternalGpsSection: match Flic scan card layout
Restructures the unpaired card to mirror the Flic scan card exactly: hint sits inside the card above the action button, both centred via horizontalAlignment, button uses its intrinsic width instead of fillMaxWidth so its size matches Flic's Scan button. Caption rewritten in the same instructional shape as the Flic hint ("Hold your Flic ... then tap Scan" → "Power on your RaceBox ... tap Pair to scan"). The progress spinner and Stop scan button now also live inside the same centred column the way Flic does, so layout is identical between the two integrations end-to-end. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4d5af99 commit 4fd6062

2 files changed

Lines changed: 48 additions & 51 deletions

File tree

app/src/main/java/com/eried/eucplanet/ui/settings/ExternalGpsSection.kt

Lines changed: 47 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ fun ExternalGpsSection(viewModel: ExternalGpsViewModel = hiltViewModel()) {
5050

5151
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
5252
SectionHeader(stringResource(R.string.section_external_gps))
53-
HintText(stringResource(R.string.external_gps_caption), small = true)
5453

5554
if (pairedAddress == null) {
5655
// Not paired: scan card with start/stop and a list of discovered devices.
56+
// Mirrors the Flic scan card so the two integrations read as one family.
5757
UnpairedExternalGpsCard(
5858
scanning = scanning,
5959
results = scanResults,
@@ -86,62 +86,59 @@ private fun UnpairedExternalGpsCard(
8686
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant),
8787
shape = RoundedCornerShape(12.dp)
8888
) {
89+
// Mirrors the Flic scan card: centered column, hint above the button,
90+
// intrinsic button width. Discovered devices appear as inset rows
91+
// between the hint and the action button.
8992
Column(
90-
modifier = Modifier.padding(16.dp),
91-
verticalArrangement = Arrangement.spacedBy(8.dp)
93+
modifier = Modifier
94+
.fillMaxWidth()
95+
.padding(16.dp),
96+
horizontalAlignment = Alignment.CenterHorizontally
9297
) {
93-
if (!scanning && results.isEmpty()) {
94-
Button(
95-
onClick = onStartScan,
98+
HintText(stringResource(R.string.external_gps_caption))
99+
results.forEach { result ->
100+
Spacer(Modifier.height(8.dp))
101+
Card(
102+
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface),
103+
shape = RoundedCornerShape(8.dp),
96104
modifier = Modifier.fillMaxWidth()
97-
) { Text(stringResource(R.string.external_gps_pair_button)) }
98-
} else {
99-
Row(verticalAlignment = Alignment.CenterVertically) {
100-
if (scanning) {
101-
CircularProgressIndicator(modifier = Modifier.padding(end = 12.dp))
102-
Text(
103-
stringResource(R.string.external_gps_scanning),
104-
style = MaterialTheme.typography.bodyMedium
105-
)
106-
}
107-
}
108-
results.forEach { result ->
109-
Card(
110-
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface),
111-
shape = RoundedCornerShape(8.dp),
112-
modifier = Modifier.fillMaxWidth()
105+
) {
106+
Row(
107+
modifier = Modifier
108+
.fillMaxWidth()
109+
.padding(horizontal = 12.dp, vertical = 8.dp),
110+
verticalAlignment = Alignment.CenterVertically,
111+
horizontalArrangement = Arrangement.SpaceBetween
113112
) {
114-
Row(
115-
modifier = Modifier
116-
.fillMaxWidth()
117-
.padding(horizontal = 12.dp, vertical = 8.dp),
118-
verticalAlignment = Alignment.CenterVertically,
119-
horizontalArrangement = Arrangement.SpaceBetween
120-
) {
121-
Column(modifier = Modifier.weight(1f)) {
122-
Text(result.device.name, style = MaterialTheme.typography.bodyLarge)
123-
Text(
124-
"${result.source.displayName} · ${result.device.rssi} dBm",
125-
style = MaterialTheme.typography.bodySmall,
126-
color = MaterialTheme.colorScheme.onSurfaceVariant
127-
)
128-
}
129-
Button(onClick = { onPick(result) }) {
130-
Text(stringResource(R.string.external_gps_pair_action))
131-
}
113+
Column(modifier = Modifier.weight(1f)) {
114+
Text(result.device.name, style = MaterialTheme.typography.bodyLarge)
115+
Text(
116+
"${result.source.displayName} · ${result.device.rssi} dBm",
117+
style = MaterialTheme.typography.bodySmall,
118+
color = MaterialTheme.colorScheme.onSurfaceVariant
119+
)
120+
}
121+
Button(onClick = { onPick(result) }) {
122+
Text(stringResource(R.string.external_gps_pair_action))
132123
}
133124
}
134125
}
135-
if (scanning && results.isEmpty()) {
136-
HintText(stringResource(R.string.external_gps_no_results), small = true)
137-
}
138-
Spacer(Modifier.height(4.dp))
139-
if (scanning) {
140-
Button(
141-
onClick = onStopScan,
142-
modifier = Modifier.fillMaxWidth(),
143-
colors = ButtonDefaults.buttonColors(containerColor = AccentRed)
144-
) { Text(stringResource(R.string.external_gps_stop_scan)) }
126+
}
127+
if (scanning && results.isEmpty()) {
128+
Spacer(Modifier.height(8.dp))
129+
HintText(stringResource(R.string.external_gps_no_results))
130+
}
131+
Spacer(Modifier.height(12.dp))
132+
if (scanning) {
133+
CircularProgressIndicator(modifier = Modifier.padding(8.dp))
134+
Spacer(Modifier.height(8.dp))
135+
Button(
136+
onClick = onStopScan,
137+
colors = ButtonDefaults.buttonColors(containerColor = AccentRed)
138+
) { Text(stringResource(R.string.external_gps_stop_scan)) }
139+
} else {
140+
Button(onClick = onStartScan) {
141+
Text(stringResource(R.string.external_gps_pair_button))
145142
}
146143
}
147144
}

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217
<string name="flic_double_click">Double Click</string>
218218
<string name="flic_hold">Hold</string>
219219
<string name="section_external_gps">External GPS</string>
220-
<string name="external_gps_caption">Pair a BLE GPS box (RaceBox) to log high-accuracy speed and position alongside the phone GPS. Extra columns appear at the end of each trip CSV.</string>
220+
<string name="external_gps_caption">Power on your RaceBox and tap Pair to scan. Once paired, its speed feeds the dashboard dial and a new column at the end of each trip CSV.</string>
221221
<string name="external_gps_pair_button">Pair external GPS</string>
222222
<string name="external_gps_pair_action">Pair</string>
223223
<string name="external_gps_scanning">Scanning for devices…</string>

0 commit comments

Comments
 (0)