PasswordCredentialEntry.Builder


public final class PasswordCredentialEntry.Builder


Builder for PasswordCredentialEntry

Summary

Public constructors

Builder(
    @NonNull Context context,
    @NonNull CharSequence username,
    @NonNull PendingIntent pendingIntent,
    @NonNull BeginGetPasswordOption beginGetPasswordOption
)

constructs an instance of PasswordCredentialEntry.Builder

Public methods

final @NonNull PasswordCredentialEntry

Builds an instance of PasswordCredentialEntry

final @NonNull PasswordCredentialEntry.Builder

Sets whether the entry should have an affiliated domain, a CharSequence representation of some larger entity that may be used to bind multiple entries together (e.g. app_one, and app_two may be bound by 'super_app' as the larger affiliation domain) without length limit, default null.

final @NonNull PasswordCredentialEntry.Builder
setAutoSelectAllowed(boolean autoSelectAllowed)

Sets whether the entry should be auto-selected.

final @NonNull PasswordCredentialEntry.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 PasswordCredentialEntry.Builder

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

final @NonNull PasswordCredentialEntry.Builder

Sets the icon to be shown on the UI with this entry.

final @NonNull PasswordCredentialEntry.Builder
setLastUsedTime(Instant lastUsedTime)

Sets the last used time of this account.

Public constructors

Builder

Added in 1.2.0
public Builder(
    @NonNull Context context,
    @NonNull CharSequence username,
    @NonNull PendingIntent pendingIntent,
    @NonNull BeginGetPasswordOption beginGetPasswordOption
)

constructs an instance of PasswordCredentialEntry.Builder

Parameters
@NonNull Context context

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

@NonNull CharSequence username

the username of the account holding the password credential

@NonNull PendingIntent pendingIntent

the PendingIntent that will get invoked when the user selects this entry, must be created with a unique request code per entry, with flag PendingIntent.FLAG_MUTABLE to allow the Android system to attach the final request, and NOT with flag PendingIntent.FLAG_ONE_SHOT as it can be invoked multiple times

@NonNull BeginGetPasswordOption beginGetPasswordOption

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 PasswordCredentialEntry build()

Builds an instance of PasswordCredentialEntry

setAffiliatedDomain

Added in 1.3.0-alpha03
public final @NonNull PasswordCredentialEntry.Builder setAffiliatedDomain(CharSequence affiliatedDomain)

Sets whether the entry should have an affiliated domain, a CharSequence representation of some larger entity that may be used to bind multiple entries together (e.g. app_one, and app_two may be bound by 'super_app' as the larger affiliation domain) without length limit, default null.

setAutoSelectAllowed

Added in 1.2.0
public final @NonNull PasswordCredentialEntry.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 PasswordCredentialEntry.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.

setDisplayName

Added in 1.2.0
public final @NonNull PasswordCredentialEntry.Builder setDisplayName(CharSequence displayName)

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

setIcon

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

Sets the icon to be shown on the UI with this entry.

setLastUsedTime

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

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