CustomCredentialEntry.Builder


public final class CustomCredentialEntry.Builder


Builder for CustomCredentialEntry

Summary

Public constructors

Builder(
    @NonNull Context context,
    @NonNull String type,
    @NonNull CharSequence title,
    @NonNull PendingIntent pendingIntent,
    @NonNull BeginGetCredentialOption beginGetCredentialOption
)

constructs an instance of CustomCredentialEntry.Builder

Public methods

final @NonNull CustomCredentialEntry

Builds an instance of CustomCredentialEntry

final @NonNull CustomCredentialEntry.Builder
setAutoSelectAllowed(boolean autoSelectAllowed)

Sets whether the entry should be auto-selected.

final @NonNull CustomCredentialEntry.Builder
setDefaultIconPreferredAsSingleProvider(
    boolean isDefaultIconPreferredAsSingleProvider
)

When set to true, the UI prefers to render the default credential type icon when you are the single available provider; false by default.

final @NonNull CustomCredentialEntry.Builder

Sets an ID to uniquely mark this entry for deduplication or for grouping entries during display; if not set, will default to title.

final @NonNull CustomCredentialEntry.Builder

Sets the icon to be show on the UI.

final @NonNull CustomCredentialEntry.Builder
setLastUsedTime(Instant lastUsedTime)

Sets the last used time of this account.

final @NonNull CustomCredentialEntry.Builder

Sets a displayName to be shown on the UI with this entry.

final @NonNull CustomCredentialEntry.Builder

Sets the display name of this credential type, to be shown on the UI with this entry.

Public constructors

Builder

Added in 1.2.0
public Builder(
    @NonNull Context context,
    @NonNull String type,
    @NonNull CharSequence title,
    @NonNull PendingIntent pendingIntent,
    @NonNull BeginGetCredentialOption beginGetCredentialOption
)

constructs an instance of CustomCredentialEntry.Builder

Parameters
@NonNull Context context

the context of the calling app, required to retrieve fallback resources

@NonNull String type

the type string that defines this custom credential

@NonNull CharSequence title

the title shown with this entry on the selector UI

@NonNull PendingIntent pendingIntent

the PendingIntent that will get invoked when the user selects this entry, must be created with flag PendingIntent.FLAG_MUTABLE to allow the Android system to attach the final request

@NonNull BeginGetCredentialOption beginGetCredentialOption

the option from the original BeginGetCredentialResponse, for which this credential entry is being added

Public methods

build

Added in 1.2.0
public final @NonNull CustomCredentialEntry build()

Builds an instance of CustomCredentialEntry

setAutoSelectAllowed

Added in 1.2.0
public final @NonNull CustomCredentialEntry.Builder setAutoSelectAllowed(boolean autoSelectAllowed)

Sets whether the entry should be auto-selected. The value is false by default.

setDefaultIconPreferredAsSingleProvider

Added in 1.3.0-alpha03
public final @NonNull CustomCredentialEntry.Builder setDefaultIconPreferredAsSingleProvider(
    boolean isDefaultIconPreferredAsSingleProvider
)

When set to true, the UI prefers to render the default credential type icon when you are the single available provider; false by default.

setEntryGroupId

Added in 1.3.0-alpha03
public final @NonNull CustomCredentialEntry.Builder setEntryGroupId(@NonNull CharSequence entryGroupId)

Sets an ID to uniquely mark this entry for deduplication or for grouping entries during display; if not set, will default to title.

Throws
kotlin.IllegalArgumentException

If the entryGroupId is empty

setIcon

Added in 1.2.0
public final @NonNull CustomCredentialEntry.Builder setIcon(@NonNull Icon icon)

Sets the icon to be show on the UI. If no icon is set, a default icon representing a custom credential will be set.

setLastUsedTime

Added in 1.2.0
public final @NonNull CustomCredentialEntry.Builder setLastUsedTime(Instant lastUsedTime)

Sets the last used time of this account. This information will be used to sort the entries on the selector.

setSubtitle

Added in 1.2.0
public final @NonNull CustomCredentialEntry.Builder setSubtitle(CharSequence subtitle)

Sets a displayName to be shown on the UI with this entry.

setTypeDisplayName

Added in 1.2.0
public final @NonNull CustomCredentialEntry.Builder setTypeDisplayName(CharSequence typeDisplayName)

Sets the display name of this credential type, to be shown on the UI with this entry.