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

Creates a new instance.

<init>(provider: Any!)

Creates a new instance wrapping an android.view.accessibility.AccessibilityNodeProvider.

Public methods

open AccessibilityNodeInfoCompat?

Returns an AccessibilityNodeInfoCompat representing a virtual view, i.

open MutableList<AccessibilityNodeInfoCompat!>?
findAccessibilityNodeInfosByText(text: String!, virtualViewId: Int)

Finds AccessibilityNodeInfoCompats by text.

open AccessibilityNodeInfoCompat?
findFocus(focus: Int)

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

HOST_VIEW_ID

static val HOST_VIEW_ID: Int

The virtual id for the hosting View.

Value: -1

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

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.

findAccessibilityNodeInfosByText

@Nullable open fun findAccessibilityNodeInfosByText(text: String!, virtualViewId: Int): MutableList<AccessibilityNodeInfoCompat!>?

Finds AccessibilityNodeInfoCompats 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 String!: 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 Int: Optional arguments.
Return
Boolean: True if the action was performed.