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
static class
ShadowAccessibilityNodeInfo.ShadowAccessibilityAction
Shadow of AccessibilityAction. -
Field Summary
Fields Modifier and Type Field Description static Parcelable.Creator<AccessibilityNodeInfo>
CREATOR
static int
UNDEFINED_SELECTION_INDEX
-
Constructor Summary
Constructors Constructor Description ShadowAccessibilityNodeInfo()
-
Method Summary
Modifier and Type Method Description protected void
__constructor__()
protected void
addAction(int action)
protected void
addAction(AccessibilityNodeInfo.AccessibilityAction action)
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 boolean
canOpenPopup()
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 List<AccessibilityNodeInfo.AccessibilityAction>
getActionList()
protected int
getActions()
Obtain flags for actions supported.protected void
getBoundsInParent(Rect outBounds)
protected void
getBoundsInScreen(Rect outBounds)
protected AccessibilityNodeInfo
getChild(int index)
protected int
getChildCount()
protected CharSequence
getClassName()
protected AccessibilityNodeInfo.CollectionInfo
getCollectionInfo()
protected AccessibilityNodeInfo.CollectionItemInfo
getCollectionItemInfo()
protected CharSequence
getContentDescription()
protected int
getDrawingOrder()
Returns the drawing order of the view corresponding to this node.protected CharSequence
getError()
protected int
getInputType()
protected AccessibilityNodeInfo
getLabeledBy()
protected AccessibilityNodeInfo
getLabelFor()
protected int
getLiveRegion()
protected int
getMaxTextLength()
protected int
getMovementGranularities()
protected CharSequence
getPackageName()
protected AccessibilityNodeInfo
getParent()
List<Integer>
getPerformedActions()
List<Pair<Integer,Bundle>>
getPerformedActionsWithArgs()
protected AccessibilityNodeInfo.RangeInfo
getRangeInfo()
protected CharSequence
getText()
protected int
getTextSelectionEnd()
Gets the text selection end.protected int
getTextSelectionStart()
Gets the text selection start.protected AccessibilityNodeInfo
getTraversalAfter()
protected AccessibilityNodeInfo
getTraversalBefore()
protected String
getViewIdResourceName()
protected AccessibilityWindowInfo
getWindow()
protected int
getWindowId()
Returns the id of the window from which the info comes.int
hashCode()
protected boolean
isAccessibilityFocused()
protected boolean
isCheckable()
protected boolean
isChecked()
protected boolean
isClickable()
protected boolean
isContentInvalid()
protected boolean
isDismissable()
protected boolean
isEditable()
protected boolean
isEnabled()
protected boolean
isFocusable()
protected boolean
isFocused()
protected boolean
isImportantForAccessibility()
protected boolean
isLongClickable()
protected boolean
isMultiLine()
protected boolean
isPassword()
boolean
isPasteable()
protected boolean
isScrollable()
protected boolean
isSelected()
protected boolean
isTextEntryKey()
boolean
isTextSelectionSetable()
protected boolean
isVisibleToUser()
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()
protected void
removeAction(int action)
protected boolean
removeAction(AccessibilityNodeInfo.AccessibilityAction action)
static void
resetObtainedInstances()
Clear list of obtained instance objects.protected void
setAccessibilityFocused(boolean focused)
void
setAccessibilityWindowInfo(AccessibilityWindowInfo info)
protected void
setBoundsInParent(Rect b)
protected void
setBoundsInScreen(Rect b)
protected void
setCanOpenPopup(boolean opensPopup)
protected void
setCheckable(boolean checkable)
protected void
setChecked(boolean checked)
protected void
setClassName(CharSequence name)
protected void
setClickable(boolean isClickable)
protected void
setCollectionInfo(AccessibilityNodeInfo.CollectionInfo collectionInfo)
protected void
setCollectionItemInfo(AccessibilityNodeInfo.CollectionItemInfo collectionItemInfo)
protected void
setContentDescription(CharSequence description)
protected void
setContentInvalid(boolean contentInvalid)
protected void
setDismissable(boolean dismissable)
protected void
setDrawingOrder(int drawingOrder)
Sets the drawing order of the view corresponding to this node.protected void
setEditable(boolean isEditable)
protected void
setEnabled(boolean enabled)
protected void
setError(CharSequence error)
protected void
setFocusable(boolean isFocusable)
protected void
setFocused(boolean isFocused)
protected void
setImportantForAccessibility(boolean important)
protected void
setInputType(int inputType)
void
setLabeledBy(AccessibilityNodeInfo info)
void
setLabelFor(AccessibilityNodeInfo info)
protected void
setLiveRegion(int liveRegion)
protected void
setLongClickable(boolean isLongClickable)
protected void
setMaxTextLength(int maxTextLength)
protected void
setMovementGranularities(int movementGranularities)
protected void
setMultiLine(boolean multiLine)
void
setOnPerformActionListener(ShadowAccessibilityNodeInfo.OnPerformActionListener listener)
Configure the return result of an action if it is performedprotected void
setPackageName(CharSequence packageName)
protected void
setPassword(boolean password)
void
setPasteable(boolean isPasteable)
protected void
setRangeInfo(AccessibilityNodeInfo.RangeInfo rangeInfo)
void
setRefreshReturnValue(boolean refreshReturnValue)
protected void
setScrollable(boolean isScrollable)
protected void
setSelected(boolean selected)
protected void
setSource(View source)
protected void
setSource(View root, int virtualDescendantId)
protected void
setText(CharSequence t)
protected void
setTextEntryKey(boolean isTextEntrykey)
protected void
setTextSelection(int start, int end)
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)
protected void
setViewIdResourceName(String viewIdResourceName)
protected void
setVisibleToUser(boolean isVisibleToUser)
String
toString()
protected void
writeToParcel(Parcel dest, int flags)
-
Field Details
-
UNDEFINED_SELECTION_INDEX
public static final int UNDEFINED_SELECTION_INDEX- See Also:
- Constant Field Values
-
CREATOR
-
-
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) -
isClickable
-
isLongClickable
-
isFocusable
-
isFocused
-
isVisibleToUser
-
isScrollable
-
isPasteable
public boolean isPasteable() -
isEditable
-
isTextSelectionSetable
public boolean isTextSelectionSetable() -
isTextEntryKey
-
isCheckable
-
setCheckable
-
setChecked
-
isChecked
-
setEnabled
-
isEnabled
-
setPassword
-
isPassword
-
setSelected
-
isSelected
-
setAccessibilityFocused
-
isAccessibilityFocused
-
setMultiLine
-
isMultiLine
-
setContentInvalid
-
isContentInvalid
-
setDismissable
-
isDismissable
-
setCanOpenPopup
-
canOpenPopup
-
setTextSelectionSetable
public void setTextSelectionSetable(boolean isTextSelectionSetable) -
setClickable
-
setLongClickable
-
setFocusable
-
setFocused
-
setScrollable
-
setPasteable
public void setPasteable(boolean isPasteable) -
setEditable
-
setVisibleToUser
-
setTextEntryKey
-
setImportantForAccessibility
-
isImportantForAccessibility
-
setContentDescription
-
getContentDescription
-
setClassName
-
getClassName
-
setText
-
getText
-
setTextSelection
-
getTextSelectionStart
Gets the text selection start.- Returns:
- The text selection start if there is selection or UNDEFINED_SELECTION_INDEX.
-
getTextSelectionEnd
Gets 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
-
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
-
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) -
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_BACKWARD
Returned value is derived from the getters.- Returns:
- Action mask. 0 if no actions supported.
-
getDrawingOrder
Returns the drawing order of the view corresponding to this node. -
setDrawingOrder
Sets the drawing order of the view corresponding to this node. -
getWindow
-
getWindowId
Returns the id of the window from which the info comes. -
setAccessibilityWindowInfo
-
getActionList
@Implementation(minSdk=21) protected List<AccessibilityNodeInfo.AccessibilityAction> getActionList() -
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
-