NavigationTemplate.Builder

public static final class NavigationTemplate.Builder
extends Object

java.lang.Object
   ↳ com.google.android.libraries.car.app.navigation.model.NavigationTemplate.Builder


A builder of NavigationTemplate.

Summary

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, or null to use the default.

NavigationTemplate.Builder setDestinationTravelEstimate(TravelEstimate destinationTravelEstimate)

Sets the TravelEstimate to the final destination, or null to not show any travel estimate information.

NavigationTemplate.Builder setNavigationInfo(NavigationTemplate.NavigationInfo navigationInfo)

Sets the navigation information to display on the template, or null to not display navigation information on top of the map.

Inherited methods

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(CharSequence). 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, or null to use the default.

The host may ignore this color and use a default color instead if the color does not pass the contrast requirements.

Parameters
backgroundColor CarColor

Returns
NavigationTemplate.Builder

setDestinationTravelEstimate

public NavigationTemplate.Builder setDestinationTravelEstimate (TravelEstimate destinationTravelEstimate)

Sets the TravelEstimate to the final destination, or null to not show any travel estimate information.

Parameters
destinationTravelEstimate TravelEstimate

Returns
NavigationTemplate.Builder

setNavigationInfo

public NavigationTemplate.Builder setNavigationInfo (NavigationTemplate.NavigationInfo navigationInfo)

Sets the navigation information to display on the template, or null to not display navigation information on top of the map.

Parameters
navigationInfo NavigationTemplate.NavigationInfo

Returns
NavigationTemplate.Builder