java.lang.Object | |
↳ | android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction |
A class defining an action that can be performed on an AccessibilityNodeInfo
.
Each action has a unique id that is mandatory and optional data.
There are three categories of actions:
ACTION_FOCUS
.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ACTION_ACCESSIBILITY_FOCUS | Action that gives accessibility focus to the node. | ||||||||||
ACTION_CLEAR_ACCESSIBILITY_FOCUS | Action that clears accessibility focus of the node. | ||||||||||
ACTION_CLEAR_FOCUS | Action that clears input focus of the node. | ||||||||||
ACTION_CLEAR_SELECTION | Action that deselects the node. | ||||||||||
ACTION_CLICK | Action that clicks on the node info. | ||||||||||
ACTION_COLLAPSE | Action to collapse an expandable node. | ||||||||||
ACTION_COPY | Action to copy the current selection to the clipboard. | ||||||||||
ACTION_CUT | Action to cut the current selection and place it to the clipboard. | ||||||||||
ACTION_DISMISS | Action to dismiss a dismissable node. | ||||||||||
ACTION_EXPAND | Action to expand an expandable node. | ||||||||||
ACTION_FOCUS | Action that gives input focus to the node. | ||||||||||
ACTION_LONG_CLICK | Action that long clicks on the node. | ||||||||||
ACTION_NEXT_AT_MOVEMENT_GRANULARITY | Action that requests to go to the next entity in this node's text at a given movement granularity. | ||||||||||
ACTION_NEXT_HTML_ELEMENT | Action to move to the next HTML element of a given type. | ||||||||||
ACTION_PASTE | Action to paste the current clipboard content. | ||||||||||
ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY | Action that requests to go to the previous entity in this node's text at a given movement granularity. | ||||||||||
ACTION_PREVIOUS_HTML_ELEMENT | Action to move to the previous HTML element of a given type. | ||||||||||
ACTION_SCROLL_BACKWARD | Action to scroll the node content backward. | ||||||||||
ACTION_SCROLL_FORWARD | Action to scroll the node content forward. | ||||||||||
ACTION_SELECT | Action that selects the node. | ||||||||||
ACTION_SET_SELECTION | Action to set the selection. | ||||||||||
ACTION_SET_TEXT | Action that sets the text of the node. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new AccessibilityAction.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Compares this instance with the specified object and indicates if they
are equal.
| |||||||||||
Gets the id for this action.
| |||||||||||
Gets the label for this action.
| |||||||||||
Returns an integer hash code for this object.
| |||||||||||
Returns a string containing a concise, human-readable description of this
object.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Action that gives accessibility focus to the node.
Action that clears accessibility focus of the node.
Action that clears input focus of the node.
Action that deselects the node.
Action that clicks on the node info.
Action to collapse an expandable node.
Action to copy the current selection to the clipboard.
Action to cut the current selection and place it to the clipboard.
Action to dismiss a dismissable node.
Action to expand an expandable node.
Action that gives input focus to the node.
Action that long clicks on the node.
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(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT,
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER);
arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN,
false);
info.performAction(AccessibilityAction.ACTION_NEXT_AT_MOVEMENT_GRANULARITY.getId(),
arguments);
AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
,
AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
Example: Move to the previous character and do not extend selection.
AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
AccessibilityNodeInfo.getMovementGranularities()
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_LINE
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PARAGRAPH
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PAGE
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(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON");
info.performAction(AccessibilityAction.ACTION_NEXT_HTML_ELEMENT.getId(), arguments);
AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING
Example:
Action to paste the current clipboard content.
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(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT,
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER);
arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN,
false);
info.performAction(AccessibilityAction.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY.getId(),
arguments);
AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
,
AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
Example: Move to the next character and do not extend selection.
AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
AccessibilityNodeInfo.setMovementGranularities(int)
AccessibilityNodeInfo.getMovementGranularities()
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_LINE
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PARAGRAPH
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PAGE
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(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON");
info.performAction(AccessibilityAction.ACTION_PREVIOUS_HTML_ELEMENT.getId(), arguments);
AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING
Example:
Action to scroll the node content backward.
Action to scroll the node content forward.
Action that selects the node.
Action to set the selection. Performing this action with no arguments clears the selection.
Arguments:
Bundle arguments = new Bundle();
arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 1);
arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 2);
info.performAction(AccessibilityAction.ACTION_SET_SELECTION.getId(), arguments);
AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT
,
AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT
Example:
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(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE,
"android");
info.performAction(AccessibilityAction.ACTION_SET_TEXT.getId(), arguments);
AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE
Example:
Creates a new AccessibilityAction. For adding a standard action without a specific label, use the static constants. You can also override the description for one the standard actions. Below is an example how to override the standard click action by adding a custom label:
AccessibilityAction action = new AccessibilityAction( AccessibilityAction.ACTION_ACTION_CLICK, getLocalizedLabel()); node.addAction(action);
actionId | The id for this action. This should either be one of the standard actions or a specific action for your app. In that case it is required to use a resource identifier. |
---|---|
label | The label for the new AccessibilityAction. |
Compares this instance with the specified object and indicates if they
are equal. In order to be equal, o
must represent the same object
as this instance using a class-specific comparison. The general contract
is that this comparison should be reflexive, symmetric, and transitive.
Also, no object reference other than null is equal to null.
The default implementation returns true
only if this ==
o
. See Writing a correct
equals
method
if you intend implementing your own equals
method.
The general contract for the equals
and hashCode()
methods is that if equals
returns true
for
any two objects, then hashCode()
must return the same value for
these objects. This means that subclasses of Object
usually
override either both methods or neither of them.
other | the object to compare this instance with. |
---|
true
if the specified object is equal to this Object
; false
otherwise.Gets the label for this action. Its purpose is to describe the action to user.
Returns an integer hash code for this object. By contract, any two
objects for which equals(Object)
returns true
must return
the same hash code value. This means that subclasses of Object
usually override both methods or neither method.
Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
hashCode
method
if you intend implementing your own hashCode
method.
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString
method
if you intend implementing your own toString
method.