AccessibilityNodeInfoCompat.AccessibilityActionCompat
public
static
class
AccessibilityNodeInfoCompat.AccessibilityActionCompat
extends Object
java.lang.Object | |
↳ | androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat |
A class defining an action that can be performed on an AccessibilityNodeInfo
.
Each action has a unique id and a label.
There are three categories of actions:
- Standard actions - These are actions that are reported and
handled by the standard UI widgets in the platform. For each standard action
there is a static constant defined in this class, e.g.
ACTION_FOCUS
. These actions will havenull
labels. - Custom actions action - These are actions that are reported and handled by custom widgets. i.e. ones that are not part of the UI toolkit. For example, an application may define a custom action for clearing the user history.
- Overriden standard actions - These are actions that override
standard actions to customize them. For example, an app may add a label to the
standard
ACTION_CLICK
action to indicate to the user that this action clears browsing history.
Note: Views which support these actions should invoke
View.setImportantForAccessibility(int)
with
View.IMPORTANT_FOR_ACCESSIBILITY_YES
to ensure an
AccessibilityService
can discover the set of supported
actions.
Summary
Public constructors | |
---|---|
AccessibilityActionCompat(int actionId, CharSequence label)
Creates a new instance. |
Public methods | |
---|---|
boolean
|
equals(Object obj)
|
int
|
getId()
Gets the id for this action. |
CharSequence
|
getLabel()
Gets the label for this action. |
int
|
hashCode()
|
Inherited methods | |
---|---|
Fields
ACTION_ACCESSIBILITY_FOCUS
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_ACCESSIBILITY_FOCUS
Action that gives accessibility focus to the node.
ACTION_CLEAR_ACCESSIBILITY_FOCUS
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_CLEAR_ACCESSIBILITY_FOCUS
Action that clears accessibility focus of the node.
ACTION_CLEAR_FOCUS
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_CLEAR_FOCUS
Action that clears input focus of the node.
ACTION_CLEAR_SELECTION
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_CLEAR_SELECTION
Action that deselects the node.
ACTION_CLICK
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_CLICK
Action that clicks on the node info.
ACTION_COLLAPSE
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_COLLAPSE
Action to collapse an expandable node.
ACTION_CONTEXT_CLICK
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_CONTEXT_CLICK
Action that context clicks the node.
ACTION_COPY
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_COPY
Action to copy the current selection to the clipboard.
ACTION_CUT
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_CUT
Action to cut the current selection and place it to the clipboard.
ACTION_DISMISS
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_DISMISS
Action to dismiss a dismissable node.
ACTION_EXPAND
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_EXPAND
Action to expand an expandable node.
ACTION_FOCUS
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_FOCUS
Action that gives input focus to the node.
ACTION_HIDE_TOOLTIP
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_HIDE_TOOLTIP
Action to hide a tooltip. A node should expose this action only for views that are currently showing a tooltip.
ACTION_IME_ENTER
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_IME_ENTER
Action to send an ime actionId which is from
EditorInfo.actionId
. This ime actionId sets by
TextView.setImeActionLabel(CharSequence, int)
, or it would be
EditorInfo.IME_ACTION_UNSPECIFIED
if no specific
actionId has set. A node should expose this action only for views that are currently
with input focus and editable.
ACTION_LONG_CLICK
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_LONG_CLICK
Action that long clicks on the node.
ACTION_MOVE_WINDOW
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_MOVE_WINDOW
Action to move a window to a new location.
Arguments:
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_MOVE_WINDOW_X
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_MOVE_WINDOW_Y
ACTION_NEXT_AT_MOVEMENT_GRANULARITY
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_NEXT_AT_MOVEMENT_GRANULARITY
Action that requests to go to the next entity in this node's text at a given movement granularity. For example, move to the next character, word, etc.
Arguments:
Bundle arguments = new Bundle();
arguments.putInt(AccessibilityNodeInfoCompat.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT,
AccessibilityNodeInfoCompat.MOVEMENT_GRANULARITY_CHARACTER);
arguments.putBoolean(
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, false);
info.performAction(
AccessibilityActionCompat.ACTION_NEXT_AT_MOVEMENT_GRANULARITY.getId(),
arguments);
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
,
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
Example: Move to the previous character and do not extend selection.
See also:
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
AccessibilityNodeInfoCompat.getMovementGranularities()
AccessibilityNodeInfoCompat.MOVEMENT_GRANULARITY_CHARACTER
AccessibilityNodeInfoCompat.MOVEMENT_GRANULARITY_WORD
AccessibilityNodeInfoCompat.MOVEMENT_GRANULARITY_LINE
AccessibilityNodeInfoCompat.MOVEMENT_GRANULARITY_PARAGRAPH
AccessibilityNodeInfoCompat.MOVEMENT_GRANULARITY_PAGE
ACTION_NEXT_HTML_ELEMENT
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_NEXT_HTML_ELEMENT
Action to move to the next HTML element of a given type. For example, move to the BUTTON, INPUT, TABLE, etc.
Arguments:
Bundle arguments = new Bundle();
arguments.putString(
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON");
info.performAction(
AccessibilityActionCompat.ACTION_NEXT_HTML_ELEMENT.getId(), arguments);
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_HTML_ELEMENT_STRING
Example:
ACTION_PAGE_DOWN
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_DOWN
Action to move to the page below.
ACTION_PAGE_LEFT
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_LEFT
Action to move to the page left.
ACTION_PAGE_RIGHT
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_RIGHT
Action to move to the page right.
ACTION_PAGE_UP
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_UP
Action to move to the page above.
ACTION_PASTE
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PASTE
Action to paste the current clipboard content.
ACTION_PRESS_AND_HOLD
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PRESS_AND_HOLD
Action that presses and holds a node.
This action is for nodes that have distinct behavior that depends on how long a press is
held. Nodes having a single action for long press should use ACTION_LONG_CLICK
instead of this action, and nodes should not expose both actions.
When calling performAction(ACTION_PRESS_AND_HOLD, bundle
, use
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT
to specify how long the
node is pressed. The first time an accessibility service performs ACTION_PRES_AND_HOLD
on a node, it must specify 0 as ACTION_ARGUMENT_PRESS_AND_HOLD, so the application is
notified that the held state has started. To ensure reasonable behavior, the values
must be increased incrementally and may not exceed 10,000. UIs requested
to hold for times outside of this range should ignore the action.
The total time the element is held could be specified by an accessibility user up-front, or may depend on what happens on the UI as the user continues to request the hold.
Note: The time between dispatching the action and it arriving in the UI process is not guaranteed. It is possible on a busy system for the time to expire unexpectedly. For the case of holding down a key for a repeating action, a delayed arrival should be benign. Please do not use this sort of action in cases where such delays will lead to unexpected UI behavior.
ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
Action that requests to go to the previous entity in this node's text at a given movement granularity. For example, move to the next character, word, etc.
Arguments:
Bundle arguments = new Bundle();
arguments.putInt(AccessibilityNodeInfoCompat.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT,
AccessibilityNodeInfoCompat.MOVEMENT_GRANULARITY_CHARACTER);
arguments.putBoolean(
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, false);
info.performAction(
AccessibilityActionCompat.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY.getId(),
arguments);
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
,
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
Example: Move to the next character and do not extend selection.
See also:
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
AccessibilityNodeInfoCompat.setMovementGranularities(int)
AccessibilityNodeInfoCompat.getMovementGranularities()
AccessibilityNodeInfoCompat.MOVEMENT_GRANULARITY_CHARACTER
AccessibilityNodeInfoCompat.MOVEMENT_GRANULARITY_WORD
AccessibilityNodeInfoCompat.MOVEMENT_GRANULARITY_LINE
AccessibilityNodeInfoCompat.MOVEMENT_GRANULARITY_PARAGRAPH
AccessibilityNodeInfoCompat.MOVEMENT_GRANULARITY_PAGE
ACTION_PREVIOUS_HTML_ELEMENT
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PREVIOUS_HTML_ELEMENT
Action to move to the previous HTML element of a given type. For example, move to the BUTTON, INPUT, TABLE, etc.
Arguments:
Bundle arguments = new Bundle();
arguments.putString(
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON");
info.performAction(
AccessibilityActionCompat.ACTION_PREVIOUS_HTML_ELEMENT.getId(), arguments);
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_HTML_ELEMENT_STRING
Example:
ACTION_SCROLL_BACKWARD
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SCROLL_BACKWARD
Action to scroll the node content backward.
ACTION_SCROLL_DOWN
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SCROLL_DOWN
Action to scroll the node content down.
ACTION_SCROLL_FORWARD
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SCROLL_FORWARD
Action to scroll the node content forward.
ACTION_SCROLL_LEFT
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SCROLL_LEFT
Action to scroll the node content left.
ACTION_SCROLL_RIGHT
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SCROLL_RIGHT
Action to scroll the node content right.
ACTION_SCROLL_TO_POSITION
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SCROLL_TO_POSITION
Action that scrolls the node to make the specified collection position visible on screen.
Arguments:
ACTION_SCROLL_UP
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SCROLL_UP
Action to scroll the node content up.
ACTION_SELECT
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SELECT
Action that selects the node.
ACTION_SET_PROGRESS
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SET_PROGRESS
Action that sets progress between RangeInfo.getMin()
and
RangeInfo.getMax()
. It should use the same value type as
RangeInfo.getType()
Arguments:
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_PROGRESS_VALUE
ACTION_SET_SELECTION
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SET_SELECTION
Action to set the selection. Performing this action with no arguments clears the selection.
Arguments:
Bundle arguments = new Bundle();
arguments.putInt(AccessibilityNodeInfoCompat.ACTION_ARGUMENT_SELECTION_START_INT, 1);
arguments.putInt(AccessibilityNodeInfoCompat.ACTION_ARGUMENT_SELECTION_END_INT, 2);
info.performAction(AccessibilityActionCompat.ACTION_SET_SELECTION.getId(), arguments);
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_SELECTION_START_INT
,
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_SELECTION_END_INT
Example:
ACTION_SET_TEXT
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SET_TEXT
Action that sets the text of the node. Performing the action without argument,
using null
or empty CharSequence
will clear the text. This
action will also put the cursor at the end of text.
Arguments:
Bundle arguments = new Bundle();
arguments.putCharSequence(AccessibilityNodeInfoCompat.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE,
"android");
info.performAction(AccessibilityActionCompat.ACTION_SET_TEXT.getId(), arguments);
AccessibilityNodeInfoCompat.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE
Example:
ACTION_SHOW_ON_SCREEN
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SHOW_ON_SCREEN
Action that requests the node make its bounding rectangle visible on the screen, scrolling if necessary just enough.
See also:
ACTION_SHOW_TOOLTIP
public static final AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SHOW_TOOLTIP
Action to show a tooltip.
Public constructors
AccessibilityActionCompat
public AccessibilityActionCompat (int actionId, CharSequence label)
Creates a new instance.
Parameters | |
---|---|
actionId |
int : The action id. |
label |
CharSequence : The action label.
|
Public methods
equals
public boolean equals (Object obj)
Parameters | |
---|---|
obj |
Object |
Returns | |
---|---|
boolean |
getId
public int getId ()
Gets the id for this action.
Returns | |
---|---|
int |
The action id. |
getLabel
public CharSequence getLabel ()
Gets the label for this action. Its purpose is to describe the action to user.
Returns | |
---|---|
CharSequence |
The label. |
hashCode
public int hashCode ()
Returns | |
---|---|
int |