java.lang.Object | |
↳ | android.support.v4.view.accessibility.AccessibilityNodeInfoCompat |
Helper for accessing AccessibilityNodeInfo
introduced after API level 4 in a backwards compatible fashion.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ACTION_ACCESSIBILITY_FOCUS | Action that gives accessibility focus to the node. | |||||||||
String | ACTION_ARGUMENT_HTML_ELEMENT_STRING | Argument for which HTML element to get moving to the next/previous HTML element. | |||||||||
String | ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT | Argument for which movement granularity to be used when traversing the node text. | |||||||||
int | ACTION_CLEAR_ACCESSIBILITY_FOCUS | Action that clears accessibility focus of the node. | |||||||||
int | ACTION_CLEAR_FOCUS | Action that unfocuses the node. | |||||||||
int | ACTION_CLEAR_SELECTION | Action that unselects the node. | |||||||||
int | ACTION_CLICK | Action that clicks on the node info. | |||||||||
int | ACTION_FOCUS | Action that focuses the node. | |||||||||
int | ACTION_LONG_CLICK | Action that long clicks on the node. | |||||||||
int | ACTION_NEXT_AT_MOVEMENT_GRANULARITY | Action that requests to go to the next entity in this node's text at a given movement granularity. | |||||||||
int | ACTION_NEXT_HTML_ELEMENT | Action to move to the next HTML element of a given type. | |||||||||
int | ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY | Action that requests to go to the previous entity in this node's text at a given movement granularity. | |||||||||
int | ACTION_PREVIOUS_HTML_ELEMENT | Action to move to the previous HTML element of a given type. | |||||||||
int | ACTION_SCROLL_BACKWARD | Action to scroll the node content backward. | |||||||||
int | ACTION_SCROLL_FORWARD | Action to scroll the node content forward. | |||||||||
int | ACTION_SELECT | Action that selects the node. | |||||||||
int | FOCUS_ACCESSIBILITY | The accessibility focus. | |||||||||
int | FOCUS_INPUT | The input focus. | |||||||||
int | MOVEMENT_GRANULARITY_CHARACTER | Movement granularity bit for traversing the text of a node by character. | |||||||||
int | MOVEMENT_GRANULARITY_LINE | Movement granularity bit for traversing the text of a node by line. | |||||||||
int | MOVEMENT_GRANULARITY_PAGE | Movement granularity bit for traversing the text of a node by page. | |||||||||
int | MOVEMENT_GRANULARITY_PARAGRAPH | Movement granularity bit for traversing the text of a node by paragraph. | |||||||||
int | MOVEMENT_GRANULARITY_WORD | Movement granularity bit for traversing the text of a node by word. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new instance wrapping an
AccessibilityNodeInfo . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds an action that can be performed on the node.
| |||||||||||
Adds a child.
| |||||||||||
Adds a virtual child which is a descendant of the given
root . | |||||||||||
Compares this instance with the specified object and indicates if they
are equal.
| |||||||||||
Finds
AccessibilityNodeInfo s by text. | |||||||||||
Find the view that has the specified focus type.
| |||||||||||
Searches for the nearest view in the specified direction that can take
input focus.
| |||||||||||
Gets the actions that can be performed on the node.
| |||||||||||
Gets the node bounds in parent coordinates.
| |||||||||||
Gets the node bounds in screen coordinates.
| |||||||||||
Get the child at given index.
| |||||||||||
Gets the number of children.
| |||||||||||
Gets the class this node comes from.
| |||||||||||
Gets the content description of this node.
| |||||||||||
Gets the movement granularities for traversing the text of this node.
| |||||||||||
Gets the package this node comes from.
| |||||||||||
Gets the parent.
| |||||||||||
Gets the text of this node.
| |||||||||||
Gets the id of the window from which the info comes from.
| |||||||||||
Returns an integer hash code for this object.
| |||||||||||
Gets whether this node is accessibility focused.
| |||||||||||
Gets whether this node is checkable.
| |||||||||||
Gets whether this node is checked.
| |||||||||||
Gets whether this node is clickable.
| |||||||||||
Gets whether this node is enabled.
| |||||||||||
Gets whether this node is focusable.
| |||||||||||
Gets whether this node is focused.
| |||||||||||
Gets whether this node is long clickable.
| |||||||||||
Gets whether this node is a password.
| |||||||||||
Gets if the node is scrollable.
| |||||||||||
Gets whether this node is selected.
| |||||||||||
Sets whether this node is visible to the user.
| |||||||||||
Returns a cached instance if such is available otherwise a new one
and sets the source.
| |||||||||||
Returns a cached instance if such is available or a new one is create.
| |||||||||||
Returns a cached instance if such is available otherwise a new one.
| |||||||||||
Returns a cached instance if such is available otherwise a new one and
sets the source.
| |||||||||||
Performs an action on the node.
| |||||||||||
Performs an action on the node.
| |||||||||||
Return an instance back to be reused.
| |||||||||||
Sets whether this node is accessibility focused.
| |||||||||||
Sets the node bounds in parent coordinates.
| |||||||||||
Sets the node bounds in screen coordinates.
| |||||||||||
Sets whether this node is checkable.
| |||||||||||
Sets whether this node is checked.
| |||||||||||
Sets the class this node comes from.
| |||||||||||
Sets whether this node is clickable.
| |||||||||||
Sets the content description of this node.
| |||||||||||
Sets whether this node is enabled.
| |||||||||||
Sets whether this node is focusable.
| |||||||||||
Sets whether this node is focused.
| |||||||||||
Sets whether this node is long clickable.
| |||||||||||
Sets the movement granularities for traversing the text of this node.
| |||||||||||
Sets the package this node comes from.
| |||||||||||
Sets the parent.
| |||||||||||
Sets the parent to be a virtual descendant of the given
root . | |||||||||||
Sets whether this node is a password.
| |||||||||||
Sets if the node is scrollable.
| |||||||||||
Sets whether this node is selected.
| |||||||||||
Sets the source to be a virtual descendant of the given
root . | |||||||||||
Sets the source.
| |||||||||||
Sets the text of this node.
| |||||||||||
Sets whether this node is visible to the user.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Action that gives accessibility focus to the node.
Argument for which HTML element to get moving to the next/previous HTML element.
Type: String
Actions: ACTION_NEXT_HTML_ELEMENT
,
ACTION_PREVIOUS_HTML_ELEMENT
Argument for which movement granularity to be used when traversing the node text.
Type: int
Actions: ACTION_NEXT_AT_MOVEMENT_GRANULARITY
,
ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
Action that clears accessibility focus of the node.
Action that unfocuses the node.
Action that unselects the node.
Action that clicks on the node info.
Action that focuses 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);
info.performAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
Example:
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(AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT, arguments);
ACTION_ARGUMENT_HTML_ELEMENT_STRING
Example:
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);
info.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY,
arguments);
ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
Example:
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(AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT, arguments);
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.
The accessibility focus.
The input focus.
Movement granularity bit for traversing the text of a node by character.
Movement granularity bit for traversing the text of a node by line.
Movement granularity bit for traversing the text of a node by page.
Movement granularity bit for traversing the text of a node by paragraph.
Movement granularity bit for traversing the text of a node by word.
Creates a new instance wrapping an
AccessibilityNodeInfo
.
info | The info. |
---|
Adds an action that can be performed on the node.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
action | The action. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Adds a child.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
child | The child. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Adds a virtual child which is a descendant of the given root
.
If virtualDescendantId
is NO_ID
the root
is added as a child.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.
root | The root of the virtual subtree. |
---|---|
virtualDescendantId | The id of the virtual child. |
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.
obj | the object to compare this instance with. |
---|
true
if the specified object is equal to this Object
; false
otherwise.Finds AccessibilityNodeInfo
s by text. The match
is case insensitive containment. The search is relative to this info i.e. this
info is the root of the traversed tree.
Note: It is a client responsibility to recycle the
received info by calling recycle()
to avoid creating of multiple instances.
text | The searched text. |
---|
Find the view that has the specified focus type. The search starts from the view represented by this node info.
focus | The focus to find. One of FOCUS_INPUT or
FOCUS_ACCESSIBILITY . |
---|
Searches for the nearest view in the specified direction that can take input focus.
direction | The direction. Can be one of:
FOCUS_DOWN ,
FOCUS_UP ,
FOCUS_LEFT ,
FOCUS_RIGHT ,
FOCUS_FORWARD ,
FOCUS_BACKWARD . |
---|
Gets the actions that can be performed on the node.
Gets the node bounds in parent coordinates.
outBounds | The output node bounds. |
---|
Gets the node bounds in screen coordinates.
outBounds | The output node bounds. |
---|
Get the child at given index.
Note: It is a client responsibility to recycle the
received info by calling recycle()
to
avoid creating of multiple instances.
index | The child index. |
---|
IllegalStateException | If called outside of an AccessibilityService. |
---|
Gets the number of children.
Gets the content description of this node.
Gets the movement granularities for traversing the text of this node.
Gets the package this node comes from.
Gets the parent.
Note: It is a client responsibility to recycle the
received info by calling recycle()
to avoid creating of multiple instances.
Gets the id of the window from which the info comes from.
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.
Gets whether this node is accessibility focused.
Gets whether this node is checkable.
Gets whether this node is checked.
Gets whether this node is clickable.
Gets whether this node is enabled.
Gets whether this node is focusable.
Gets whether this node is focused.
Gets whether this node is long clickable.
Gets whether this node is a password.
Gets if the node is scrollable.
Gets whether this node is selected.
Sets whether this node is visible to the user.
Returns a cached instance if such is available otherwise a new one and sets the source.
root | The root of the virtual subtree. |
---|---|
virtualDescendantId | The id of the virtual descendant. |
Returns a cached instance if such is available or a new one is create.
The returned instance is initialized from the given info
.
info | The other info. |
---|
Returns a cached instance if such is available otherwise a new one.
Returns a cached instance if such is available otherwise a new one and sets the source.
Performs an action on the node.
Note: An action can be performed only if the request is
made from an AccessibilityService
.
action | The action to perform. |
---|
IllegalStateException | If called outside of an AccessibilityService. |
---|
Performs an action on the node.
Note: An action can be performed only if the request is made
from an AccessibilityService
.
action | The action to perform. |
---|---|
arguments | A bundle with additional arguments. |
IllegalStateException | If called outside of an AccessibilityService. |
---|
Return an instance back to be reused.
Note: You must not touch the object after calling this function.
IllegalStateException | If the info is already recycled. |
---|
Sets whether this node is accessibility focused.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
focused | True if the node is accessibility focused. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the node bounds in parent coordinates.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
bounds | The node bounds. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the node bounds in screen coordinates.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
bounds | The node bounds. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is checkable.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
checkable | True if the node is checkable. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is checked.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
checked | True if the node is checked. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the class this node comes from.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
className | The class name. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is clickable.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
clickable | True if the node is clickable. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the content description of this node.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
contentDescription | The content description. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is enabled.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
enabled | True if the node is enabled. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is focusable.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
focusable | True if the node is focusable. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is focused.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
focused | True if the node is focused. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is long clickable.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
longClickable | True if the node is long clickable. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the movement granularities for traversing the text of this node.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
granularities | The bit mask with granularities. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the package this node comes from.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
packageName | The package name. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the parent.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
parent | The parent. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the parent to be a virtual descendant of the given root
.
If virtualDescendantId
equals to NO_ID
the root
is set as the parent.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
root | The root of the virtual subtree. |
---|---|
virtualDescendantId | The id of the virtual descendant. |
Sets whether this node is a password.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
password | True if the node is a password. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets if the node is scrollable.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
scrollable | True if the node is scrollable, false otherwise. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is selected.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
selected | True if the node is selected. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the source to be a virtual descendant of the given root
.
If virtualDescendantId
is NO_ID
the root
is set as the source.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report themselves as a tree of virtual views, thus conveying their logical structure.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
root | The root of the virtual subtree. |
---|---|
virtualDescendantId | The id of the virtual descendant. |
Sets the text of this node.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
text | The text. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is visible to the user.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
visibleToUser | Whether the node is visible to the user. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|