public final class

RoutePreviewNavigationTemplate.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.car.app.navigation.model.RoutePreviewNavigationTemplate.Builder

Overview

A builder of RoutePreviewNavigationTemplate.

Summary

Constructors
publicBuilder()

Constructs an empty RoutePreviewNavigationTemplate.Builder instance.

Methods
public RoutePreviewNavigationTemplatebuild()

Constructs the template defined by this builder.

public RoutePreviewNavigationTemplate.BuildersetActionStrip(ActionStrip actionStrip)

Sets the ActionStrip for this template.

public RoutePreviewNavigationTemplate.BuildersetHeader(Header header)

Sets the Header for this template.

public RoutePreviewNavigationTemplate.BuildersetHeaderAction(Action headerAction)

Sets the Action that will be displayed in the header of the template, or null to not display an action.

public RoutePreviewNavigationTemplate.BuildersetItemList(ItemList itemList)

Sets an ItemList to show route options in a list view along with the map.

public RoutePreviewNavigationTemplate.BuildersetLoading(boolean isLoading)

Sets whether the template is in a loading state.

public RoutePreviewNavigationTemplate.BuildersetMapActionStrip(ActionStrip actionStrip)

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

public RoutePreviewNavigationTemplate.BuildersetNavigateAction(Action navigateAction)

Sets the Action to allow users to request navigation using the currently selected route.

public RoutePreviewNavigationTemplate.BuildersetPanModeListener(PanModeListener panModeListener)

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

public RoutePreviewNavigationTemplate.BuildersetTitle(CarText title)

Sets the title of the template, with support for multiple length variants.

public RoutePreviewNavigationTemplate.BuildersetTitle(java.lang.CharSequence title)

Sets the title of the template.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder()

Constructs an empty RoutePreviewNavigationTemplate.Builder instance.

Methods

public RoutePreviewNavigationTemplate.Builder setTitle(java.lang.CharSequence title)

Deprecated: use RoutePreviewNavigationTemplate.Builder.setHeader(Header)

Sets the title of the template.

Only DistanceSpans and DurationSpans are supported in the input string.

See also: CarText

Deprecated: use RoutePreviewNavigationTemplate.Builder.setHeader(Header)

Sets the title of the template, with support for multiple length variants.

Only DistanceSpans and DurationSpans are supported in the input string.

See also: CarText

public RoutePreviewNavigationTemplate.Builder setLoading(boolean isLoading)

Sets whether the template is in a loading state.

If set to true, the UI will show a loading indicator where the list content would be otherwise. The caller is expected to call Screen.invalidate() and send the new template content to the host once the data is ready.

public RoutePreviewNavigationTemplate.Builder setHeaderAction(Action headerAction)

Deprecated: use RoutePreviewNavigationTemplate.Builder.setHeader(Header)

Sets the Action that will be displayed in the header of the template, or null to not display an action.

Unless set with this method, the template will not have a header action.

Requirements

This template only supports either one of Action.APP_ICON and Action.BACK as a header Action.

public RoutePreviewNavigationTemplate.Builder setNavigateAction(Action navigateAction)

Sets the Action to allow users to request navigation using the currently selected route.

This should not be null if the template is not in a loading state (see #setIsLoading}), and the Action's title must be set.

Spans are not supported in the navigate action and will be ignored.

Sets the Header for this template.

Sets an ItemList to show route options in a list view along with the map.

Requirements

The number of items in the ItemList should be smaller or equal than the limit provided by ConstraintManager.CONTENT_LIMIT_TYPE_ROUTE_LIST. The host will ignore any items over that limit. The list must have an OnClickListener set. Each Row can add up to 2 lines of texts via and cannot contain a Toggle.

Images of type Row.IMAGE_TYPE_LARGE are not allowed in this template.

All rows must have either a DistanceSpan or a DurationSpan attached to either its title or texts, to indicate an estimate trip distance or duration for the route it represents. Where in the title or text these spans are attached to is up to the app.

See also: ConstraintManager.getContentLimit(int)

public RoutePreviewNavigationTemplate.Builder setActionStrip(ActionStrip actionStrip)

Sets the ActionStrip for this template.

Unless set with this method, the template will not have an action strip.

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 , or a icon Action as set via .

public RoutePreviewNavigationTemplate.Builder setMapActionStrip(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 Action.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 are allowed.

public RoutePreviewNavigationTemplate.Builder setPanModeListener(PanModeListener panModeListener)

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

If the app does not include the Action.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.

Constructs the template defined by this builder.

Requirements

If neither header Action nor title have been set on the template, the header is hidden.