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 ofAccessibilityNodeInfothat are normally locked may be changed using test APIs. Calls toobtain()andrecycle()are tracked to help spot bugs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceShadowAccessibilityNodeInfo.OnPerformActionListenerstatic classShadowAccessibilityNodeInfo.ShadowAccessibilityActionShadow of AccessibilityAction.
-
Field Summary
Fields Modifier and Type Field Description static Parcelable.Creator<AccessibilityNodeInfo>CREATORstatic intUNDEFINED_SELECTION_INDEX
-
Constructor Summary
Constructors Constructor Description ShadowAccessibilityNodeInfo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier 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 Detail
-
UNDEFINED_SELECTION_INDEX
public static final int UNDEFINED_SELECTION_INDEX
- See Also:
- Constant Field Values
-
CREATOR
public static final Parcelable.Creator<AccessibilityNodeInfo> CREATOR
-
-
Method Detail
-
__constructor__
@Implementation protected void __constructor__()
-
obtain
@Implementation protected static AccessibilityNodeInfo obtain(AccessibilityNodeInfo info)
-
obtain
@Implementation protected static AccessibilityNodeInfo obtain(View view)
-
obtain
@Implementation protected static AccessibilityNodeInfo obtain()
-
obtain
@Implementation protected static AccessibilityNodeInfo obtain(View root, int virtualDescendantId)
-
areThereUnrecycledNodes
public static boolean areThereUnrecycledNodes(boolean printUnrecycledNodesToSystemErr)
Check for leaked objects that wereobtained but neverrecycled.- Parameters:
printUnrecycledNodesToSystemErr- - if true, stack traces of calls toobtainthat lack matching calls torecycleare dumped to System.err.- Returns:
trueif there are unrecycled nodes
-
resetObtainedInstances
@Resetter public static void resetObtainedInstances()
Clear list of obtained instance objects.areThereUnrecycledNodeswill always return false if called immediately afterwards.
-
recycle
@Implementation protected void recycle()
-
getChildCount
@Implementation protected int getChildCount()
-
getChild
@Implementation protected AccessibilityNodeInfo getChild(int index)
-
getParent
@Implementation protected AccessibilityNodeInfo getParent()
-
refresh
@Implementation(minSdk=18) protected boolean refresh()
-
setRefreshReturnValue
public void setRefreshReturnValue(boolean refreshReturnValue)
-
isClickable
@Implementation protected boolean isClickable()
-
isLongClickable
@Implementation protected boolean isLongClickable()
-
isFocusable
@Implementation protected boolean isFocusable()
-
isFocused
@Implementation protected boolean isFocused()
-
isVisibleToUser
@Implementation protected boolean isVisibleToUser()
-
isScrollable
@Implementation protected boolean isScrollable()
-
isPasteable
public boolean isPasteable()
-
isEditable
@Implementation(minSdk=18) protected boolean isEditable()
-
isTextSelectionSetable
public boolean isTextSelectionSetable()
-
isTextEntryKey
@Implementation(minSdk=29) protected boolean isTextEntryKey()
-
isCheckable
@Implementation protected boolean isCheckable()
-
setCheckable
@Implementation protected void setCheckable(boolean checkable)
-
setChecked
@Implementation protected void setChecked(boolean checked)
-
isChecked
@Implementation protected boolean isChecked()
-
setEnabled
@Implementation protected void setEnabled(boolean enabled)
-
isEnabled
@Implementation protected boolean isEnabled()
-
setPassword
@Implementation protected void setPassword(boolean password)
-
isPassword
@Implementation protected boolean isPassword()
-
setSelected
@Implementation protected void setSelected(boolean selected)
-
isSelected
@Implementation protected boolean isSelected()
-
setAccessibilityFocused
@Implementation protected void setAccessibilityFocused(boolean focused)
-
isAccessibilityFocused
@Implementation protected boolean isAccessibilityFocused()
-
setMultiLine
@Implementation(minSdk=21) protected void setMultiLine(boolean multiLine)
-
isMultiLine
@Implementation(minSdk=21) protected boolean isMultiLine()
-
setContentInvalid
@Implementation(minSdk=21) protected void setContentInvalid(boolean contentInvalid)
-
isContentInvalid
@Implementation(minSdk=21) protected boolean isContentInvalid()
-
setDismissable
@Implementation(minSdk=21) protected void setDismissable(boolean dismissable)
-
isDismissable
@Implementation(minSdk=21) protected boolean isDismissable()
-
setCanOpenPopup
@Implementation(minSdk=21) protected void setCanOpenPopup(boolean opensPopup)
-
canOpenPopup
@Implementation(minSdk=21) protected boolean canOpenPopup()
-
setTextSelectionSetable
public void setTextSelectionSetable(boolean isTextSelectionSetable)
-
setClickable
@Implementation protected void setClickable(boolean isClickable)
-
setLongClickable
@Implementation protected void setLongClickable(boolean isLongClickable)
-
setFocusable
@Implementation protected void setFocusable(boolean isFocusable)
-
setFocused
@Implementation protected void setFocused(boolean isFocused)
-
setScrollable
@Implementation protected void setScrollable(boolean isScrollable)
-
setPasteable
public void setPasteable(boolean isPasteable)
-
setEditable
@Implementation(minSdk=18) protected void setEditable(boolean isEditable)
-
setVisibleToUser
@Implementation protected void setVisibleToUser(boolean isVisibleToUser)
-
setTextEntryKey
@Implementation(minSdk=29) protected void setTextEntryKey(boolean isTextEntrykey)
-
setImportantForAccessibility
@Implementation(minSdk=24) protected void setImportantForAccessibility(boolean important)
-
isImportantForAccessibility
@Implementation(minSdk=24) protected boolean isImportantForAccessibility()
-
setContentDescription
@Implementation protected void setContentDescription(CharSequence description)
-
getContentDescription
@Implementation protected CharSequence getContentDescription()
-
setClassName
@Implementation protected void setClassName(CharSequence name)
-
getClassName
@Implementation protected CharSequence getClassName()
-
setText
@Implementation protected void setText(CharSequence t)
-
getText
@Implementation protected CharSequence getText()
-
setTextSelection
@Implementation(minSdk=18) protected void setTextSelection(int start, int end)
-
getTextSelectionStart
@Implementation(minSdk=18) protected int getTextSelectionStart()
Gets the text selection start.- Returns:
- The text selection start if there is selection or UNDEFINED_SELECTION_INDEX.
-
getTextSelectionEnd
@Implementation(minSdk=18) protected int getTextSelectionEnd()
Gets the text selection end.- Returns:
- The text selection end if there is selection or UNDEFINED_SELECTION_INDEX.
-
getLabelFor
@Implementation(minSdk=18) protected AccessibilityNodeInfo getLabelFor()
-
setLabelFor
public void setLabelFor(AccessibilityNodeInfo info)
-
getLabeledBy
@Implementation(minSdk=17) protected AccessibilityNodeInfo getLabeledBy()
-
setLabeledBy
public void setLabeledBy(AccessibilityNodeInfo info)
-
getMovementGranularities
@Implementation protected int getMovementGranularities()
-
setMovementGranularities
@Implementation protected void setMovementGranularities(int movementGranularities)
-
getPackageName
@Implementation protected CharSequence getPackageName()
-
setPackageName
@Implementation protected void setPackageName(CharSequence packageName)
-
getViewIdResourceName
@Implementation(minSdk=18) protected String getViewIdResourceName()
-
setViewIdResourceName
@Implementation(minSdk=18) protected void setViewIdResourceName(String viewIdResourceName)
-
getCollectionInfo
@Implementation(minSdk=19) protected AccessibilityNodeInfo.CollectionInfo 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
@Implementation(minSdk=19) protected int getInputType()
-
setInputType
@Implementation(minSdk=19) protected void setInputType(int inputType)
-
getLiveRegion
@Implementation(minSdk=19) protected int getLiveRegion()
-
setLiveRegion
@Implementation(minSdk=19) protected void setLiveRegion(int liveRegion)
-
getRangeInfo
@Implementation(minSdk=19) protected AccessibilityNodeInfo.RangeInfo getRangeInfo()
-
setRangeInfo
@Implementation(minSdk=19) protected void setRangeInfo(AccessibilityNodeInfo.RangeInfo rangeInfo)
-
getMaxTextLength
@Implementation(minSdk=21) protected int getMaxTextLength()
-
setMaxTextLength
@Implementation(minSdk=21) protected void setMaxTextLength(int maxTextLength)
-
getError
@Implementation(minSdk=21) protected CharSequence getError()
-
setError
@Implementation(minSdk=21) protected void setError(CharSequence error)
-
getTraversalAfter
@Implementation(minSdk=22) protected AccessibilityNodeInfo getTraversalAfter()
-
setTraversalAfter
@Implementation(minSdk=22) protected void setTraversalAfter(View view, int virtualDescendantId)
-
setTraversalAfter
public void setTraversalAfter(AccessibilityNodeInfo info)
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
@Implementation(minSdk=22) protected AccessibilityNodeInfo getTraversalBefore()
-
setTraversalBefore
@Implementation(minSdk=22) protected void setTraversalBefore(View info, int virtualDescendantId)
-
setTraversalBefore
public void setTraversalBefore(AccessibilityNodeInfo info)
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
@Implementation protected void setSource(View source)
-
setSource
@Implementation protected void setSource(View root, int virtualDescendantId)
-
getBoundsInScreen
@Implementation protected void getBoundsInScreen(Rect outBounds)
-
getBoundsInParent
@Implementation protected void getBoundsInParent(Rect outBounds)
-
setBoundsInScreen
@Implementation protected void setBoundsInScreen(Rect b)
-
setBoundsInParent
@Implementation protected void setBoundsInParent(Rect b)
-
addAction
@Implementation protected void addAction(int action)
-
addAction
@Implementation(minSdk=21) protected void addAction(AccessibilityNodeInfo.AccessibilityAction action)
-
removeAction
@Implementation(minSdk=21) protected void removeAction(int action)
-
removeAction
@Implementation(minSdk=21) protected boolean removeAction(AccessibilityNodeInfo.AccessibilityAction action)
-
getActions
@Implementation protected int getActions()
Obtain 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.
-
getDrawingOrder
@Implementation(minSdk=24) protected int getDrawingOrder()
Returns the drawing order of the view corresponding to this node.
-
setDrawingOrder
@Implementation(minSdk=24) protected void setDrawingOrder(int drawingOrder)
Sets the drawing order of the view corresponding to this node.
-
getWindow
@Implementation(minSdk=21) protected AccessibilityWindowInfo getWindow()
-
getWindowId
@Implementation protected int getWindowId()
Returns the id of the window from which the info comes.
-
setAccessibilityWindowInfo
public void setAccessibilityWindowInfo(AccessibilityWindowInfo info)
-
getActionList
@Implementation(minSdk=21) protected List<AccessibilityNodeInfo.AccessibilityAction> getActionList()
-
performAction
@Implementation protected boolean performAction(int action)
-
performAction
@Implementation protected boolean performAction(int action, Bundle arguments)
-
equals
@Implementation public 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.
-
hashCode
@Implementation public int hashCode()
-
addChild
public void addChild(AccessibilityNodeInfo child)
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
@Implementation protected void addChild(View child)
-
addChild
@Implementation protected void addChild(View root, int virtualDescendantId)
-
getPerformedActions
public List<Integer> getPerformedActions()
- Returns:
- The list of arguments for the various calls to performAction. Unmodifiable.
-
getPerformedActionsWithArgs
public List<Pair<Integer,Bundle>> getPerformedActionsWithArgs()
- Returns:
- The list of arguments for the various calls to performAction. Unmodifiable.
-
describeContents
@Implementation protected int describeContents()
-
writeToParcel
@Implementation protected void writeToParcel(Parcel dest, int flags)
-
setOnPerformActionListener
public void setOnPerformActionListener(ShadowAccessibilityNodeInfo.OnPerformActionListener listener)
Configure the return result of an action if it is performed- Parameters:
listener- The listener.
-
toString
@Implementation public String toString()
-
-