GuidedAction
class GuidedAction : Action
GuidedDatePickerAction |
Subclass of GuidedAction that can choose a date. |
A data class which represents an action within a androidx.leanback.app.GuidedStepFragment. GuidedActions contain at minimum a title and a description, and typically also an icon.
A GuidedAction typically represents a single action a user may take, but may also represent a possible choice out of a group of mutually exclusive choices (similar to radio buttons), or an information-only label (in which case the item cannot be clicked).
GuidedActions may optionally be checked. They may also indicate that they will request further user input on selection, in which case they will be displayed with a chevron indicator.
GuidedAction recommends to use Builder. When application subclass GuidedAction, it can subclass BuilderBase, implement its own builder() method where it should call applyValues.
Summary
Nested types |
|---|
|
Builds a |
abstract class GuidedAction.BuilderBase<B : GuidedAction.BuilderBase?>Base builder class to build a |
Constants |
|
|---|---|
const Long |
ACTION_ID_CANCEL = -5Id of standard Cancel action. |
const Long |
ACTION_ID_CONTINUE = -7Id of standard Finish action. |
const Long |
ACTION_ID_CURRENT = -3When finishing editing, stay on current action. |
const Long |
ACTION_ID_FINISH = -6Id of standard Finish action. |
const Long |
ACTION_ID_NEXT = -2When finishing editing, goes to next action. |
const Long |
ACTION_ID_NO = -9Id of standard No action. |
const Long |
ACTION_ID_OK = -4Id of standard OK action. |
const Long |
ACTION_ID_YES = -8Id of standard Yes action. |
const Int |
Checkset Id for checkbox. |
const Int |
Default checkset Id for radio. |
const Int |
NO_CHECK_SET = 0Special check set Id that is neither checkbox nor radio. |
Protected constructors |
|---|
Public functions |
|
|---|---|
Array<String!>! |
Returns autofill hints, see |
Int |
Returns the check set id this action is a part of. |
CharSequence? |
Returns the description of this action. |
Int |
Returns InputType of action description in editing; only valid when |
Int |
Returns InputType of action description not in editing. |
CharSequence? |
Returns the optional description text to edit. |
Int |
Returns InputType of action title in editing; only valid when |
CharSequence? |
Returns the optional title text to edit. |
Int |
Returns InputType of action title not in editing. |
Intent? |
Returns the intent associated with this action. |
(Mutable)List<GuidedAction!>? |
|
CharSequence? |
getTitle()Returns the title of this action. |
Boolean |
Returns whether this action can be activated to edit, e.g. a DatePicker. |
Boolean |
Returns whether this action is has a multiline description. |
Boolean |
hasNext()Returns whether this action will request further user input when selected, such as showing another GuidedStepFragment or launching a new activity. |
Boolean |
|
Boolean |
Returns if this action has editable title or editable description. |
Boolean |
infoOnly()Returns whether the action will only display information and is thus not clickable. |
Boolean |
Returns true if Action will be saved to instanceState and restored later, false otherwise. |
Boolean |
Returns whether this action is checked. |
Boolean |
Returns whether this action description is editable. |
Boolean |
Returns true if |
Boolean |
Returns whether this action title is editable. |
Boolean |
Returns whether this action is enabled. |
Boolean |
Returns whether this action is focusable. |
Unit |
onRestoreInstanceState(bundle: Bundle, key: String)Restore action from a bundle using a given key. |
Unit |
onSaveInstanceState(bundle: Bundle, key: String)Save action into a bundle using a given key. |
Unit |
setChecked(checked: Boolean)Sets whether this action is checked. |
Unit |
setDescription(description: CharSequence?)Sets the description of this action. |
Unit |
setEditDescription(editDescription: CharSequence?)Sets the optional description text to edit instead of |
Unit |
setEditTitle(editTitle: CharSequence?)Sets the optional title text to edit instead of |
Unit |
setEnabled(enabled: Boolean)Sets whether this action is enabled. |
Unit |
setFocusable(focusable: Boolean)Sets whether this action is focusable. |
Unit |
Sets the intent of this action. |
Unit |
setSubActions(actions: (Mutable)List<GuidedAction!>?)Change sub actions list. |
Unit |
setTitle(title: CharSequence?)Sets the title of this action. |
Inherited functions |
||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Constants
ACTION_ID_CONTINUE
const val ACTION_ID_CONTINUE = -7: Long
Id of standard Finish action.
ACTION_ID_CURRENT
const val ACTION_ID_CURRENT = -3: Long
When finishing editing, stay on current action.
ACTION_ID_NEXT
const val ACTION_ID_NEXT = -2: Long
When finishing editing, goes to next action.
CHECKBOX_CHECK_SET_ID
const val CHECKBOX_CHECK_SET_ID = -1: Int
Checkset Id for checkbox.
DEFAULT_CHECK_SET_ID
const val DEFAULT_CHECK_SET_ID = 1: Int
Default checkset Id for radio.
NO_CHECK_SET
const val NO_CHECK_SET = 0: Int
Special check set Id that is neither checkbox nor radio.
Protected constructors
Public functions
getAutofillHints
fun getAutofillHints(): Array<String!>!
Returns autofill hints, see setAutofillHints.
getCheckSetId
fun getCheckSetId(): Int
Returns the check set id this action is a part of. All actions in the same list with the same check set id are considered linked. When one of the actions within that set is selected, that action becomes checked, while all the other actions become unchecked.
| Returns | |
|---|---|
Int |
an integer representing the check set this action is a part of, or |
getDescription
fun getDescription(): CharSequence?
Returns the description of this action.
| Returns | |
|---|---|
CharSequence? |
The description of this action. |
getDescriptionEditInputType
fun getDescriptionEditInputType(): Int
Returns InputType of action description in editing; only valid when isDescriptionEditable is true.
| Returns | |
|---|---|
Int |
InputType of action description in editing. |
getDescriptionInputType
fun getDescriptionInputType(): Int
Returns InputType of action description not in editing.
| Returns | |
|---|---|
Int |
InputType of action description not in editing. |
getEditDescription
fun getEditDescription(): CharSequence?
Returns the optional description text to edit. When not null, it is being edited instead of getDescription.
| Returns | |
|---|---|
CharSequence? |
Optional description text to edit instead of |
getEditInputType
fun getEditInputType(): Int
Returns InputType of action title in editing; only valid when isEditable is true.
| Returns | |
|---|---|
Int |
InputType of action title in editing. |
getEditTitle
fun getEditTitle(): CharSequence?
Returns the optional title text to edit. When not null, it is being edited instead of getTitle.
| Returns | |
|---|---|
CharSequence? |
Optional title text to edit instead of |
getInputType
fun getInputType(): Int
Returns InputType of action title not in editing.
| Returns | |
|---|---|
Int |
InputType of action title not in editing. |
getIntent
fun getIntent(): Intent?
Returns the intent associated with this action.
| Returns | |
|---|---|
Intent? |
The intent set when this action was built. |
getSubActions
fun getSubActions(): (Mutable)List<GuidedAction!>?
| Returns | |
|---|---|
(Mutable)List<GuidedAction!>? |
List of sub actions or null if sub actions list is not enabled. |
getTitle
fun getTitle(): CharSequence?
Returns the title of this action.
| Returns | |
|---|---|
CharSequence? |
The title set when this action was built. |
hasEditableActivatorView
fun hasEditableActivatorView(): Boolean
Returns whether this action can be activated to edit, e.g. a DatePicker.
| Returns | |
|---|---|
Boolean |
true if the action can be activated to edit. |
hasMultilineDescription
fun hasMultilineDescription(): Boolean
Returns whether this action is has a multiline description.
| Returns | |
|---|---|
Boolean |
true if the action was constructed as having a multiline description, false otherwise. |
hasNext
fun hasNext(): Boolean
Returns whether this action will request further user input when selected, such as showing another GuidedStepFragment or launching a new activity. Configured during construction.
| Returns | |
|---|---|
Boolean |
true if the action will request further user input when selected, false otherwise. |
hasSubActions
fun hasSubActions(): Boolean
| Returns | |
|---|---|
Boolean |
True if has sub actions list, even it's currently empty. |
hasTextEditable
fun hasTextEditable(): Boolean
Returns if this action has editable title or editable description.
| Returns | |
|---|---|
Boolean |
True if this action has editable title or editable description, false otherwise. |
infoOnly
fun infoOnly(): Boolean
Returns whether the action will only display information and is thus not clickable. If both this and hasNext are true, infoOnly takes precedence. The default is false. For example, this might represent e.g. the amount of storage a document uses, or the cost of an app.
| Returns | |
|---|---|
Boolean |
true if will only display information, false otherwise. |
isAutoSaveRestoreEnabled
fun isAutoSaveRestoreEnabled(): Boolean
Returns true if Action will be saved to instanceState and restored later, false otherwise. The default value is true. When isAutoSaveRestoreEnabled() is true and getId is not NO_ID:
isEditableis true: save text ofgetTitleisDescriptionEditableis true: save text ofgetDescriptiongetCheckSetIdis notNO_CHECK_SET: saveisChecked}GuidedDatePickerActionwill be saved
| Returns | |
|---|---|
Boolean |
True if Action will be saved to instanceState and restored later, false otherwise. |
isChecked
fun isChecked(): Boolean
Returns whether this action is checked.
| Returns | |
|---|---|
Boolean |
true if the action is currently checked, false otherwise. |
isDescriptionEditable
fun isDescriptionEditable(): Boolean
Returns whether this action description is editable.
| Returns | |
|---|---|
Boolean |
true if the action description is editable, false otherwise. |
isEditTitleUsed
fun isEditTitleUsed(): Boolean
Returns true if getEditTitle is not null. When true, the getEditTitle is being edited instead of getTitle.
| Returns | |
|---|---|
Boolean |
true if |
isEditable
fun isEditable(): Boolean
Returns whether this action title is editable.
| Returns | |
|---|---|
Boolean |
true if the action title is editable, false otherwise. |
isEnabled
fun isEnabled(): Boolean
Returns whether this action is enabled.
| Returns | |
|---|---|
Boolean |
true if the action is currently enabled, false otherwise. |
isFocusable
fun isFocusable(): Boolean
Returns whether this action is focusable.
| Returns | |
|---|---|
Boolean |
true if the action is currently focusable, false otherwise. |
onRestoreInstanceState
fun onRestoreInstanceState(bundle: Bundle, key: String): Unit
Restore action from a bundle using a given key. When isAutoRestore() is true:
isEditableis true: save text ofgetTitleisDescriptionEditableis true: save text ofgetDescriptiongetCheckSetIdis notNO_CHECK_SET: saveisChecked}GuidedDatePickerActionwill be saved
onSaveInstanceState
fun onSaveInstanceState(bundle: Bundle, key: String): Unit
Save action into a bundle using a given key. When isAutoRestoreEna() is true:
isEditableis true: save text ofgetTitleisDescriptionEditableis true: save text ofgetDescriptiongetCheckSetIdis notNO_CHECK_SET: saveisChecked}GuidedDatePickerActionwill be saved
setChecked
fun setChecked(checked: Boolean): Unit
Sets whether this action is checked.
| Parameters | |
|---|---|
checked: Boolean |
Whether this action should be checked. |
setDescription
fun setDescription(description: CharSequence?): Unit
Sets the description of this action.
| Parameters | |
|---|---|
description: CharSequence? |
The description of the action. |
setEditDescription
fun setEditDescription(editDescription: CharSequence?): Unit
Sets the optional description text to edit instead of setDescription.
| Parameters | |
|---|---|
editDescription: CharSequence? |
Optional description text to edit instead of |
setEditTitle
fun setEditTitle(editTitle: CharSequence?): Unit
Sets the optional title text to edit instead of setTitle.
| Parameters | |
|---|---|
editTitle: CharSequence? |
Optional title text to edit instead of |
setEnabled
fun setEnabled(enabled: Boolean): Unit
Sets whether this action is enabled.
| Parameters | |
|---|---|
enabled: Boolean |
Whether this action should be enabled. |
setFocusable
fun setFocusable(focusable: Boolean): Unit
Sets whether this action is focusable.
| Parameters | |
|---|---|
focusable: Boolean |
Whether this action should be focusable. |
setIntent
fun setIntent(intent: Intent?): Unit
Sets the intent of this action.
| Parameters | |
|---|---|
intent: Intent? |
New intent to set on this action. |
setSubActions
fun setSubActions(actions: (Mutable)List<GuidedAction!>?): Unit
Change sub actions list.
| Parameters | |
|---|---|
actions: (Mutable)List<GuidedAction!>? |
Sub actions list to set on this action. Sets null to disable sub actions. |
setTitle
fun setTitle(title: CharSequence?): Unit
Sets the title of this action.
| Parameters | |
|---|---|
title: CharSequence? |
The title set when this action was built. |