RouteDisplayInfo
data class RouteDisplayInfo(val durationSeconds: Long, val distanceMeters: Double, val duration: String, val length: String, val arrivalTime: String)
Display information for a single route option.
Contains both raw numeric values (for Android Auto spans) and pre-formatted strings. The phone app populates these fields from route details when routes are computed.
Why Both Raw and Formatted Values?
Android Auto's RoutePreviewNavigationTemplate requires rows to have DistanceSpan or DurationSpan attached, which need raw numeric values. But we also want pre-formatted strings for display consistency with the phone app.
Example Usage
// In phone app's MainViewModel onRoutesSet callback:
val displayRoute = RouteDisplayInfo(
durationSeconds = routeDetails.route.duration.toLong(),
distanceMeters = routeDetails.route.length.toDouble(),
duration = routeDetails.formattedText.duration, // e.g., "2h 30min"
length = routeDetails.formattedText.length, // e.g., "125 km"
arrivalTime = routeDetails.formattedText.arrivalTime // e.g., "14:30"
)Content copied to clipboard