public static final class AccessibilityNodeInfo.AccessibilityAction extends Object
AccessibilityNodeInfo
.
Each action has a unique id that is mandatory and optional data.
There are three categories of actions:
ACTION_FOCUS
.
ACTION_CLICK
action to announce that this action clears browsing history.
Actions are typically added to an AccessibilityNodeInfo
by using
AccessibilityNodeInfo.addAction(AccessibilityAction)
within
View.onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)
and are performed
within View.performAccessibilityAction(int, Bundle)
.
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.
Constructor and Description |
---|
AccessibilityAction(int actionId,
CharSequence label)
Creates a new AccessibilityAction.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other)
Indicates whether some other object is "equal to" this one.
|
int |
getId()
Gets the id for this action.
|
CharSequence |
getLabel()
Gets the label for this action.
|
int |
hashCode()
Returns a hash code value for the object.
|
String |
toString()
Returns a string representation of the object.
|
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_FOCUS
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_FOCUS
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SELECT
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_SELECTION
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLICK
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_LONG_CLICK
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_ACCESSIBILITY_FOCUS
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_ACCESSIBILITY_FOCUS
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_NEXT_AT_MOVEMENT_GRANULARITY
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
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
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
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_NEXT_HTML_ELEMENT
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:
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_PREVIOUS_HTML_ELEMENT
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:
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_FORWARD
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_BACKWARD
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_COPY
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_PASTE
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CUT
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SET_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:
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_EXPAND
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_COLLAPSE
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_DISMISS
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SET_TEXT
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:
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SHOW_ON_SCREEN
View.requestRectangleOnScreen(Rect)
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_TO_POSITION
Arguments:
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_UP
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_LEFT
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_DOWN
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_RIGHT
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CONTEXT_CLICK
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SET_PROGRESS
RangeInfo.getMin()
and
RangeInfo.getMax()
. It should use the same value type as
RangeInfo.getType()
Arguments:
AccessibilityNodeInfo.ACTION_ARGUMENT_PROGRESS_VALUE
AccessibilityNodeInfo.RangeInfo
public AccessibilityAction(int actionId, CharSequence 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.public int getId()
public CharSequence getLabel()
public int hashCode()
Object
HashMap
.
The general contract of hashCode
is:
hashCode
method
must consistently return the same integer, provided no information
used in equals
comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals(Object)
method, then calling the hashCode
method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode
method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by
class Object
does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
JavaTM programming language.)
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public boolean equals(Object other)
Object
The equals
method implements an equivalence relation
on non-null object references:
x
, x.equals(x)
should return
true
.
x
and y
, x.equals(y)
should return true
if and only if
y.equals(x)
returns true
.
x
, y
, and z
, if
x.equals(y)
returns true
and
y.equals(z)
returns true
, then
x.equals(z)
should return true
.
x
and y
, multiple invocations of
x.equals(y)
consistently return true
or consistently return false
, provided no
information used in equals
comparisons on the
objects is modified.
x
,
x.equals(null)
should return false
.
The equals
method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x
and
y
, this method returns true
if and only
if x
and y
refer to the same object
(x == y
has the value true
).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode
method, which states
that equal objects must have equal hash codes.
equals
in class Object
other
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.Object.hashCode()
,
HashMap
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())