InCallTemplate.Builder


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 functions

InCallTemplate.Builder

Adds an Action to display.

InCallTemplate.Builder

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

InCallTemplate.Builder

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

InCallTemplate

Constructs the InCallTemplate defined by this builder.

InCallTemplate.Builder

Sets the header to show in the template.

InCallTemplate.Builder

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

InCallTemplate.Builder

Sets whether the template is in a loading state.

InCallTemplate.Builder

Sets the title shown in the template body.

InCallTemplate.Builder

Sets the title shown in the template body.

Public constructors

Builder

Added in 1.8.0-beta01
Builder()

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

Builder

Added in 1.8.0-beta01
Builder(template: InCallTemplate)

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

Public functions

addAction

Added in 1.8.0-beta01
@CanIgnoreReturnValue
fun addAction(action: Action): InCallTemplate.Builder

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
fun addText(text: CarText): InCallTemplate.Builder

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
fun addText(text: CharSequence): InCallTemplate.Builder

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
fun build(): InCallTemplate

Constructs the InCallTemplate defined by this builder.

setHeader

Added in 1.8.0-beta01
@CanIgnoreReturnValue
fun setHeader(header: Header?): InCallTemplate.Builder

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
fun setIcon(icon: CarIcon?): InCallTemplate.Builder

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
fun setLoading(isLoading: Boolean): InCallTemplate.Builder

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
fun setTitle(title: CarText?): InCallTemplate.Builder

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
fun setTitle(title: CharSequence?): InCallTemplate.Builder

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.