TelephoneKeypadTemplate.Builder


class TelephoneKeypadTemplate.Builder


A builder for TelephoneKeypadTemplate.

Summary

Public constructors

Create a Builder for a TelephoneKeypadTemplate with values from the given template.

Builder(
    primaryAction: Action,
    numberChangeListener: TelephoneKeypadTemplate.PhoneNumberChangeListener
)

Creates a builder for a TelephoneKeypadTemplate.

Public functions

TelephoneKeypadTemplate.Builder

Sets the secondary text underneath the numbers/symbols of the keypad, overwriting any text that already exists for the given key.

TelephoneKeypadTemplate

Builds a TelephoneKeypadTemplate

TelephoneKeypadTemplate.Builder

Sets the header to show in the template.

TelephoneKeypadTemplate.Builder

Sets all the given button's secondaryTexts, overwriting existing values, but not clearing any existing values (eg. if KEY_ONE was already added and the map passed in only included TWO, the result would be both ONE and TWO).

TelephoneKeypadTemplate.Builder

Sets the phone number to show in the dialer which can be edited before calling.

TelephoneKeypadTemplate.Builder

Sets the callback for the keypad.

Public constructors

Builder

Added in 1.8.0-beta01
Builder(template: TelephoneKeypadTemplate)

Create a Builder for a TelephoneKeypadTemplate with values from the given template.

Builder

Added in 1.8.0-beta01
Builder(
    primaryAction: Action,
    numberChangeListener: TelephoneKeypadTemplate.PhoneNumberChangeListener
)

Creates a builder for a TelephoneKeypadTemplate.

primaryAction is usually the "call" button, but can be set arbitrarily by the app (eg. it can be a hangup button when the user is in a call). This action must include an icon,must not have text, and may define a custom color (subject to contrast requirements). This action is subject to the constraints defined in ACTION_CONSTRAINTS_TELEPHONE_KEYPAD_PRIMARY.

The app must keep track of the dialed phone number via numberChangeListener because the primary action's setOnClickListener does not provide the fully dialed phone number.

Public functions

addKeySecondaryText

Added in 1.8.0-beta01
@CanIgnoreReturnValue
fun addKeySecondaryText(key: Int, secondaryText: CarText): TelephoneKeypadTemplate.Builder

Sets the secondary text underneath the numbers/symbols of the keypad, overwriting any text that already exists for the given key. Both icon and text is allowed (for example, showing a voicemail icon underneath the 1 key to denote that pressing and holding that key will automatically call voicemail). The secondaryText is subject to the constraints defined in TEXT_AND_ICON.

Throws an IllegalArgumentException for any invalid keys.

See also
setKeySecondaryTexts

to mass set button secondary text

setHeader

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

Sets the header to show in the template.

The start action of the header, if present, is subject to the constraints defined in ACTION_CONSTRAINTS_TELEPHONE_KEYPAD_HEADER.

setKeySecondaryTexts

Added in 1.8.0-beta01
@CanIgnoreReturnValue
fun setKeySecondaryTexts(secondaryTexts: (Mutable)Map<Int!, CarText!>): TelephoneKeypadTemplate.Builder

Sets all the given button's secondaryTexts, overwriting existing values, but not clearing any existing values (eg. if KEY_ONE was already added and the map passed in only included TWO, the result would be both ONE and TWO). Throws an IllegalArgumentException for any invalid keys.

See also
addKeySecondaryText

to set individual buttons

setPhoneNumber

Added in 1.8.0-beta01
@CanIgnoreReturnValue
fun setPhoneNumber(phoneNumber: String?): TelephoneKeypadTemplate.Builder

Sets the phone number to show in the dialer which can be edited before calling.

If a phone number is being edited in an existing instance of this template the value will be reset to the phone number in the new template.

setTelephoneKeypadCallback

Added in 1.8.0-beta01
@CanIgnoreReturnValue
fun setTelephoneKeypadCallback(callback: TelephoneKeypadCallback?): TelephoneKeypadTemplate.Builder

Sets the callback for the keypad. See TelephoneKeypadCallback.