AccessibilityNodeProviderCompat
open class AccessibilityNodeProviderCompat
kotlin.Any | |
↳ | androidx.core.view.accessibility.AccessibilityNodeProviderCompat |
Helper for accessing android.view.accessibility.AccessibilityNodeProvider
.
Summary
Constants | |
---|---|
static Int |
The virtual id for the hosting View. |
Public constructors | |
---|---|
<init>() Creates a new instance. |
|
Creates a new instance wrapping an |
Public methods | |
---|---|
open Unit |
addExtraDataToAccessibilityNodeInfo(virtualViewId: Int, @NonNull info: AccessibilityNodeInfoCompat, @NonNull extraDataKey: String, @Nullable arguments: Bundle?) Adds extra data to an |
open AccessibilityNodeInfoCompat? |
createAccessibilityNodeInfo(virtualViewId: Int) Returns an |
open MutableList<AccessibilityNodeInfoCompat!>? |
findAccessibilityNodeInfosByText(text: String!, virtualViewId: Int) Finds |
open AccessibilityNodeInfoCompat? |
Find the virtual view, i. |
open Any! | |
open Boolean |
performAction(virtualViewId: Int, action: Int, arguments: Bundle!) Performs an accessibility action on a virtual view, i. |
Constants
Public constructors
<init>
AccessibilityNodeProviderCompat()
Creates a new instance.
<init>
AccessibilityNodeProviderCompat(provider: Any!)
Creates a new instance wrapping an android.view.accessibility.AccessibilityNodeProvider
.
Parameters | |
---|---|
provider |
Any!: The provider. |
Public methods
addExtraDataToAccessibilityNodeInfo
open fun addExtraDataToAccessibilityNodeInfo(
virtualViewId: Int,
@NonNull info: AccessibilityNodeInfoCompat,
@NonNull extraDataKey: String,
@Nullable arguments: Bundle?
): Unit
Adds extra data to an AccessibilityNodeInfoCompat
based on an explicit request for the additional data.
This method only needs to be implemented if a virtual view offers to provide additional data.
Parameters | |
---|---|
virtualViewId |
Int: The virtual view id used to create the node |
info |
AccessibilityNodeInfoCompat: The info to which to add the extra data |
extraDataKey |
String: A key specifying the type of extra data to add to the info. The extra data should be added to the Bundle returned by the info's AccessibilityNodeInfoCompat#getExtras method. |
arguments |
Bundle?: A Bundle holding any arguments relevant for this request. |
createAccessibilityNodeInfo
@Nullable open fun createAccessibilityNodeInfo(virtualViewId: Int): AccessibilityNodeInfoCompat?
Returns an AccessibilityNodeInfoCompat
representing a virtual view, i.e. a descendant of the host View, with the given virtualViewId
or the host View itself if virtualViewId
equals to HOST_VIEW_ID
.
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.
The implementer is responsible for obtaining an accessibility node info from the pool of reusable instances and setting the desired properties of the node info before returning it.
Parameters | |
---|---|
virtualViewId |
Int: A client defined virtual view id. |
Return | |
---|---|
AccessibilityNodeInfoCompat? |
A populated AccessibilityNodeInfoCompat for a virtual descendant or the host View. |
See Also
findAccessibilityNodeInfosByText
@Nullable open fun findAccessibilityNodeInfosByText(
text: String!,
virtualViewId: Int
): MutableList<AccessibilityNodeInfoCompat!>?
Finds AccessibilityNodeInfoCompat
s by text. The match is case insensitive containment. The search is relative to the virtual view, i.e. a descendant of the host View, with the given virtualViewId
or the host View itself virtualViewId
equals to HOST_VIEW_ID
.
Parameters | |
---|---|
virtualViewId |
Int: A client defined virtual view id which defined the root of the tree in which to perform the search. |
text |
String!: The searched text. |
Return | |
---|---|
MutableList<AccessibilityNodeInfoCompat!>? |
A list of node info. |
findFocus
@Nullable open fun findFocus(focus: Int): AccessibilityNodeInfoCompat?
Find the virtual view, i.e. a descendant of the host View, that has the specified focus type.
Parameters | |
---|---|
focus |
Int: The focus to find. One of AccessibilityNodeInfoCompat#FOCUS_INPUT or AccessibilityNodeInfoCompat#FOCUS_ACCESSIBILITY . |
Return | |
---|---|
AccessibilityNodeInfoCompat? |
The node info of the focused view or null. |
getProvider
open fun getProvider(): Any!
Return | |
---|---|
Any! |
The wrapped android.view.accessibility.AccessibilityNodeProvider . |
performAction
open fun performAction(
virtualViewId: Int,
action: Int,
arguments: Bundle!
): Boolean
Performs an accessibility action on a virtual view, i.e. a descendant of the host View, with the given virtualViewId
or the host View itself if virtualViewId
equals to HOST_VIEW_ID
.
Parameters | |
---|---|
virtualViewId |
Int: A client defined virtual view id. |
action |
Int: The action to perform. |
arguments |
Bundle!: Optional arguments. |
Return | |
---|---|
Boolean |
True if the action was performed. |