AccessibilityRequestPreparer
abstract class AccessibilityRequestPreparer
kotlin.Any | |
↳ | android.view.accessibility.AccessibilityRequestPreparer |
Object responsible to ensuring that a View
is prepared to meet a synchronous request for accessibility data.
Because accessibility requests arrive to View
s synchronously on the UI thread, a View that requires information from other processes can struggle to meet those requests. Registering an instance of this class with AccessibilityManager
allows a View to be notified when a request is about to be made, and to asynchronously inform the accessibility system when it is ready to meet the request.
Note: This class should only be needed in exceptional situations where a View
cannot otherwise synchronously meet the request for accessibility data.
Summary
Constants | |
---|---|
static Int |
Public constructors | |
---|---|
AccessibilityRequestPreparer(view: View!, requestTypes: Int) |
Public methods | |
---|---|
open View? |
getView() Get the view this object was created with. |
abstract Unit |
onPrepareExtraData(virtualViewId: Int, extraDataKey: String!, args: Bundle!, preparationFinishedMessage: Message!) Callback to allow preparation for filling extra data. |
Constants
Public constructors
AccessibilityRequestPreparer
AccessibilityRequestPreparer(
view: View!,
requestTypes: Int)
Parameters | |
---|---|
view |
View!: The view whose requests need preparation. It must be attached to a window. This object will retain a weak reference to this view, and will unregister itself from AccessibilityManager if the view is detached from a window. It will not re-register itself. |
requestTypes |
Int: The types of requests that require preparation. Different types may be ORed together. Value is either 0 or android.view.accessibility.AccessibilityRequestPreparer#REQUEST_TYPE_EXTRA_DATA |
Exceptions | |
---|---|
java.lang.IllegalStateException |
if the view is not attached to a window. |
Public methods
getView
open fun getView(): View?
Get the view this object was created with.
Return | |
---|---|
View? |
The view this object was created with, or null if the weak reference held to the view is no longer valid. |
onPrepareExtraData
abstract fun onPrepareExtraData(
virtualViewId: Int,
extraDataKey: String!,
args: Bundle!,
preparationFinishedMessage: Message!
): Unit
Callback to allow preparation for filling extra data. Only called back if REQUEST_TYPE_EXTRA_DATA is requested.
Parameters | |
---|---|
virtualViewId |
Int: The ID of a virtual child node, if the View for this preparer supports virtual descendents, or AccessibilityNodeProvider.HOST_VIEW_ID if the request is for the view itself. |
extraDataKey |
String!: The extra data key for the request |
args |
Bundle!: The arguments for the request |
preparationFinishedMessage |
Message!: A message that must be sent to its target when preparations are complete. |
See Also
android.view.View#addExtraDataToAccessibilityNodeInfo(AccessibilityNodeInfo, String, Bundle)
android.view.View.AccessibilityDelegate#addExtraDataToAccessibilityNodeInfo( * View, AccessibilityNodeInfo, String, Bundle)
android.view.accessibility.AccessibilityNodeProvider#addExtraDataToAccessibilityNodeInfo( * int, AccessibilityNodeInfo, String, Bundle)