InCallTemplate.Builder
class InCallTemplate.Builder
A builder for InCallTemplate.
Summary
Public constructors |
|---|
Builder()Returns a |
Builder(template: InCallTemplate)Returns a |
Public functions |
|
|---|---|
InCallTemplate.Builder |
@CanIgnoreReturnValueAdds an |
InCallTemplate.Builder |
@CanIgnoreReturnValueAdds 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 |
build()Constructs the |
InCallTemplate.Builder |
@CanIgnoreReturnValueSets the header to show in the template. |
InCallTemplate.Builder |
@CanIgnoreReturnValueSets the icon that appears in the body of the template. |
InCallTemplate.Builder |
@CanIgnoreReturnValueSets whether the template is in a loading state. |
InCallTemplate.Builder |
@CanIgnoreReturnValueSets the title shown in the template body. |
InCallTemplate.Builder |
@CanIgnoreReturnValueSets the title shown in the template body. |
Public constructors
Builder
Builder()
Returns a InCallTemplate.Builder instance with no values set by default.
Builder
Builder(template: InCallTemplate)
Returns a InCallTemplate.Builder instance with values from the template.
Public functions
addAction
@CanIgnoreReturnValue
fun addAction(action: Action): InCallTemplate.Builder
Adds an Action to display.
Requirements
This template allows up to 5Actions 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 |
java.lang.IllegalArgumentException |
if |
addText
@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 |
java.lang.IllegalArgumentException |
if |
addText
@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 |
java.lang.IllegalArgumentException |
if |
build
fun build(): InCallTemplate
Constructs the InCallTemplate defined by this builder.
setHeader
@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
@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.
setLoading
@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
@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.
setTitle
@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 |