|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectandroid.support.v4.view.accessibility.AccessibilityNodeInfoCompat
public class AccessibilityNodeInfoCompat
Helper for accessing android.view.accessibility.AccessibilityNodeInfo
introduced after API level 4 in a backwards compatible fashion.
Field Summary | |
---|---|
static int |
ACTION_ACCESSIBILITY_FOCUS
Action that gives accessibility focus to the node. |
static java.lang.String |
ACTION_ARGUMENT_HTML_ELEMENT_STRING
Argument for which HTML element to get moving to the next/previous HTML element. |
static java.lang.String |
ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
Argument for which movement granularity to be used when traversing the node text. |
static int |
ACTION_CLEAR_ACCESSIBILITY_FOCUS
Action that clears accessibility focus of the node. |
static int |
ACTION_CLEAR_FOCUS
Action that unfocuses the node. |
static int |
ACTION_CLEAR_SELECTION
Action that unselects the node. |
static int |
ACTION_CLICK
Action that clicks on the node info. |
static int |
ACTION_FOCUS
Action that focuses the node. |
static int |
ACTION_LONG_CLICK
Action that long clicks on the node. |
static 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. |
static int |
ACTION_NEXT_HTML_ELEMENT
Action to move to the next HTML element of a given type. |
static 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. |
static int |
ACTION_PREVIOUS_HTML_ELEMENT
Action to move to the previous HTML element of a given type. |
static int |
ACTION_SCROLL_BACKWARD
Action to scroll the node content backward. |
static int |
ACTION_SCROLL_FORWARD
Action to scroll the node content forward. |
static int |
ACTION_SELECT
Action that selects the node. |
static int |
FOCUS_ACCESSIBILITY
The accessibility focus. |
static int |
FOCUS_INPUT
The input focus. |
static int |
MOVEMENT_GRANULARITY_CHARACTER
Movement granularity bit for traversing the text of a node by character. |
static int |
MOVEMENT_GRANULARITY_LINE
Movement granularity bit for traversing the text of a node by line. |
static int |
MOVEMENT_GRANULARITY_PAGE
Movement granularity bit for traversing the text of a node by page. |
static int |
MOVEMENT_GRANULARITY_PARAGRAPH
Movement granularity bit for traversing the text of a node by paragraph. |
static int |
MOVEMENT_GRANULARITY_WORD
Movement granularity bit for traversing the text of a node by word. |
Constructor Summary | |
---|---|
AccessibilityNodeInfoCompat(java.lang.Object info)
Creates a new instance wrapping an android.view.accessibility.AccessibilityNodeInfo . |
Method Summary | |
---|---|
void |
addAction(int action)
Adds an action that can be performed on the node. |
void |
addChild(View child)
Adds a child. |
void |
addChild(View root,
int virtualDescendantId)
Adds a virtual child which is a descendant of the given root . |
boolean |
equals(java.lang.Object obj)
|
java.util.List<AccessibilityNodeInfoCompat> |
findAccessibilityNodeInfosByText(java.lang.String text)
Finds android.view.accessibility.AccessibilityNodeInfo s by text. |
AccessibilityNodeInfoCompat |
findFocus(int focus)
Find the view that has the specified focus type. |
AccessibilityNodeInfoCompat |
focusSearch(int direction)
Searches for the nearest view in the specified direction that can take input focus. |
int |
getActions()
Gets the actions that can be performed on the node. |
void |
getBoundsInParent(Rect outBounds)
Gets the node bounds in parent coordinates. |
void |
getBoundsInScreen(Rect outBounds)
Gets the node bounds in screen coordinates. |
AccessibilityNodeInfoCompat |
getChild(int index)
Get the child at given index. |
int |
getChildCount()
Gets the number of children. |
java.lang.CharSequence |
getClassName()
Gets the class this node comes from. |
java.lang.CharSequence |
getContentDescription()
Gets the content description of this node. |
java.lang.Object |
getInfo()
|
int |
getMovementGranularities()
Gets the movement granularities for traversing the text of this node. |
java.lang.CharSequence |
getPackageName()
Gets the package this node comes from. |
AccessibilityNodeInfoCompat |
getParent()
Gets the parent. |
java.lang.CharSequence |
getText()
Gets the text of this node. |
int |
getWindowId()
Gets the id of the window from which the info comes from. |
int |
hashCode()
|
boolean |
isAccessibilityFocused()
Gets whether this node is accessibility focused. |
boolean |
isCheckable()
Gets whether this node is checkable. |
boolean |
isChecked()
Gets whether this node is checked. |
boolean |
isClickable()
Gets whether this node is clickable. |
boolean |
isEnabled()
Gets whether this node is enabled. |
boolean |
isFocusable()
Gets whether this node is focusable. |
boolean |
isFocused()
Gets whether this node is focused. |
boolean |
isLongClickable()
Gets whether this node is long clickable. |
boolean |
isPassword()
Gets whether this node is a password. |
boolean |
isScrollable()
Gets if the node is scrollable. |
boolean |
isSelected()
Gets whether this node is selected. |
boolean |
isVisibleToUser()
Sets whether this node is visible to the user. |
static AccessibilityNodeInfoCompat |
obtain()
Returns a cached instance if such is available otherwise a new one. |
static AccessibilityNodeInfoCompat |
obtain(View source)
Returns a cached instance if such is available otherwise a new one and sets the source. |
static AccessibilityNodeInfoCompat |
obtain(View root,
int virtualDescendantId)
Returns a cached instance if such is available otherwise a new one and sets the source. |
boolean |
performAction(int action)
Performs an action on the node. |
boolean |
performAction(int action,
Bundle arguments)
Performs an action on the node. |
void |
recycle()
Return an instance back to be reused. |
void |
setAccessibilityFocused(boolean focused)
Sets whether this node is accessibility focused. |
void |
setBoundsInParent(Rect bounds)
Sets the node bounds in parent coordinates. |
void |
setBoundsInScreen(Rect bounds)
Sets the node bounds in screen coordinates. |
void |
setCheckable(boolean checkable)
Sets whether this node is checkable. |
void |
setChecked(boolean checked)
Sets whether this node is checked. |
void |
setClassName(java.lang.CharSequence className)
Sets the class this node comes from. |
void |
setClickable(boolean clickable)
Sets whether this node is clickable. |
void |
setContentDescription(java.lang.CharSequence contentDescription)
Sets the content description of this node. |
void |
setEnabled(boolean enabled)
Sets whether this node is enabled. |
void |
setFocusable(boolean focusable)
Sets whether this node is focusable. |
void |
setFocused(boolean focused)
Sets whether this node is focused. |
void |
setLongClickable(boolean longClickable)
Sets whether this node is long clickable. |
void |
setMovementGranularities(int granularities)
Sets the movement granularities for traversing the text of this node. |
void |
setPackageName(java.lang.CharSequence packageName)
Sets the package this node comes from. |
void |
setParent(View parent)
Sets the parent. |
void |
setParent(View root,
int virtualDescendantId)
Sets the parent to be a virtual descendant of the given root . |
void |
setPassword(boolean password)
Sets whether this node is a password. |
void |
setScrollable(boolean scrollable)
Sets if the node is scrollable. |
void |
setSelected(boolean selected)
Sets whether this node is selected. |
void |
setSource(View source)
Sets the source. |
void |
setSource(View root,
int virtualDescendantId)
Sets the source to be a virtual descendant of the given root . |
void |
setText(java.lang.CharSequence text)
Sets the text of this node. |
void |
setVisibleToUser(boolean visibleToUser)
Sets whether this node is visible to the user. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ACTION_FOCUS
public static final int ACTION_CLEAR_FOCUS
public static final int ACTION_SELECT
public static final int ACTION_CLEAR_SELECTION
public static final int ACTION_CLICK
public static final int ACTION_LONG_CLICK
public static final int ACTION_ACCESSIBILITY_FOCUS
public static final int ACTION_CLEAR_ACCESSIBILITY_FOCUS
public static final int ACTION_NEXT_AT_MOVEMENT_GRANULARITY
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:
setMovementGranularities(int)
,
getMovementGranularities()
,
MOVEMENT_GRANULARITY_CHARACTER
,
MOVEMENT_GRANULARITY_WORD
,
MOVEMENT_GRANULARITY_LINE
,
MOVEMENT_GRANULARITY_PARAGRAPH
,
MOVEMENT_GRANULARITY_PAGE
,
Constant Field Valuespublic static final int ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
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:
setMovementGranularities(int)
,
getMovementGranularities()
,
MOVEMENT_GRANULARITY_CHARACTER
,
MOVEMENT_GRANULARITY_WORD
,
MOVEMENT_GRANULARITY_LINE
,
MOVEMENT_GRANULARITY_PARAGRAPH
,
MOVEMENT_GRANULARITY_PAGE
,
Constant Field Valuespublic static final int ACTION_NEXT_HTML_ELEMENT
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:
public static final int ACTION_PREVIOUS_HTML_ELEMENT
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:
public static final int ACTION_SCROLL_FORWARD
public static final int ACTION_SCROLL_BACKWARD
public static final java.lang.String ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
Type: int
Actions: ACTION_NEXT_AT_MOVEMENT_GRANULARITY
,
ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
public static final java.lang.String ACTION_ARGUMENT_HTML_ELEMENT_STRING
Type: String
Actions: ACTION_NEXT_HTML_ELEMENT
,
ACTION_PREVIOUS_HTML_ELEMENT
public static final int FOCUS_INPUT
public static final int FOCUS_ACCESSIBILITY
public static final int MOVEMENT_GRANULARITY_CHARACTER
public static final int MOVEMENT_GRANULARITY_WORD
public static final int MOVEMENT_GRANULARITY_LINE
public static final int MOVEMENT_GRANULARITY_PARAGRAPH
public static final int MOVEMENT_GRANULARITY_PAGE
Constructor Detail |
---|
public AccessibilityNodeInfoCompat(java.lang.Object info)
android.view.accessibility.AccessibilityNodeInfo
.
info
- The info.Method Detail |
---|
public java.lang.Object getInfo()
android.view.accessibility.AccessibilityNodeInfo
.public static AccessibilityNodeInfoCompat obtain(View source)
setSource(View)
public static AccessibilityNodeInfoCompat obtain(View root, int virtualDescendantId)
root
- The root of the virtual subtree.virtualDescendantId
- The id of the virtual descendant.
setSource(View, int)
public static AccessibilityNodeInfoCompat obtain()
public void setSource(View source)
source
- The info source.public void setSource(View root, int virtualDescendantId)
root
.
If virtualDescendantId
is View#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
android.accessibilityservice.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.public AccessibilityNodeInfoCompat findFocus(int focus)
focus
- The focus to find. One of FOCUS_INPUT
or
FOCUS_ACCESSIBILITY
.
FOCUS_INPUT
,
FOCUS_ACCESSIBILITY
public AccessibilityNodeInfoCompat focusSearch(int direction)
direction
- The direction. Can be one of:
View#FOCUS_DOWN
,
View#FOCUS_UP
,
View#FOCUS_LEFT
,
View#FOCUS_RIGHT
,
View#FOCUS_FORWARD
,
View#FOCUS_BACKWARD
.
public int getWindowId()
public int getChildCount()
public AccessibilityNodeInfoCompat getChild(int 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.
java.lang.IllegalStateException
- If called outside of an
AccessibilityService.public void addChild(View child)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
child
- The child.
java.lang.IllegalStateException
- If called from an AccessibilityService.public void addChild(View root, int virtualDescendantId)
root
.
If virtualDescendantId
is View#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.public int getActions()
android.view.accessibility.AccessibilityNodeInfo#ACTION_FOCUS
,
android.view.accessibility.AccessibilityNodeInfo#ACTION_CLEAR_FOCUS
,
android.view.accessibility.AccessibilityNodeInfo#ACTION_SELECT
,
android.view.accessibility.AccessibilityNodeInfo#ACTION_CLEAR_SELECTION
public void addAction(int action)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
action
- The action.
java.lang.IllegalStateException
- If called from an AccessibilityService.public boolean performAction(int action)
Note: An action can be performed only if the request is
made from an android.accessibilityservice.AccessibilityService
.
action
- The action to perform.
java.lang.IllegalStateException
- If called outside of an
AccessibilityService.public boolean performAction(int action, Bundle arguments)
Note: An action can be performed only if the request is made
from an android.accessibilityservice.AccessibilityService
.
action
- The action to perform.arguments
- A bundle with additional arguments.
java.lang.IllegalStateException
- If called outside of an AccessibilityService.public void setMovementGranularities(int granularities)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
granularities
- The bit mask with granularities.
java.lang.IllegalStateException
- If called from an AccessibilityService.public int getMovementGranularities()
public java.util.List<AccessibilityNodeInfoCompat> findAccessibilityNodeInfosByText(java.lang.String text)
android.view.accessibility.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 android.view.accessibility.AccessibilityNodeInfo#recycle()
to avoid creating of multiple instances.
text
- The searched text.
public AccessibilityNodeInfoCompat getParent()
Note: It is a client responsibility to recycle the
received info by calling android.view.accessibility.AccessibilityNodeInfo#recycle()
to avoid creating of multiple instances.
public void setParent(View parent)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
parent
- The parent.
java.lang.IllegalStateException
- If called from an AccessibilityService.public void setParent(View root, int virtualDescendantId)
root
.
If virtualDescendantId
equals to View#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
android.accessibilityservice.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.public void getBoundsInParent(Rect outBounds)
outBounds
- The output node bounds.public void setBoundsInParent(Rect bounds)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
bounds
- The node bounds.
java.lang.IllegalStateException
- If called from an AccessibilityService.public void getBoundsInScreen(Rect outBounds)
outBounds
- The output node bounds.public void setBoundsInScreen(Rect bounds)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
bounds
- The node bounds.
java.lang.IllegalStateException
- If called from an AccessibilityService.public boolean isCheckable()
public void setCheckable(boolean checkable)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
checkable
- True if the node is checkable.
java.lang.IllegalStateException
- If called from an AccessibilityService.public boolean isChecked()
public void setChecked(boolean checked)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
checked
- True if the node is checked.
java.lang.IllegalStateException
- If called from an AccessibilityService.public boolean isFocusable()
public void setFocusable(boolean focusable)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
focusable
- True if the node is focusable.
java.lang.IllegalStateException
- If called from an AccessibilityService.public boolean isFocused()
public void setFocused(boolean focused)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
focused
- True if the node is focused.
java.lang.IllegalStateException
- If called from an AccessibilityService.public boolean isVisibleToUser()
public void setVisibleToUser(boolean visibleToUser)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
visibleToUser
- Whether the node is visible to the user.
java.lang.IllegalStateException
- If called from an AccessibilityService.public boolean isAccessibilityFocused()
public void setAccessibilityFocused(boolean focused)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
focused
- True if the node is accessibility focused.
java.lang.IllegalStateException
- If called from an AccessibilityService.public boolean isSelected()
public void setSelected(boolean selected)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
selected
- True if the node is selected.
java.lang.IllegalStateException
- If called from an AccessibilityService.public boolean isClickable()
public void setClickable(boolean clickable)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
clickable
- True if the node is clickable.
java.lang.IllegalStateException
- If called from an AccessibilityService.public boolean isLongClickable()
public void setLongClickable(boolean longClickable)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
longClickable
- True if the node is long clickable.
java.lang.IllegalStateException
- If called from an AccessibilityService.public boolean isEnabled()
public void setEnabled(boolean enabled)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
enabled
- True if the node is enabled.
java.lang.IllegalStateException
- If called from an AccessibilityService.public boolean isPassword()
public void setPassword(boolean password)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
password
- True if the node is a password.
java.lang.IllegalStateException
- If called from an AccessibilityService.public boolean isScrollable()
public void setScrollable(boolean scrollable)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
scrollable
- True if the node is scrollable, false otherwise.
java.lang.IllegalStateException
- If called from an AccessibilityService.public java.lang.CharSequence getPackageName()
public void setPackageName(java.lang.CharSequence packageName)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
packageName
- The package name.
java.lang.IllegalStateException
- If called from an AccessibilityService.public java.lang.CharSequence getClassName()
public void setClassName(java.lang.CharSequence className)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
className
- The class name.
java.lang.IllegalStateException
- If called from an AccessibilityService.public java.lang.CharSequence getText()
public void setText(java.lang.CharSequence text)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
text
- The text.
java.lang.IllegalStateException
- If called from an AccessibilityService.public java.lang.CharSequence getContentDescription()
public void setContentDescription(java.lang.CharSequence contentDescription)
Note: Cannot be called from an
android.accessibilityservice.AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
contentDescription
- The content description.
java.lang.IllegalStateException
- If called from an AccessibilityService.public void recycle()
Note: You must not touch the object after calling this function.
java.lang.IllegalStateException
- If the info is already recycled.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |