TelephoneKeypadTemplate.Builder


public final class TelephoneKeypadTemplate.Builder


A builder for TelephoneKeypadTemplate.

Summary

Public constructors

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

Builder(
    @NonNull Action primaryAction,
    @NonNull TelephoneKeypadTemplate.PhoneNumberChangeListener numberChangeListener
)

Creates a builder for a TelephoneKeypadTemplate.

Public methods

@NonNull TelephoneKeypadTemplate.Builder

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

@NonNull TelephoneKeypadTemplate

Builds a TelephoneKeypadTemplate

@NonNull TelephoneKeypadTemplate.Builder

Sets the header to show in the template.

@NonNull 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).

@NonNull TelephoneKeypadTemplate.Builder

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

@NonNull TelephoneKeypadTemplate.Builder

Sets the callback for the keypad.

Public constructors

Builder

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

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

Builder

Added in 1.8.0-beta01
public Builder(
    @NonNull Action primaryAction,
    @NonNull TelephoneKeypadTemplate.PhoneNumberChangeListener numberChangeListener
)

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 methods

addKeySecondaryText

Added in 1.8.0-beta01
@CanIgnoreReturnValue
public @NonNull TelephoneKeypadTemplate.Builder addKeySecondaryText(int key, @NonNull CarText secondaryText)

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
public @NonNull TelephoneKeypadTemplate.Builder setHeader(@Nullable Header header)

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
public @NonNull TelephoneKeypadTemplate.Builder setKeySecondaryTexts(@NonNull Map<IntegerCarText> secondaryTexts)

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
public @NonNull TelephoneKeypadTemplate.Builder setPhoneNumber(@Nullable String phoneNumber)

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
public @NonNull TelephoneKeypadTemplate.Builder setTelephoneKeypadCallback(@Nullable TelephoneKeypadCallback callback)

Sets the callback for the keypad. See TelephoneKeypadCallback.