public final class

PlaceListNavigationTemplate.Builder

extends java.lang.Object

 java.lang.Object

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

Overview

A builder of PlaceListNavigationTemplate.

Summary

Constructors
publicBuilder()

Constructs an empty PlaceListNavigationTemplate.Builder instance.

Methods
public PlaceListNavigationTemplatebuild()

Constructs the template defined by this builder.

public PlaceListNavigationTemplate.BuildersetActionStrip(ActionStrip actionStrip)

Sets the ActionStrip for this template.

public PlaceListNavigationTemplate.BuildersetHeader(Header header)

Sets the Header for this template.

public PlaceListNavigationTemplate.BuildersetHeaderAction(Action headerAction)

Sets the Action that will be displayed in the header of the template.

public PlaceListNavigationTemplate.BuildersetItemList(ItemList itemList)

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

public PlaceListNavigationTemplate.BuildersetLoading(boolean isLoading)

Sets whether the template is in a loading state.

public PlaceListNavigationTemplate.BuildersetMapActionStrip(ActionStrip actionStrip)

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

public PlaceListNavigationTemplate.BuildersetOnContentRefreshListener(OnContentRefreshListener onContentRefreshListener)

Sets the OnContentRefreshListener to call when the user requests for the list contents to be refreshed in this template.

public PlaceListNavigationTemplate.BuildersetPanModeListener(PanModeListener panModeListener)

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

public PlaceListNavigationTemplate.BuildersetTitle(CarText title)

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

public PlaceListNavigationTemplate.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 PlaceListNavigationTemplate.Builder instance.

Methods

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

Deprecated: use PlaceListNavigationTemplate.Builder.setHeader(Header)

Sets the title of the template.

Only DistanceSpans and DurationSpans are supported in the input string.

See also: CarText

Deprecated: use PlaceListNavigationTemplate.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 PlaceListNavigationTemplate.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. If set to false, the UI shows the ItemList contents added via PlaceListNavigationTemplate.Builder.setItemList(ItemList).

public PlaceListNavigationTemplate.Builder setHeaderAction(Action headerAction)

Deprecated: use PlaceListNavigationTemplate.Builder.setHeader(Header)

Sets the Action that will be displayed in the header of the template.

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 PlaceListNavigationTemplate.Builder setItemList(ItemList itemList)

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

To show a marker corresponding to a point of interest represented by a row, set the Place instance via . The host will render the PlaceMarker in the list view as the row become visible. The app should synchronize with the list's behavior by rendering the same marker on the map surface.

Requirements

The number of items in the ItemList should be smaller or equal than the limit provided by ConstraintManager.CONTENT_LIMIT_TYPE_PLACE_LIST. The host will ignore any items over that limit. The list itself cannot be selectable as set via . 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.

Rows are not allowed to have both and an image and a place marker.

All non-browsable rows must have a DistanceSpan attached to either its title or texts, to indicate the distance of the point of interest from the current location. Where in the title or text the span is attached to is up to the app.

See also: ConstraintManager.getContentLimit(int)

Sets the Header for this template.

public PlaceListNavigationTemplate.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 PlaceListNavigationTemplate.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 PlaceListNavigationTemplate.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.

public PlaceListNavigationTemplate.Builder setOnContentRefreshListener(OnContentRefreshListener onContentRefreshListener)

Sets the OnContentRefreshListener to call when the user requests for the list contents to be refreshed in this template.

When the listener is triggered, an app can send a new PlaceListMapTemplate, for example, to show a new set of point-of-interests based on the current user location, without the car host counting it against the template quota described in Screen.onGetTemplate().

Constructs the template defined by this builder.

Requirements

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