GuidedAction.BuilderBase


public abstract class GuidedAction.BuilderBase<B extends GuidedAction.BuilderBase>

Known direct subclasses
GuidedAction.Builder

Builds a GuidedAction object.

GuidedDatePickerAction.BuilderBase

Base Builder class to build GuidedDatePickerAction.

Known indirect subclasses
GuidedDatePickerAction.Builder

Builder class to build a GuidedDatePickerAction.


Base builder class to build a GuidedAction object. When subclass GuidedAction, you can override this BuilderBase class, implements your build() method which should call applyValues. When using GuidedAction directly, use Builder.

Parameters
<B extends GuidedAction.BuilderBase>

the type of BuilderBase

Summary

Public constructors

Creates a BuilderBase for GuidedAction or its subclass.

Public methods

B
autoSaveRestoreEnabled(boolean autoSaveRestoreEnabled)

Explicitly sets auto restore feature on the GuidedAction.

B
autofillHints(@Nullable String[] hints)

Sets autofill hints.

B
checkSetId(int checkSetId)

Indicates whether this action is part of a single-select group similar to radio buttons or this action is a checkbox.

B
checked(boolean checked)

Indicates whether this action is initially checked.

B
clickAction(long id)

Construct a clickable action with associated id and auto assign pre-defined title for the action.

B

Sets the description for this action.

B
description(@StringRes int descriptionResourceId)

Sets the description for this action.

B
descriptionEditInputType(int inputType)

Sets InputType of this action description in editing.

B
descriptionEditable(boolean editable)

Indicates whether this action's description is editable

B
descriptionInputType(int inputType)

Sets InputType of this action description not in editing.

B

Sets the optional description text to edit.

B
editDescription(@StringRes int descriptionResourceId)

Sets the optional description text to edit.

B
editInputType(int inputType)

Sets InputType of this action title in editing.

B

Sets the optional title text to edit.

B
editTitle(@StringRes int editTitleResourceId)

Sets the optional title text to edit.

B
editable(boolean editable)

Indicates whether this action title is editable.

B
enabled(boolean enabled)

Indicates whether this action is enabled.

B
focusable(boolean focusable)

Indicates whether this action can take focus.

@NonNull Context

Returns Context of this Builder.

B
hasEditableActivatorView(boolean editable)

Indicates whether this action has a view can be activated to edit, e.g. a DatePicker.

B
hasNext(boolean hasNext)

Indicates whether this action has a next state and should display a chevron.

B

Sets the action's icon drawable.

B
icon(@DrawableRes int iconResourceId)

Sets the action's icon drawable by retrieving it by resource ID from Builder's context.

B
iconResourceId(@DrawableRes int iconResourceId, Context context)

This method is deprecated.

Use icon.

B
id(long id)

Sets the ID associated with this action.

B
infoOnly(boolean infoOnly)

Indicates whether this action is for information purposes only and cannot be clicked.

B
inputType(int inputType)

Sets InputType of this action title not in editing.

B

Sets the intent associated with this action.

B
multilineDescription(boolean multilineDescription)

Indicates whether the title and description are long, and should be displayed appropriately.

B

Sets sub actions list.

B

Sets the title for this action.

B
title(@StringRes int titleResourceId)

Sets the title for this action.

Protected methods

final void

Subclass of BuilderBase should call this function to apply values.

Public constructors

BuilderBase

Added in 1.1.0
public BuilderBase(@NonNull Context context)

Creates a BuilderBase for GuidedAction or its subclass.

Parameters
@NonNull Context context

Context object used to build the GuidedAction.

Public methods

autoSaveRestoreEnabled

Added in 1.1.0
public B autoSaveRestoreEnabled(boolean autoSaveRestoreEnabled)

Explicitly sets auto restore feature on the GuidedAction. It's by default true.

Parameters
boolean autoSaveRestoreEnabled

True if turn on auto save/restore of GuidedAction content, false otherwise.

Returns
B

The same BuilderBase object.

autofillHints

public B autofillHints(@Nullable String[] hints)

Sets autofill hints. See setAutofillHints

Parameters
@Nullable String[] hints

List of hints for autofill.

Returns
B

The same BuilderBase object.

checkSetId

Added in 1.1.0
public B checkSetId(int checkSetId)

Indicates whether this action is part of a single-select group similar to radio buttons or this action is a checkbox. When one item in a check set is checked, all others with the same check set ID will be checked automatically.

Parameters
int checkSetId

The check set ID, or NO_CHECK_SET to indicate not radio or checkbox, or CHECKBOX_CHECK_SET_ID to indicate a checkbox.

checked

Added in 1.1.0
public B checked(boolean checked)

Indicates whether this action is initially checked.

Parameters
boolean checked

Whether this action is checked.

clickAction

Added in 1.1.0
public B clickAction(long id)

Construct a clickable action with associated id and auto assign pre-defined title for the action. If the id is not supported, the method simply does nothing.

Returns
B

The same BuilderBase object.

description

Added in 1.1.0
public B description(@Nullable CharSequence description)

Sets the description for this action. The description is typically a longer string providing extra information on what the action will do.

Parameters
@Nullable CharSequence description

The description for this action.

description

Added in 1.1.0
public B description(@StringRes int descriptionResourceId)

Sets the description for this action. The description is typically a longer string providing extra information on what the action will do.

Parameters
@StringRes int descriptionResourceId

String resource id of the description for this action.

descriptionEditInputType

Added in 1.1.0
public B descriptionEditInputType(int inputType)

Sets InputType of this action description in editing.

Parameters
int inputType

InputType for the action description in editing.

descriptionEditable

Added in 1.1.0
public B descriptionEditable(boolean editable)

