InputSignInMethod.Builder

class InputSignInMethod.Builder


A builder of InputSignInMethod.

Summary

Public constructors

Returns an InputSignInMethod.Builder instance.

Public functions

InputSignInMethod

Builds an InputSignInMethod instance.

InputSignInMethod.Builder
setDefaultValue(defaultValue: String)

Sets the default value for this input.

InputSignInMethod.Builder

Sets the error message associated with this input box.

InputSignInMethod.Builder

Sets the text explaining to the user what should be entered in this input box.

InputSignInMethod.Builder
setInputType(inputType: Int)

Sets the input type.

InputSignInMethod.Builder
setKeyboardType(keyboardType: Int)

Sets the keyboard type to display when this input box gets focused.

InputSignInMethod.Builder
setShowKeyboardByDefault(showKeyboardByDefault: Boolean)

Sets whether keyboard should be opened by default when this template is presented.

Public constructors

Builder

Added in 1.1.0
Builder(listener: InputCallback)

Returns an InputSignInMethod.Builder instance.

Note that the listener relates to UI events and will be executed on the main thread using getMainLooper.

Parameters
listener: InputCallback

the InputCallbackDelegate to be notified of input events

Throws
java.lang.NullPointerException

if listener is null

Public functions

build

Added in 1.0.0
fun build(): InputSignInMethod

Builds an InputSignInMethod instance.

setDefaultValue

Added in 1.0.0
fun setDefaultValue(defaultValue: String): InputSignInMethod.Builder

Sets the default value for this input.

Unless set with this method, the input box will not have a default value.

For INPUT_TYPE_PASSWORD input types, in order to indicate that is not empty it is recommended to use a special value rather the actual credential. Any user input on a INPUT_TYPE_PASSWORD input box will replace this default value instead of appending to it.

Throws
java.lang.NullPointerException

if defaultValue is null

setErrorMessage

Added in 1.1.0
fun setErrorMessage(message: CharSequence): InputSignInMethod.Builder

Sets the error message associated with this input box.

For example, this can be used to indicate formatting errors, wrong username or password or any other problem related to the user input.

Requirements Error messages can have only up to 2 lines of text, amd additional texts beyond the second line may be truncated.

Spans are not supported in the input string and will be ignored.

Throws
java.lang.NullPointerException

if message is null

setHint

Added in 1.1.0
fun setHint(hint: CharSequence): InputSignInMethod.Builder

Sets the text explaining to the user what should be entered in this input box.

Unless set with this method, the sign-in method will not show any hint.

Spans are supported in the input string.

Throws
java.lang.NullPointerException

if hint is null

setInputType

Added in 1.0.0
fun setInputType(inputType: Int): InputSignInMethod.Builder

Sets the input type.

This must be one of INPUT_TYPE_DEFAULT or INPUT_TYPE_PASSWORD

If not set, INPUT_TYPE_DEFAULT will be assumed.

Throws
java.lang.IllegalArgumentException

if the provided input type is not supported

setKeyboardType

Added in 1.0.0
fun setKeyboardType(keyboardType: Int): InputSignInMethod.Builder

Sets the keyboard type to display when this input box gets focused.

This must be one of KEYBOARD_DEFAULT, KEYBOARD_PHONE, KEYBOARD_NUMBER, or KEYBOARD_EMAIL. A host might fall back to KEYBOARD_DEFAULT if they do not support a particular keyboard type. If not provided, KEYBOARD_DEFAULT will be used.

Throws
java.lang.IllegalArgumentException

if the provided type is not supported

setShowKeyboardByDefault

Added in 1.0.0
fun setShowKeyboardByDefault(showKeyboardByDefault: Boolean): InputSignInMethod.Builder

Sets whether keyboard should be opened by default when this template is presented. By default, keyboard will only be opened if the user focuses on the input box.