public class GuidedAction extends Action
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 GuidedAction.Builder
. When application subclass GuidedAction, it
can subclass GuidedAction.BuilderBase
, implement its own builder() method where it should
call GuidedAction.BuilderBase.applyValues(GuidedAction)
.
Modifier and Type | Class and Description |
---|---|
static class |
GuidedAction.Builder
Builds a
GuidedAction object. |
static class |
GuidedAction.BuilderBase<B extends GuidedAction.BuilderBase>
Base builder class to build a
GuidedAction object. |
Modifier and Type | Field and Description |
---|---|
static long |
ACTION_ID_CANCEL
Id of standard Cancel action.
|
static long |
ACTION_ID_CONTINUE
Id of standard Finish action.
|
static long |
ACTION_ID_CURRENT
When finishing editing, stay on current action.
|
static long |
ACTION_ID_FINISH
Id of standard Finish action.
|
static long |
ACTION_ID_NEXT
When finishing editing, goes to next action.
|
static long |
ACTION_ID_NO
Id of standard No action.
|
static long |
ACTION_ID_OK
Id of standard OK action.
|
static long |
ACTION_ID_YES
Id of standard Yes action.
|
static int |
CHECKBOX_CHECK_SET_ID
Checkset Id for checkbox.
|
static int |
DEFAULT_CHECK_SET_ID
Default checkset Id for radio.
|
static int |
NO_CHECK_SET
Special check set Id that is neither checkbox nor radio.
|
Modifier | Constructor and Description |
---|---|
protected |
GuidedAction() |
Modifier and Type | Method and Description |
---|---|
int |
getCheckSetId()
Returns the check set id this action is a part of.
|
CharSequence |
getDescription()
Returns the description of this action.
|
int |
getDescriptionEditInputType()
Returns InputType of action description in editing; only valid when
isDescriptionEditable() is true. |
int |
getDescriptionInputType()
Returns InputType of action description not in editing.
|
CharSequence |
getEditDescription()
Returns the optional description text to edit.
|
int |
getEditInputType()
Returns InputType of action title in editing; only valid when
isEditable() is true. |
CharSequence |
getEditTitle()
Returns the optional title text to edit.
|
int |
getInputType()
Returns InputType of action title not in editing.
|
Intent |
getIntent()
Returns the intent associated with this action.
|
List<GuidedAction> |
getSubActions() |
CharSequence |
getTitle()
Returns the title of this action.
|
boolean |
hasEditableActivatorView()
Returns whether this action can be activated to edit, e.g. a DatePicker.
|
boolean |
hasMultilineDescription()
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 |
hasSubActions() |
boolean |
hasTextEditable()
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 |
isAutoSaveRestoreEnabled()
Returns true if Action will be saved to instanceState and restored later, false otherwise.
|
boolean |
isChecked()
Returns whether this action is checked.
|
boolean |
isDescriptionEditable()
Returns whether this action description is editable.
|
boolean |
isEditable()
Returns whether this action title is editable.
|
boolean |
isEditTitleUsed()
Returns true if
getEditTitle() is not null. |
boolean |
isEnabled()
Returns whether this action is enabled.
|
boolean |
isFocusable()
Returns whether this action is focusable.
|
void |
onRestoreInstanceState(Bundle bundle,
String key)
Restore action from a bundle using a given key.
|
void |
onSaveInstanceState(Bundle bundle,
String key)
Save action into a bundle using a given key.
|
void |
setChecked(boolean checked)
Sets whether this action is checked.
|
void |
setDescription(CharSequence description)
Sets the description of this action.
|
void |
setEditDescription(CharSequence editDescription)
Sets the optional description text to edit instead of
setDescription(CharSequence) . |
void |
setEditTitle(CharSequence editTitle)
Sets the optional title text to edit instead of
setTitle(CharSequence) . |
void |
setEnabled(boolean enabled)
Sets whether this action is enabled.
|
void |
setFocusable(boolean focusable)
Sets whether this action is focusable.
|
void |
setIntent(Intent intent)
Sets the intent of this action.
|
void |
setSubActions(List<GuidedAction> actions)
Change sub actions list.
|
void |
setTitle(CharSequence title)
Sets the title of this action.
|
addKeyCode, getIcon, getId, getLabel1, getLabel2, removeKeyCode, respondsToKeyCode, setIcon, setId, setLabel1, setLabel2, toString
public static final int NO_CHECK_SET
public static final int DEFAULT_CHECK_SET_ID
public static final int CHECKBOX_CHECK_SET_ID
public static final long ACTION_ID_NEXT
public static final long ACTION_ID_CURRENT
public static final long ACTION_ID_OK
public static final long ACTION_ID_CANCEL
public static final long ACTION_ID_FINISH
public static final long ACTION_ID_CONTINUE
public static final long ACTION_ID_YES
public static final long ACTION_ID_NO
public CharSequence getTitle()
public void setTitle(CharSequence title)
title
- The title set when this action was built.public CharSequence getEditTitle()
getTitle()
.getTitle()
.public void setEditTitle(CharSequence editTitle)
setTitle(CharSequence)
.editTitle
- Optional title text to edit instead of setTitle(CharSequence)
.public CharSequence getEditDescription()
getDescription()
.getDescription()
.public void setEditDescription(CharSequence editDescription)
setDescription(CharSequence)
.editDescription
- Optional description text to edit instead of
setDescription(CharSequence)
.public boolean isEditTitleUsed()
getEditTitle()
is not null. When true, the getEditTitle()
is being edited instead of getTitle()
.getEditTitle()
is not null.public CharSequence getDescription()
public void setDescription(CharSequence description)
description
- The description of the action.public Intent getIntent()
public void setIntent(Intent intent)
intent
- New intent to set on this action.public boolean isEditable()
public boolean isDescriptionEditable()
public boolean hasTextEditable()
public boolean hasEditableActivatorView()
public int getEditInputType()
isEditable()
is true.public int getDescriptionEditInputType()
isDescriptionEditable()
is true.public int getInputType()
public int getDescriptionInputType()
public boolean isChecked()
public void setChecked(boolean checked)
checked
- Whether this action should be checked.public int getCheckSetId()
CHECKBOX_CHECK_SET_ID
if this is a checkbox, or NO_CHECK_SET
if
this action is not a checkbox or radiobutton.public boolean hasMultilineDescription()
public boolean isEnabled()
public void setEnabled(boolean enabled)
enabled
- Whether this action should be enabled.public boolean isFocusable()
public void setFocusable(boolean focusable)
focusable
- Whether this action should be focusable.public boolean hasNext()
public boolean infoOnly()
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.public void setSubActions(List<GuidedAction> actions)
actions
- Sub actions list to set on this action. Sets null to disable sub actions.public List<GuidedAction> getSubActions()
public boolean hasSubActions()
public final boolean isAutoSaveRestoreEnabled()
Action.getId()
is
not Action.NO_ID
:
isEditable()
is true: save text of getTitle()
isDescriptionEditable()
is true: save text of getDescription()
getCheckSetId()
is not NO_CHECK_SET
: save isChecked()
}GuidedDatePickerAction
will be savedpublic void onSaveInstanceState(Bundle bundle, String key)
isEditable()
is true: save text of getTitle()
isDescriptionEditable()
is true: save text of getDescription()
getCheckSetId()
is not NO_CHECK_SET
: save isChecked()
}GuidedDatePickerAction
will be savedbundle
- Bundle to save the Action.key
- Key used to save the Action.public void onRestoreInstanceState(Bundle bundle, String key)
isEditable()
is true: save text of getTitle()
isDescriptionEditable()
is true: save text of getDescription()
getCheckSetId()
is not NO_CHECK_SET
: save isChecked()
}GuidedDatePickerAction
will be savedbundle
- Bundle to restore the Action from.key
- Key used to restore the Action.