Skip to content

Commit 4ba61c1

Browse files
committed
Trip: you're a blue dot on the map, not a bus
The journey map drew your position with the bus marker. It's now a blue dot with a faint ring for how sure the GPS is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011C2fAvFFcMRkaF7qSvRA1v
1 parent 9384917 commit 4ba61c1

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎app/src/main/java/nz/aryan/akllive/ui/JourneyScreen.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ private fun JourneyView(vm: AppViewModel, it: Itinerary, from: Place?, to: Place
228228
live[r.tripId]?.vehicle?.let { v ->
229229
MapMarker(r.tripId, v.lat, v.lon, v.bearing, routeColor(r.route, r.mode), train = r.mode == Mode.Train, tag = r.route)
230230
}
231-
} + listOfNotNull(if (tracking && trip.lat != null) MapMarker("me", trip.lat!!, trip.lon!!, null, Color(0xFF1A73E8), train = false, tag = "You")
231+
} + listOfNotNull(if (tracking && trip.lat != null) MapMarker("me", trip.lat!!, trip.lon!!, null, Color(0xFF1A73E8), train = false, me = true, accuracy = trip.accuracy)
232232
else null)
233233
// the first fix of a trip brings the map to you
234234
var centred by remember(tracking) { mutableStateOf(false) }

‎app/src/main/java/nz/aryan/akllive/ui/LiveMap.kt‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ data class MapMarker(
112112
val train: Boolean,
113113
val tag: String? = null,
114114
val alert: Color? = null,
115+
/** you: a blue dot with a ring for how sure the GPS is (metres), not a vehicle */
116+
val me: Boolean = false,
117+
val accuracy: Float = 0f,
115118
)
116119

117120
/**
@@ -484,6 +487,18 @@ fun LiveMap(
484487
val pulse = 0.5f + 0.5f * sin(t * 4f)
485488
drawCircle(mk.color.copy(alpha = 0.2f + 0.2f * pulse), (20 + 8 * pulse) * dp, p)
486489
}
490+
if (mk.me) {
491+
val mpp = proj.getMetersPerPixelAtLatitude(la).takeIf { it > 0 } ?: 1.0
492+
val halo = (mk.accuracy / mpp).toFloat().coerceIn(0f, 400 * dp)
493+
if (halo > 12 * dp) {
494+
drawCircle(mk.color.copy(alpha = 0.14f), halo, p)
495+
drawCircle(mk.color.copy(alpha = 0.35f), halo, p, style = Stroke(1 * dp))
496+
}
497+
drawCircle(Color.Black.copy(alpha = 0.25f), 10 * dp, p + Offset(0f, 1 * dp))
498+
drawCircle(Color.White, 9.5f * dp, p)
499+
drawCircle(mk.color, 6.5f * dp, p)
500+
continue
501+
}
487502
if (mk.train) drawTrainMarker(p, mk, sel, dp) else drawBusMarker(p, mk, dp)
488503
mk.tag?.let { drawTag(measurer, it, p + Offset(0f, -(if (mk.train) 14 else 16) * dp), mk.color, Color.White, dp) }
489504
}

0 commit comments

Comments
 (0)