InCallTemplate.Builder


public final class InCallTemplate.Builder


A builder for InCallTemplate.

Summary

Public constructors

Returns a InCallTemplate.Builder instance with no values set by default.

Returns a InCallTemplate.Builder instance with values from the template.

Public methods

@NonNull InCallTemplate.Builder

Adds an Action to display.

@NonNull InCallTemplate.Builder

Adds a text string below the title, with support for multiple length variants.

@NonNull InCallTemplate.Builder

Adds a text string below the title, with support for multiple length variants.

@NonNull InCallTemplate

Constructs the InCallTemplate defined by this builder.

@NonNull InCallTemplate.Builder

Sets the header to show in the template.

@NonNull InCallTemplate.Builder

Sets the icon that appears in the body of the template.

@NonNull InCallTemplate.Builder
@CanIgnoreReturnValue
setLoading(boolean isLoading)

Sets whether the template is in a loading state.

@NonNull InCallTemplate.Builder

Sets the title shown in the template body.

@NonNull InCallTemplate.Builder

Sets the title shown in the template body.

Public constructors

Builder

Added in 1.8.0-beta01
public Builder()

Returns a InCallTemplate.Builder instance with no values set by default.

Builder

Added in 1.8.0-beta01
public Builder(@NonNull InCallTemplate template)

Returns a InCallTemplate.Builder instance with values from the template.

Public methods

addAction

Added in 1.8.0-beta01
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder addAction(@NonNull Action action)

Adds an Action to display.

Requirements

This template allows up to 5 Actions in its body. Each action must have an icon and cannot have a title. A single action may be flagged with FLAG_PRIMARY.
Throws
java.lang.NullPointerException

if action is null

java.lang.IllegalArgumentException

if action does not meet the requirements

addText

Added in 1.8.0-beta01
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder addText(@NonNull CarText text)

Adds a text string below the title, with support for multiple length variants.

A maximum of {@value #MAX_TEXTS_SIZE} text strings can be added.

Throws
java.lang.NullPointerException

if text is null

java.lang.IllegalArgumentException

if text contains unsupported spans

addText

Added in 1.8.0-beta01
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder addText(@NonNull CharSequence text)

Adds a text string below the title, with support for multiple length variants.

A maximum of {@value #MAX_TEXTS_SIZE} text strings can be added.

Throws
java.lang.NullPointerException

if text is null

java.lang.IllegalArgumentException

if text contains unsupported spans

build

Added in 1.8.0-beta01
public @NonNull InCallTemplate build()

Constructs the InCallTemplate defined by this builder.

setHeader

Added in 1.8.0-beta01
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder setHeader(@Nullable Header header)

Sets the header to show in the template.

If a start Action is set in the Header, it must conform to the constraints in ACTION_CONSTRAINTS_IN_CALL_HEADER.

setIcon

Added in 1.8.0-beta01
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder setIcon(@Nullable CarIcon icon)

Sets the icon that appears in the body of the template.

Note that the Header may also contain an icon in the form of a start header Action.

Throws
java.lang.IllegalArgumentException

if the CarIcon does not meet the constraints in DEFAULT.

setLoading

Added in 1.8.0-beta01
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder setLoading(boolean isLoading)

Sets whether the template is in a loading state.

If set to true, the UI shows a loading indicator where text list and actions 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 template content is set this must be false or an exception will be thrown in build.

setTitle

Added in 1.8.0-beta01
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder setTitle(@Nullable CarText title)

Sets the title shown in the template body.

Note that setHeader also has title which shows above the template body.

Throws
java.lang.IllegalArgumentException

if the CarText does not meet the constraints in TEXT_ONLY.

setTitle

Added in 1.8.0-beta01
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder setTitle(@Nullable CharSequence title)

Sets the title shown in the template body.

Note that setHeader also has title which shows above the template body.

Throws
java.lang.IllegalArgumentException

if the CharSequence does not meet the constraints in TEXT_ONLY.