SignInTemplate.Builder

public static final class SignInTemplate.Builder
extends Object

java.lang.Object
   ↳ androidx.car.app.model.signin.SignInTemplate.Builder


A builder of SignInTemplate.

Summary

Public constructors

Builder(SignInTemplate.SignInMethod signInMethod)

Returns a SignInTemplate.Builder instance.

Public methods

SignInTemplate.Builder addAction(Action action)

Adds an Action to display alongside the sign-in content.

SignInTemplate build()

Constructs the template defined by this builder.

SignInTemplate.Builder setActionStrip(ActionStrip actionStrip)

Sets the ActionStrip for this template.

SignInTemplate.Builder setAdditionalText(CharSequence additionalText)

Sets additional text, such as disclaimers, links to terms of services, to show in the template.

SignInTemplate.Builder setHeaderAction(Action headerAction)

Sets the Action that will be displayed in the header of the template.

SignInTemplate.Builder setInstructions(CharSequence instructions)

Sets the text to show as instructions of the template.

SignInTemplate.Builder setTitle(CharSequence title)

Sets the title of the template.

Inherited methods

Public constructors

Builder

public Builder (SignInTemplate.SignInMethod signInMethod)

Returns a SignInTemplate.Builder instance.

Parameters
signInMethod SignInTemplate.SignInMethod: the sign-in method to use in this template

Throws
NullPointerException if the signInMethod is null

Public methods

addAction

public SignInTemplate.Builder addAction (Action action)

Adds an Action to display alongside the sign-in content.

By default, no actions are displayed.

Requirements

This template allows up to 2 Actions.

Parameters
action Action

Returns
SignInTemplate.Builder

Throws
NullPointerException if action is null
IllegalStateException if more than two actions have been added.

build

public SignInTemplate build ()

Constructs the template defined by this builder.

Requirements

Either a header Action or the title must be set.

Returns
SignInTemplate

Throws
IllegalStateException if the template does not have either a title or header Action set

setActionStrip

public SignInTemplate.Builder setActionStrip (ActionStrip actionStrip)

Sets the ActionStrip for this template.

Unless set with this method, the template will not have an action strip.

Requirements

This template allows up to 2 Actions in its ActionStrip. Of the 2 allowed Actions, one of them can contain a title as set via Action.Builder.setTitle(CarText). Otherwise, only Actions with icons are allowed.

Parameters
actionStrip ActionStrip

Returns
SignInTemplate.Builder

Throws
IllegalArgumentException if actionStrip does not meet the requirements
NullPointerException if actionStrip is null

setAdditionalText

public SignInTemplate.Builder setAdditionalText (CharSequence additionalText)

Sets additional text, such as disclaimers, links to terms of services, to show in the template.

Unless set with this method, the template will not have additional text.

Spans are supported in the input string.

Parameters
additionalText CharSequence

Returns
SignInTemplate.Builder

Throws
NullPointerException if additionalText is null

See also:

setHeaderAction

public SignInTemplate.Builder setHeaderAction (Action headerAction)

Sets the Action that will be displayed in the header of the template.

Unless set with this method, the template will not have a header action.

Requirements

This template only supports either one of Action.APP_ICON and Action.BACK as a header Action.

Parameters
headerAction Action

Returns
SignInTemplate.Builder

Throws
IllegalArgumentException if headerAction does not meet the template's requirements
NullPointerException if headerAction is null

setInstructions

public SignInTemplate.Builder setInstructions (CharSequence instructions)

Sets the text to show as instructions of the template.

Unless set with this method, the template will not have instructions.

Spans are supported in the input string.

Parameters
instructions CharSequence

Returns
SignInTemplate.Builder

Throws
NullPointerException if instructions is null

setTitle

public SignInTemplate.Builder setTitle (CharSequence title)

Sets the title of the template.

Unless set with this method, the template will not have a title.

Spans are not supported in the input string.

Parameters
title CharSequence

Returns
SignInTemplate.Builder

Throws
NullPointerException if title is null