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"
)

Constructors

Link copied to clipboard
constructor(durationSeconds: Long, distanceMeters: Double, duration: String, length: String, arrivalTime: String)

Properties

Link copied to clipboard

Formatted arrival time string (e.g., "14:30")

Link copied to clipboard

Route distance in meters (for Android Auto DistanceSpan)

Link copied to clipboard

Formatted duration string (e.g., "2h 30min")

Link copied to clipboard

Route duration in seconds (for Android Auto DurationSpan)

Link copied to clipboard

Formatted distance string (e.g., "125 km")