Indicates whether this action's description is editable

Parameters
boolean editable

Whether this action description is editable.

descriptionInputType

Added in 1.1.0
public B descriptionInputType(int inputType)

Sets InputType of this action description not in editing.

Parameters
int inputType

InputType for the action description not in editing.

editDescription

Added in 1.1.0
public B editDescription(@Nullable CharSequence description)

Sets the optional description text to edit. When TextView is activated, the edit description replaces the string of description.

Parameters
@Nullable CharSequence description

The description to edit for this action.

editDescription

Added in 1.1.0
public B editDescription(@StringRes int descriptionResourceId)

Sets the optional description text to edit. When TextView is activated, the edit description replaces the string of description.

Parameters
@StringRes int descriptionResourceId

String resource id of the description to edit for this action.

editInputType

Added in 1.1.0
public B editInputType(int inputType)

Sets InputType of this action title in editing.

Parameters
int inputType

InputType for the action title in editing.

editTitle

Added in 1.1.0
public B editTitle(@Nullable CharSequence editTitle)

Sets the optional title text to edit. When TextView is activated, the edit title replaces the string of title.

Parameters
@Nullable CharSequence editTitle

The optional title text to edit when TextView is activated.

editTitle

Added in 1.1.0
public B editTitle(@StringRes int editTitleResourceId)

Sets the optional title text to edit. When TextView is activated, the edit title replaces the string of title.

Parameters
@StringRes int editTitleResourceId

String resource id of the optional title text to edit when TextView is activated.

editable

Added in 1.1.0
public B editable(boolean editable)

Indicates whether this action title is editable. Note: Editable actions cannot also be checked, or belong to a check set.

Parameters
boolean editable

Whether this action is editable.

enabled

Added in 1.1.0
public B enabled(boolean enabled)

Indicates whether this action is enabled. If not enabled, an action cannot be clicked.

Parameters
boolean enabled

Whether the action is enabled.

focusable

Added in 1.1.0
public B focusable(boolean focusable)

Indicates whether this action can take focus.

Parameters
boolean focusable
Returns
B

The same BuilderBase object.

getContext

Added in 1.1.0
public @NonNull Context getContext()

Returns Context of this Builder.

Returns
@NonNull Context

Context of this Builder.

hasEditableActivatorView

Added in 1.1.0
public B hasEditableActivatorView(boolean editable)

Indicates whether this action has a view can be activated to edit, e.g. a DatePicker.

Parameters
boolean editable

Whether this action has view can be activated to edit.

hasNext

Added in 1.1.0
public B hasNext(boolean hasNext)

Indicates whether this action has a next state and should display a chevron.

Parameters
boolean hasNext

Whether this action has a next state.

icon

Added in 1.1.0
public B icon(@Nullable Drawable icon)

Sets the action's icon drawable.

Parameters
@Nullable Drawable icon

The drawable for the icon associated with this action.

icon

Added in 1.1.0
public B icon(@DrawableRes int iconResourceId)

Sets the action's icon drawable by retrieving it by resource ID from Builder's context. This is a convenience function that simply looks up the drawable and calls icon.

Parameters
@DrawableRes int iconResourceId

The resource ID for the icon associated with this action.

iconResourceId

Added in 1.1.0
Deprecated in 1.1.0
public B iconResourceId(@DrawableRes int iconResourceId, Context context)

Sets the action's icon drawable by retrieving it by resource ID from the specified context. This is a convenience function that simply looks up the drawable and calls icon.

Parameters
@DrawableRes int iconResourceId

The resource ID for the icon associated with this action.

Context context

The context whose resource ID should be retrieved.

id

Added in 1.1.0
public B id(long id)

Sets the ID associated with this action. The ID can be any value the client wishes; it is typically used to determine what to do when an action is clicked.

Parameters
long id

The ID to associate with this action.

infoOnly

Added in 1.1.0
public B infoOnly(boolean infoOnly)

Indicates whether this action is for information purposes only and cannot be clicked.

Parameters
boolean infoOnly

Whether this action has a next state.

inputType

Added in 1.1.0
public B inputType(int inputType)

Sets InputType of this action title not in editing.

Parameters
int inputType

InputType for the action title not in editing.

intent

Added in 1.1.0
public B intent(@Nullable Intent intent)

Sets the intent associated with this action. Clients would typically fire this intent directly when the action is clicked.

Parameters
@Nullable Intent intent

The intent associated with this action.

multilineDescription

Added in 1.1.0
public B multilineDescription(boolean multilineDescription)

Indicates whether the title and description are long, and should be displayed appropriately.

Parameters
boolean multilineDescription

Whether this action has a multiline description.

subActions

Added in 1.1.0
public B subActions(@Nullable List<GuidedAction> subActions)

Sets sub actions list.

Parameters
@Nullable List<GuidedAction> subActions
Returns
B

The same BuilderBase object.

title

Added in 1.1.0
public B title(@Nullable CharSequence title)

Sets the title for this action. The title is typically a short string indicating the action to be taken on click, e.g. "Continue" or "Cancel".

Parameters
@Nullable CharSequence title

The title for this action.

title

Added in 1.1.0
public B title(@StringRes int titleResourceId)

Sets the title for this action. The title is typically a short string indicating the action to be taken on click, e.g. "Continue" or "Cancel".

Parameters
@StringRes int titleResourceId

The resource id of title for this action.

Protected methods

applyValues

Added in 1.1.0
protected final void applyValues(@NonNull GuidedAction action)

Subclass of BuilderBase should call this function to apply values.

Parameters
@NonNull GuidedAction action

GuidedAction to apply BuilderBase values.