NavigationTemplate.Builder

public static final class NavigationTemplate.Builder
extends Object

java.lang.Object
   ↳ androidx.car.app.navigation.model.NavigationTemplate.Builder


A builder of NavigationTemplate.

Summary

Public constructors

Builder()

Constructs an empty NavigationTemplate.Builder instance.

Public methods

NavigationTemplate build()

Constructs the NavigationTemplate defined by this builder.

NavigationTemplate.Builder setActionStrip(ActionStrip actionStrip)

Sets an ActionStrip with a list of template-scoped actions for this template.

NavigationTemplate.Builder setBackgroundColor(CarColor backgroundColor)

Sets the background color to use for the navigation information.

NavigationTemplate.Builder setDestinationTravelEstimate(TravelEstimate destinationTravelEstimate)

Sets the TravelEstimate to the final destination.

NavigationTemplate.Builder setMapActionStrip(ActionStrip actionStrip)

Sets an ActionStrip with a list of map-control related actions for this template, such as pan or zoom.

NavigationTemplate.Builder setNavigationInfo(NavigationTemplate.NavigationInfo navigationInfo)

Sets the navigation information to display on the template.

NavigationTemplate.Builder setPanModeListener(PanModeListener panModeListener)

Sets a PanModeListener that notifies when the user enters and exits the pan mode.

Inherited methods

Public constructors

Builder

public Builder ()

Constructs an empty NavigationTemplate.Builder instance.

Public methods

build

public NavigationTemplate build ()

Constructs the NavigationTemplate defined by this builder.

Returns
NavigationTemplate

Throws
IllegalStateException if an ActionStrip is not set on this template

setActionStrip

public NavigationTemplate.Builder setActionStrip (ActionStrip actionStrip)

Sets an ActionStrip with a list of template-scoped actions for this template.

Requirements

Besides Action.APP_ICON and Action.BACK, this template requires at least 1 and up to 4 Actions in its ActionStrip. Of the 4 allowed Actions, only one can contain a title as set via Action.Builder.setTitle(CarText). Otherwise, only Actions with icons are allowed.

Parameters
actionStrip ActionStrip

Returns
NavigationTemplate.Builder

Throws
IllegalArgumentException if actionStrip does not meet the template's requirements
NullPointerException if actionStrip is null

setBackgroundColor

public NavigationTemplate.Builder setBackgroundColor (CarColor backgroundColor)

Sets the background color to use for the navigation information.

Depending on contrast requirements, capabilities of the vehicle screens, or other factors, the color may be ignored by the host or overridden by the vehicle system.

Parameters
backgroundColor CarColor

Returns
NavigationTemplate.Builder

setDestinationTravelEstimate

public NavigationTemplate.Builder setDestinationTravelEstimate (TravelEstimate destinationTravelEstimate)

Sets the TravelEstimate to the final destination.

Parameters
destinationTravelEstimate TravelEstimate

Returns
NavigationTemplate.Builder