MapTemplate.Builder

public final class MapTemplate.Builder


A builder of MapTemplate.

Summary

Public constructors

Public methods

@NonNull MapTemplate

Constructs the template defined by this builder.

@NonNull MapTemplate.Builder

Sets the ActionStrip for this template.

@NonNull MapTemplate.Builder

Sets the Header for this template.

@NonNull MapTemplate.Builder

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

@NonNull MapTemplate.Builder

Sets the MapController for this template.

@NonNull MapTemplate.Builder

Sets the Pane for this template.

Public constructors

Builder

Added in 1.2.0
public Builder()

Public methods

build

Added in 1.2.0
public @NonNull MapTemplate build()

Constructs the template defined by this builder.

Requirements

A Pane and a Header must be set on the component.

The number of items in the ItemList should be smaller or equal than the limit provided by CONTENT_LIMIT_TYPE_PANE. The host will ignore any rows over that limit. Each Rows can add up to 2 lines of texts via addText and cannot contain either a Toggle or a .

Up to 2 Actions are allowed in the Pane. Each action's title color can be customized with ForegroundCarColorSpan instances. Any other span is not supported.

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

Throws
java.lang.IllegalArgumentException

if the Pane does not meet the requirements

java.lang.IllegalStateException

if both Pane and ItemList are set or are null.

setActionStrip

Added in 1.2.0
public @NonNull MapTemplate.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.2.0
public @NonNull MapTemplate.Builder setHeader(@NonNull Header header)

Sets the Header for this template.

Throws
java.lang.NullPointerException

if header is null

setItemList

Added in 1.3.0
public @NonNull MapTemplate.Builder setItemList(@NonNull ItemList itemList)

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

Unless set with this method, the template will not show an item list.

To show a marker corresponding to a point of interest represented by a row, set the Place instance via setMetadata. The host will display the PlaceMarker in both the map and the list view as the row becomes visible.

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 an image and a place marker.

Throws
java.lang.IllegalArgumentException

if itemList does not meet the template's requirements

java.lang.NullPointerException

if itemList is null

See also
getContentLimit

setMapController

Added in 1.2.0
public @NonNull MapTemplate.Builder setMapController(@NonNull MapController mapController)

Sets the MapController for this template.

setPane

Added in 1.2.0
public @NonNull MapTemplate.Builder setPane(@NonNull Pane pane)

Sets the Pane for this template. getImage for pane will not be shown in MapTemplate.

Unless set with this method, the template will not show a pane.

Requirements The number of items in the Pane should be smaller or equal than the limit provided by CONTENT_LIMIT_TYPE_PANE. The host via addText and cannot contain either a Toggle or a OnClickListener.

Up to 2 Actions are allowed in the Pane. Each action's title color can be customized with ForegroundCarColorSpan instances. Any other span is not supported.

If none of the header Action, the header title or the action strip have been set on the template, the header is hidden.

Throws
java.lang.IllegalArgumentException

if the Pane does not meet the requirements

java.lang.NullPointerException

if pane is null

See also
getContentLimit