PaneTemplate.Builder


public final class PaneTemplate.Builder


A builder of PaneTemplate.

Summary

Public constructors

Returns a new instance of a @link Builder}.

Public methods

@NonNull PaneTemplate

Constructs the template defined by this builder.

@NonNull PaneTemplate.Builder

This method is deprecated.

Use for each action

@NonNull PaneTemplate.Builder
@RequiresCarApi(value = 7)
setHeader(@NonNull Header header)

Sets the Header for this template.

@NonNull PaneTemplate.Builder

This method is deprecated.

Use setStartHeaderAction

@NonNull PaneTemplate.Builder

This method is deprecated.

Use setTitle

Public constructors

Builder

Added in 1.0.0
public Builder(@NonNull Pane pane)

Returns a new instance of a @link Builder}.

Throws
java.lang.NullPointerException

if pane is null

Public methods

build

Added in 1.0.0
public @NonNull PaneTemplate build()

Constructs the template defined by this builder.

Requirements 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 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

See also
getContentLimit

setActionStrip

Added in 1.0.0
Deprecated in 1.7.0-beta03
public @NonNull PaneTemplate.Builder setActionStrip(@NonNull ActionStrip actionStrip)

Sets the ActionStrip for this template.

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

Requirements This template allows up to 2 Actions in its ActionStrip. Of the 2 allowed Actions, one of them can contain a title as set via setTitle. Otherwise, only Actions with icons are allowed.
Throws
java.lang.IllegalArgumentException

if actionStrip does not meet the requirements

java.lang.NullPointerException

if actionStrip is null

setHeader

Added in 1.7.0-beta03
@RequiresCarApi(value = 7)
public @NonNull PaneTemplate.Builder setHeader(@NonNull Header header)

Sets the Header for this template.

The end header actions will show up differently inside vs outside of a map template. See addEndHeaderAction for more details.

Throws
java.lang.NullPointerException

if header is null

setHeaderAction

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

setTitle

Added in 1.0.0
Deprecated in 1.7.0-beta03
public @NonNull PaneTemplate.Builder setTitle(@NonNull CharSequence title)

Sets the title of the template.

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

Only DistanceSpans, DurationSpans and CarIconSpan 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