routePreview

fun routePreview(routesPreview: RoutesPreview, title: CharSequence, navigateActionTitle: CharSequence, formatDistance: (Double) -> CharSequence, onRouteSelected: (routeId: String) -> Unit, onNavigate: (routeId: String) -> Unit, navigateActionIcon: CarIcon? = null): ListTemplate

Builds the route preview list used as the content of a androidx.car.app.navigation.model.MapWithContentTemplate by the Mapbox navigation screen. Every row shows the duration, summary and distance of a route and has a navigate action. An empty RoutesPreview.originalRoutesList shows a loading list.

Parameters

routesPreview

the routes to choose from. Rows follow RoutesPreview.originalRoutesList and the row at RoutesPreview.primaryRouteIndex is selected.

title

the title of the list header.

navigateActionTitle

the title of the navigate action.

formatDistance

formats a route distance in meters.

onRouteSelected

invoked with the com.mapbox.navigation.base.route.NavigationRoute.id of the row the driver selected.

onNavigate

invoked with the com.mapbox.navigation.base.route.NavigationRoute.id of the row whose navigate action the driver tapped.

navigateActionIcon

optional icon of the navigate action.