NavigationTemplate.Builder


public final class NavigationTemplate.Builder


A builder of NavigationTemplate.

Summary

Public constructors

Constructs an empty Builder instance.

Public methods

@NonNull NavigationTemplate

Constructs the NavigationTemplate defined by this builder.

@NonNull NavigationTemplate.Builder

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

@NonNull NavigationTemplate.Builder

Sets the background color to use for the navigation information.

@NonNull NavigationTemplate.Builder
setDestinationTravelEstimate(
    @NonNull TravelEstimate destinationTravelEstimate
)

Sets the TravelEstimate to the final destination.

@NonNull NavigationTemplate.Builder

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

@NonNull NavigationTemplate.Builder

Sets the navigation information to display on the template.

@NonNull NavigationTemplate.Builder

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

Public constructors

Builder

Added in 1.0.0
public Builder()

Constructs an empty Builder instance.

Public methods

build

Added in 1.0.0
public @NonNull NavigationTemplate build()

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
public @NonNull NavigationTemplate.Builder setActionStrip(@NonNull ActionStrip actionStrip)

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
public @NonNull NavigationTemplate.Builder setBackgroundColor(@NonNull 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.

setDestinationTravelEstimate

Added in 1.0.0
public @NonNull NavigationTemplate.Builder setDestinationTravelEstimate(
    @NonNull TravelEstimate destinationTravelEstimate
)

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)
public @NonNull NavigationTemplate.Builder setMapActionStrip(@NonNull ActionStrip actionStrip)

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
public @NonNull NavigationTemplate.Builder setNavigationInfo(
    @NonNull NavigationTemplate.NavigationInfo navigationInfo
)

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)
public @NonNull NavigationTemplate.Builder setPanModeListener(@NonNull PanModeListener panModeListener)

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