PlaceListNavigationTemplate.Builder

Added in 1.0.0
Deprecated in 1.7.0-beta03

public final class PlaceListNavigationTemplate.Builder


A builder of PlaceListNavigationTemplate.

Summary

Public constructors

Constructs an empty Builder instance.

Public methods

@NonNull PlaceListNavigationTemplate

Constructs the template defined by this builder.

@NonNull PlaceListNavigationTemplate.Builder

Sets the ActionStrip for this template.

@NonNull PlaceListNavigationTemplate.Builder
@RequiresCarApi(value = 5)
setHeader(@NonNull Header header)

Sets the Header for this template.

@NonNull PlaceListNavigationTemplate.Builder

This method is deprecated.

use setHeader

@NonNull PlaceListNavigationTemplate.Builder

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

@NonNull PlaceListNavigationTemplate.Builder
setLoading(boolean isLoading)

Sets whether the template is in a loading state.

@NonNull PlaceListNavigationTemplate.Builder

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

@NonNull PlaceListNavigationTemplate.Builder

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

@NonNull PlaceListNavigationTemplate.Builder

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

@NonNull PlaceListNavigationTemplate.Builder

This method is deprecated.

use setHeader

@NonNull PlaceListNavigationTemplate.Builder

This method is deprecated.

use setHeader

Public constructors

Builder

Added in 1.0.0
Deprecated in 1.7.0-beta03
public Builder()

Constructs an empty Builder instance.

Public methods

build

Added in 1.0.0
Deprecated in 1.7.0-beta03
public @NonNull PlaceListNavigationTemplate build()

Constructs the template defined by this builder.

Requirements

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

Throws
java.lang.IllegalArgumentException

if the template is in a loading state but the list is set, or vice versa

setActionStrip

Added in 1.0.0
Deprecated in 1.7.0-beta03
public @NonNull PlaceListNavigationTemplate.Builder setActionStrip(@NonNull 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 setTitle, or a icon Action as set via setIcon.
Throws
java.lang.IllegalArgumentException

if actionStrip does not meet the requirements

java.lang.NullPointerException

if actionStrip is null

setHeader

Added in 1.3.0
Deprecated in 1.7.0-beta03
@RequiresCarApi(value = 5)
public @NonNull PlaceListNavigationTemplate.Builder setHeader(@NonNull Header header)

Sets the Header for this template.

Throws
java.lang.NullPointerException

if header is null

setHeaderAction

Added in 1.0.0
Deprecated in 1.3.0
public @NonNull PlaceListNavigationTemplate.Builder setHeaderAction(@NonNull Action headerAction)

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 APP_ICON and BACK as a header Action.
Throws
java.lang.IllegalArgumentException

if headerAction does not meet the template's requirements

java.lang.NullPointerException

if headerAction is null

setItemList

Added in 1.0.0
Deprecated in 1.7.0-beta03
public @NonNull PlaceListNavigationTemplate.Builder setItemList(@NonNull 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 setMetadata. 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 CONTENT_LIMIT_TYPE_PLACE_LIST. The host will ignore any items over that limit. The list itself cannot be selectable as set via setOnSelectedListener. Each Row can add up to 2 lines of texts via addText and cannot contain a Toggle.

Images of type 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.

Throws
java.lang.IllegalArgumentException

if itemList does not meet the template's requirements

java.lang.NullPointerException

if itemList is null

See also
getContentLimit

setLoading

Added in 1.0.0
Deprecated in 1.7.0-beta03
public @NonNull 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 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 setItemList.

setMapActionStrip

Added in 1.1.0
Deprecated in 1.7.0-beta03
@RequiresCarApi(value = 4)
public @NonNull PlaceListNavigationTemplate.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

setOnContentRefreshListener

Added in 1.2.0
Deprecated in 1.7.0-beta03
public @NonNull PlaceListNavigationTemplate.Builder setOnContentRefreshListener(
    @NonNull 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 onGetTemplate.

Throws
java.lang.NullPointerException

if itemVisibilityChangedListener is null

setPanModeListener

Added in 1.1.0
Deprecated in 1.7.0-beta03
@RequiresCarApi(value = 4)
public @NonNull PlaceListNavigationTemplate.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

setTitle

Added in 1.1.0
Deprecated in 1.3.0
public @NonNull PlaceListNavigationTemplate.Builder setTitle(@NonNull CarText title)

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

Only DistanceSpans and DurationSpans are supported in the input string.

Throws
java.lang.NullPointerException

if title is null

java.lang.IllegalArgumentException

if title contains unsupported spans

See also
CarText

setTitle

Added in 1.0.0
Deprecated in 1.3.0
public @NonNull PlaceListNavigationTemplate.Builder setTitle(@NonNull CharSequence title)

Sets the title of the template.

Only DistanceSpans and DurationSpans are supported in the input string.

Throws
java.lang.NullPointerException

if title is null

java.lang.IllegalArgumentException

if title contains unsupported spans

See also
CarText