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 SummaryNested Classes Modifier and Type Class Description static interfaceShadowAccessibilityNodeInfo.OnPerformActionListenerstatic classShadowAccessibilityNodeInfo.ShadowAccessibilityActionShadow of AccessibilityAction.
- 
Field SummaryFields Modifier and Type Field Description static Parcelable.Creator<AccessibilityNodeInfo>CREATORstatic intUNDEFINED_SELECTION_INDEX
- 
Constructor SummaryConstructors Constructor Description ShadowAccessibilityNodeInfo()
- 
Method SummaryModifier and Type Method Description protected void__constructor__()protected voidaddAction(int action)protected voidaddAction(AccessibilityNodeInfo.AccessibilityAction action)voidaddChild(AccessibilityNodeInfo child)Add a child node to this one.protected voidaddChild(View child)protected voidaddChild(View root, int virtualDescendantId)static booleanareThereUnrecycledNodes(boolean printUnrecycledNodesToSystemErr)Check for leaked objects that wereobtained but neverrecycled.protected booleancanOpenPopup()protected intdescribeContents()booleanequals(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 List<AccessibilityNodeInfo.AccessibilityAction>getActionList()protected intgetActions()Obtain flags for actions supported.protected voidgetBoundsInParent(Rect outBounds)protected voidgetBoundsInScreen(Rect outBounds)protected AccessibilityNodeInfogetChild(int index)protected intgetChildCount()protected CharSequencegetClassName()protected AccessibilityNodeInfo.CollectionInfogetCollectionInfo()protected AccessibilityNodeInfo.CollectionItemInfogetCollectionItemInfo()protected CharSequencegetContentDescription()protected intgetDrawingOrder()Returns the drawing order of the view corresponding to this node.protected CharSequencegetError()protected intgetInputType()protected AccessibilityNodeInfogetLabeledBy()protected AccessibilityNodeInfogetLabelFor()protected intgetLiveRegion()protected intgetMaxTextLength()protected intgetMovementGranularities()protected CharSequencegetPackageName()protected AccessibilityNodeInfogetParent()List<Integer>getPerformedActions()List<Pair<Integer,Bundle>>getPerformedActionsWithArgs()protected AccessibilityNodeInfo.RangeInfogetRangeInfo()protected CharSequencegetText()protected intgetTextSelectionEnd()Gets the text selection end.protected intgetTextSelectionStart()Gets the text selection start.protected AccessibilityNodeInfogetTraversalAfter()protected AccessibilityNodeInfogetTraversalBefore()protected StringgetViewIdResourceName()protected AccessibilityWindowInfogetWindow()protected intgetWindowId()Returns the id of the window from which the info comes.inthashCode()protected booleanisAccessibilityFocused()protected booleanisCheckable()protected booleanisChecked()protected booleanisClickable()protected booleanisContentInvalid()protected booleanisDismissable()protected booleanisEditable()protected booleanisEnabled()protected booleanisFocusable()protected booleanisFocused()protected booleanisImportantForAccessibility()protected booleanisLongClickable()protected booleanisMultiLine()protected booleanisPassword()booleanisPasteable()protected booleanisScrollable()protected booleanisSelected()protected booleanisTextEntryKey()booleanisTextSelectionSetable()protected booleanisVisibleToUser()protected static AccessibilityNodeInfoobtain()protected static AccessibilityNodeInfoobtain(AccessibilityNodeInfo info)protected static AccessibilityNodeInfoobtain(View view)protected static AccessibilityNodeInfoobtain(View root, int virtualDescendantId)protected booleanperformAction(int action)protected booleanperformAction(int action, Bundle arguments)protected voidrecycle()protected booleanrefresh()protected voidremoveAction(int action)protected booleanremoveAction(AccessibilityNodeInfo.AccessibilityAction action)static voidresetObtainedInstances()Clear list of obtained instance objects.protected voidsetAccessibilityFocused(boolean focused)voidsetAccessibilityWindowInfo(AccessibilityWindowInfo info)protected voidsetBoundsInParent(Rect b)protected voidsetBoundsInScreen(Rect b)protected voidsetCanOpenPopup(boolean opensPopup)protected voidsetCheckable(boolean checkable)protected voidsetChecked(boolean checked)protected voidsetClassName(CharSequence name)protected voidsetClickable(boolean isClickable)protected voidsetCollectionInfo(AccessibilityNodeInfo.CollectionInfo collectionInfo)protected voidsetCollectionItemInfo(AccessibilityNodeInfo.CollectionItemInfo collectionItemInfo)protected voidsetContentDescription(CharSequence description)protected voidsetContentInvalid(boolean contentInvalid)protected voidsetDismissable(boolean dismissable)protected voidsetDrawingOrder(int drawingOrder)Sets the drawing order of the view corresponding to this node.protected voidsetEditable(boolean isEditable)protected voidsetEnabled(boolean enabled)protected voidsetError(CharSequence error)protected voidsetFocusable(boolean isFocusable)protected voidsetFocused(boolean isFocused)protected voidsetImportantForAccessibility(boolean important)protected voidsetInputType(int inputType)voidsetLabeledBy(AccessibilityNodeInfo info)voidsetLabelFor(AccessibilityNodeInfo info)protected voidsetLiveRegion(int liveRegion)protected voidsetLongClickable(boolean isLongClickable)protected voidsetMaxTextLength(int maxTextLength)protected voidsetMovementGranularities(int movementGranularities)protected voidsetMultiLine(boolean multiLine)voidsetOnPerformActionListener(ShadowAccessibilityNodeInfo.OnPerformActionListener listener)Configure the return result of an action if it is performedprotected voidsetPackageName(CharSequence packageName)protected voidsetPassword(boolean password)voidsetPasteable(boolean isPasteable)protected voidsetRangeInfo(AccessibilityNodeInfo.RangeInfo rangeInfo)voidsetRefreshReturnValue(boolean refreshReturnValue)protected voidsetScrollable(boolean isScrollable)protected voidsetSelected(boolean selected)protected voidsetSource(View source)protected voidsetSource(View root, int virtualDescendantId)protected voidsetText(CharSequence t)protected voidsetTextEntryKey(boolean isTextEntrykey)protected voidsetTextSelection(int start, int end)voidsetTextSelectionSetable(boolean isTextSelectionSetable)voidsetTraversalAfter(AccessibilityNodeInfo info)Sets the view whose node is visited after this one in accessibility traversal.protected voidsetTraversalAfter(View view, int virtualDescendantId)voidsetTraversalBefore(AccessibilityNodeInfo info)Sets the view before whose node this one should be visited during traversal.protected voidsetTraversalBefore(View info, int virtualDescendantId)protected voidsetViewIdResourceName(String viewIdResourceName)protected voidsetVisibleToUser(boolean isVisibleToUser)StringtoString()protected voidwriteToParcel(Parcel dest, int flags)
- 
Field Details- 
UNDEFINED_SELECTION_INDEXpublic static final int UNDEFINED_SELECTION_INDEX- See Also:
- Constant Field Values
 
- 
CREATOR
 
- 
- 
Constructor Details- 
ShadowAccessibilityNodeInfopublic ShadowAccessibilityNodeInfo()
 
- 
- 
Method Details- 
__constructor__
- 
obtain
- 
obtain
- 
obtain
- 
obtain
- 
areThereUnrecycledNodespublic static boolean areThereUnrecycledNodes(boolean printUnrecycledNodesToSystemErr)Check for leaked objects that wereobtained but neverrecycled.- Parameters:
- printUnrecycledNodesToSystemErr- - if true, stack traces of calls to- obtainthat lack matching calls to- recycleare dumped to System.err.
- Returns:
- trueif there are unrecycled nodes
 
- 
resetObtainedInstancesClear list of obtained instance objects.areThereUnrecycledNodeswill always return false if called immediately afterwards.
- 
recycle
- 
getChildCount
- 
getChild
- 
getParent
- 
refresh
- 
setRefreshReturnValuepublic void setRefreshReturnValue(boolean refreshReturnValue)
- 
isClickable
- 
isLongClickable
- 
isFocusable
- 
isFocused
- 
isVisibleToUser
- 
isScrollable
- 
isPasteablepublic boolean isPasteable()
- 
isEditable
- 
isTextSelectionSetablepublic boolean isTextSelectionSetable()
- 
isTextEntryKey
- 
isCheckable
- 
setCheckable
- 
setChecked
- 
isChecked
- 
setEnabled
- 
isEnabled
- 
setPassword
- 
isPassword
- 
setSelected
- 
isSelected
- 
setAccessibilityFocused
- 
isAccessibilityFocused
- 
setMultiLine
- 
isMultiLine
- 
setContentInvalid
- 
isContentInvalid
- 
setDismissable
- 
isDismissable
- 
setCanOpenPopup
- 
canOpenPopup
- 
setTextSelectionSetablepublic void setTextSelectionSetable(boolean isTextSelectionSetable)
- 
setClickable
- 
setLongClickable
- 
setFocusable
- 
setFocused
- 
setScrollable
- 
setPasteablepublic void setPasteable(boolean isPasteable)
- 
setEditable
- 
setVisibleToUser
- 
setTextEntryKey
- 
setImportantForAccessibility
- 
isImportantForAccessibility
- 
setContentDescription
- 
getContentDescription
- 
setClassName
- 
getClassName
- 
setText
- 
getText
- 
setTextSelection
- 
getTextSelectionStartGets the text selection start.- Returns:
- The text selection start if there is selection or UNDEFINED_SELECTION_INDEX.
 
- 
getTextSelectionEndGets the text selection end.- Returns:
- The text selection end if there is selection or UNDEFINED_SELECTION_INDEX.
 
- 
getLabelFor
- 
setLabelFor
- 
getLabeledBy
- 
setLabeledBy
- 
getMovementGranularities
- 
setMovementGranularities
- 
getPackageName
- 
setPackageName
- 
getViewIdResourceName
- 
setViewIdResourceName
- 
getCollectionInfo
- 
setCollectionInfo@Implementation(minSdk=19) protected void setCollectionInfo(AccessibilityNodeInfo.CollectionInfo collectionInfo)
- 
getCollectionItemInfo@Implementation(minSdk=19) protected AccessibilityNodeInfo.CollectionItemInfo getCollectionItemInfo()
- 
setCollectionItemInfo@Implementation(minSdk=19) protected void setCollectionItemInfo(AccessibilityNodeInfo.CollectionItemInfo collectionItemInfo)
- 
getInputType
- 
setInputType
- 
getLiveRegion
- 
setLiveRegion
- 
getRangeInfo
- 
setRangeInfo
- 
getMaxTextLength
- 
setMaxTextLength
- 
getError
- 
setError
- 
getTraversalAfter
- 
setTraversalAfter
- 
setTraversalAfterSets 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
- 
setTraversalBeforeSets 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
- 
getBoundsInScreen
- 
getBoundsInParent
- 
setBoundsInScreen
- 
setBoundsInParent
- 
addAction
- 
addAction@Implementation(minSdk=21) protected void addAction(AccessibilityNodeInfo.AccessibilityAction action)
- 
removeAction
- 
removeAction@Implementation(minSdk=21) protected boolean removeAction(AccessibilityNodeInfo.AccessibilityAction action)
- 
getActionsObtain flags for actions supported. Currently only supportsAccessibilityNodeInfo.ACTION_CLICK,AccessibilityNodeInfo.ACTION_LONG_CLICK,AccessibilityNodeInfo.ACTION_SCROLL_FORWARD,AccessibilityNodeInfo.ACTION_PASTE,AccessibilityNodeInfo.ACTION_FOCUS,AccessibilityNodeInfo.ACTION_SET_SELECTION,AccessibilityNodeInfo.ACTION_SCROLL_BACKWARDReturned value is derived from the getters.- Returns:
- Action mask. 0 if no actions supported.
 
- 
getDrawingOrderReturns the drawing order of the view corresponding to this node.
- 
setDrawingOrderSets the drawing order of the view corresponding to this node.
- 
getWindow
- 
getWindowIdReturns the id of the window from which the info comes.
- 
setAccessibilityWindowInfo
- 
getActionList@Implementation(minSdk=21) protected List<AccessibilityNodeInfo.AccessibilityAction> getActionList()
- 
performAction
- 
performAction
- 
equalsEquality check based on reference equality of the Views from which these instances were created, or the equality of their assigned IDs.
- 
hashCode
- 
addChildAdd 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
- 
setOnPerformActionListenerpublic void setOnPerformActionListener(ShadowAccessibilityNodeInfo.OnPerformActionListener listener)Configure the return result of an action if it is performed- Parameters:
- listener- The listener.
 
- 
toString
 
-