Package org.robolectric.shadows
Class ShadowAccessibilityNodeInfo
java.lang.Object
org.robolectric.shadows.ShadowAccessibilityNodeInfo
@Implements(android.view.accessibility.AccessibilityNodeInfo.class) public class ShadowAccessibilityNodeInfo extends Object
Properties of
AccessibilityNodeInfo
that are normally locked
may be changed using test APIs.
Calls to obtain()
and recycle()
are tracked to help spot bugs.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ShadowAccessibilityNodeInfo.OnPerformActionListener
-
Field Summary
Fields Modifier and Type Field Description static Parcelable.Creator<AccessibilityNodeInfo>
CREATOR
-
Constructor Summary
Constructors Constructor Description ShadowAccessibilityNodeInfo()
-
Method Summary
Modifier and Type Method Description protected void
__constructor__()
void
addChild(AccessibilityNodeInfo child)
Add a child node to this one.protected void
addChild(View child)
protected void
addChild(View root, int virtualDescendantId)
static boolean
areThereUnrecycledNodes(boolean printUnrecycledNodesToSystemErr)
Check for leaked objects that wereobtain
ed but neverrecycle
d.protected int
describeContents()
boolean
equals(Object object)
Equality check based on reference equality of the Views from which these instances were created, or the equality of their assigned IDs.protected AccessibilityNodeInfo
getChild(int index)
protected int
getChildCount()
protected AccessibilityNodeInfo
getLabeledBy()
protected AccessibilityNodeInfo
getLabelFor()
protected AccessibilityNodeInfo
getParent()
List<Integer>
getPerformedActions()
List<Pair<Integer,Bundle>>
getPerformedActionsWithArgs()
protected CharSequence
getText()
protected AccessibilityNodeInfo
getTraversalAfter()
protected AccessibilityNodeInfo
getTraversalBefore()
protected AccessibilityWindowInfo
getWindow()
protected int
getWindowId()
Returns the id of the window from which the info comes.int
hashCode()
boolean
isPasteable()
boolean
isTextSelectionSetable()
protected static AccessibilityNodeInfo
obtain()
protected static AccessibilityNodeInfo
obtain(AccessibilityNodeInfo info)
protected static AccessibilityNodeInfo
obtain(View view)
protected static AccessibilityNodeInfo
obtain(View root, int virtualDescendantId)
protected boolean
performAction(int action)
protected boolean
performAction(int action, Bundle arguments)
protected void
recycle()
protected boolean
refresh()
static void
resetObtainedInstances()
Clear list of obtained instance objects.void
setAccessibilityWindowInfo(AccessibilityWindowInfo info)
void
setLabeledBy(AccessibilityNodeInfo info)
void
setLabelFor(AccessibilityNodeInfo info)
void
setOnPerformActionListener(ShadowAccessibilityNodeInfo.OnPerformActionListener listener)
Configure the return result of an action if it is performedvoid
setPasteable(boolean isPasteable)
void
setRefreshReturnValue(boolean refreshReturnValue)
protected void
setSource(View source)
protected void
setSource(View root, int virtualDescendantId)
protected void
setText(CharSequence t)
void
setTextSelectionSetable(boolean isTextSelectionSetable)
void
setTraversalAfter(AccessibilityNodeInfo info)
Sets the view whose node is visited after this one in accessibility traversal.protected void
setTraversalAfter(View view, int virtualDescendantId)
void
setTraversalBefore(AccessibilityNodeInfo info)
Sets the view before whose node this one should be visited during traversal.protected void
setTraversalBefore(View info, int virtualDescendantId)
String
toString()
protected void
writeToParcel(Parcel dest, int flags)
-
Field Details
-
Constructor Details
-
ShadowAccessibilityNodeInfo
public ShadowAccessibilityNodeInfo()
-
-
Method Details
-
__constructor__
-
obtain
-
obtain
-
obtain
-
obtain
-
areThereUnrecycledNodes
public static boolean areThereUnrecycledNodes(boolean printUnrecycledNodesToSystemErr)Check for leaked objects that wereobtain
ed but neverrecycle
d.- Parameters:
printUnrecycledNodesToSystemErr
- - if true, stack traces of calls toobtain
that lack matching calls torecycle
are dumped to System.err.- Returns:
true
if there are unrecycled nodes
-
resetObtainedInstances
Clear list of obtained instance objects.areThereUnrecycledNodes
will always return false if called immediately afterwards. -
recycle
-
getChildCount
-
getChild
-
getParent
-
refresh
-
setRefreshReturnValue
public void setRefreshReturnValue(boolean refreshReturnValue) -
isPasteable
public boolean isPasteable() -
isTextSelectionSetable
public boolean isTextSelectionSetable() -
setTextSelectionSetable
public void setTextSelectionSetable(boolean isTextSelectionSetable) -
setPasteable
public void setPasteable(boolean isPasteable) -
setText
-
getText
-
getLabelFor
-
setLabelFor
-
getLabeledBy
-
setLabeledBy
-
getTraversalAfter
-
setTraversalAfter
-
setTraversalAfter
Sets the view whose node is visited after this one in accessibility traversal. This may be useful for configuring traversal order in tests before the corresponding views have been inflated.- Parameters:
info
- The previous node.- See Also:
getTraversalAfter()
-
getTraversalBefore
-
setTraversalBefore
-
setTraversalBefore
Sets the view before whose node this one should be visited during traversal. This may be useful for configuring traversal order in tests before the corresponding views have been inflated.- Parameters:
info
- The view providing the preceding node.- See Also:
getTraversalBefore()
-
setSource
-
setSource
-
getWindow
-
getWindowId
Returns the id of the window from which the info comes. -
setAccessibilityWindowInfo
-
performAction
-
performAction
-
equals
Equality check based on reference equality of the Views from which these instances were created, or the equality of their assigned IDs. -
hashCode
-
addChild
Add a child node to this one. Also initializes the parent field of the child.- Parameters:
child
- The node to be added as a child.
-
addChild
-
addChild
-
getPerformedActions
- Returns:
- The list of arguments for the various calls to performAction. Unmodifiable.
-
getPerformedActionsWithArgs
- Returns:
- The list of arguments for the various calls to performAction. Unmodifiable.
-
describeContents
-
writeToParcel
-
setOnPerformActionListener
public void setOnPerformActionListener(ShadowAccessibilityNodeInfo.OnPerformActionListener listener)Configure the return result of an action if it is performed- Parameters:
listener
- The listener.
-
toString
-