NavigationTemplate.Builder


class NavigationTemplate.Builder


A builder of NavigationTemplate.

Summary

Public constructors

Constructs an empty Builder instance.

Public functions

NavigationTemplate

Constructs the NavigationTemplate defined by this builder.

NavigationTemplate.Builder

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

NavigationTemplate.Builder
setBackgroundColor(backgroundColor: CarColor)

Sets the background color to use for the navigation information.

NavigationTemplate.Builder
setDestinationTravelEstimate(destinationTravelEstimate: TravelEstimate)

Sets the TravelEstimate to the final destination.

NavigationTemplate.Builder
@RequiresCarApi(value = 2)
setMapActionStrip(actionStrip: ActionStrip)

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

NavigationTemplate.Builder

Sets the navigation information to display on the template.

NavigationTemplate.Builder
@RequiresCarApi(value = 2)
setPanModeListener(panModeListener: PanModeListener)

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

Public constructors

Builder

Added in 1.0.0
Builder()

Constructs an empty Builder instance.

Public functions

build

Added in 1.0.0
fun build(): NavigationTemplate

Constructs the NavigationTemplate defined by this builder.

Throws
java.lang.IllegalStateException

if an ActionStrip is not set on this template

setActionStrip

Added in 1.0.0
fun setActionStrip(actionStrip: ActionStrip): NavigationTemplate.Builder

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

The Action buttons in Map Based Template are automatically adjusted based on the screen size. On narrow width screen, icon Actions show by default. If no icon specify, showing title Actions instead. On wider width screen, title Actions show by default. If no title specify, showing icon Actions instead.

Requirements This template allows up to 4 Actions in its ActionStrip. Of the 4 allowed Actions, it can either be a title Action as set via setTitle, or a icon Action as set via setIcon.
Throws
java.lang.IllegalArgumentException

if actionStrip does not meet the template's requirements

java.lang.NullPointerException

if actionStrip is null

setBackgroundColor

Added in 1.0.0
fun setBackgroundColor(backgroundColor: CarColor): NavigationTemplate.Builder

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.

setDestinationTravelEstimate

Added in 1.0.0
fun setDestinationTravelEstimate(destinationTravelEstimate: TravelEstimate): NavigationTemplate.Builder

Sets the TravelEstimate to the final destination.

Throws
java.lang.IllegalArgumentException

if the TravelEstimate's remaining time is less than zero unless the value provided is REMAINING_TIME_UNKNOWN

java.lang.NullPointerException

if destinationTravelEstimate is null

setMapActionStrip

Added in 1.1.0
@RequiresCarApi(value = 2)
fun setMapActionStrip(actionStrip: ActionStrip): NavigationTemplate.Builder

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

The host will draw the buttons in an area that is associated with map controls.

If the app does not include the PAN button in this ActionStrip, the app will not receive the user input for panning gestures from SurfaceCallback methods, and the host will exit any previously activated pan mode.

Requirements This template allows up to 4 Actions in its map ActionStrip. Only Actions with icons set via setIcon are allowed.
Throws
java.lang.IllegalArgumentException

if actionStrip does not meet the template's requirements

java.lang.NullPointerException

if actionStrip is null

setNavigationInfo

Added in 1.0.0
fun setNavigationInfo(navigationInfo: NavigationTemplate.NavigationInfo): NavigationTemplate.Builder

Sets the navigation information to display on the template.

Unless set with this method, navigation info won't be displayed on the template.

Throws
java.lang.NullPointerException

if navigationInfo is null

setPanModeListener

Added in 1.1.0
@RequiresCarApi(value = 2)
fun setPanModeListener(panModeListener: PanModeListener): NavigationTemplate.Builder

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

If the app does not include the PAN button in the map ActionStrip, the app will not receive the user input for panning gestures from SurfaceCallback methods, and the host will exit any previously activated pan mode.

Throws
java.lang.NullPointerException

if panModeListener is null