public class

RecyclerViewAccessibilityDelegate.ItemDelegate

extends AccessibilityDelegateCompat

 java.lang.Object

androidx.core.view.AccessibilityDelegateCompat

↳androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate.ItemDelegate

Overview

The default implementation of accessibility delegate for the individual items of the RecyclerView.

If you are overriding RecyclerViewAccessibilityDelegate#getItemDelegate() but still want to keep some default behavior, you can create an instance of this class and delegate to the parent as necessary.

Summary

Constructors
publicItemDelegate(RecyclerViewAccessibilityDelegate recyclerViewDelegate)

Creates an item delegate for the given RecyclerViewAccessibilityDelegate.

Methods
public booleandispatchPopulateAccessibilityEvent(View host, AccessibilityEvent event)

Dispatches an to the host View first and then to its children for adding their text content to the event.

public AccessibilityNodeProviderCompatgetAccessibilityNodeProvider(View host)

Gets the provider for managing a virtual view hierarchy rooted at this View and reported to s that explore the window content.

public voidonInitializeAccessibilityEvent(View host, AccessibilityEvent event)

Initializes an with information about the the host View which is the event source.

public voidonInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info)

Initializes an AccessibilityNodeInfoCompat with information about the host view.

public voidonPopulateAccessibilityEvent(View host, AccessibilityEvent event)

Gives a chance to the host View to populate the accessibility event with its text content.

public booleanonRequestSendAccessibilityEvent(ViewGroup host, View child, AccessibilityEvent event)

Called when a child of the host View has requested sending an and gives an opportunity to the parent (the host) to augment the event.

public booleanperformAccessibilityAction(View host, int action, Bundle args)

Performs the specified accessibility action on the view.

public voidsendAccessibilityEvent(View host, int eventType)

Sends an accessibility event of the given type.

public voidsendAccessibilityEventUnchecked(View host, AccessibilityEvent event)

Sends an accessibility event.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public ItemDelegate(RecyclerViewAccessibilityDelegate recyclerViewDelegate)

Creates an item delegate for the given RecyclerViewAccessibilityDelegate.

Parameters:

recyclerViewDelegate: The parent RecyclerView's accessibility delegate.

Methods

public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info)

Initializes an AccessibilityNodeInfoCompat with information about the host view.

The default implementation behaves as ViewCompat#onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfoCompat) for the case of no accessibility delegate been set.

Parameters:

host: The View hosting the delegate.
info: The instance to initialize.

See also: ViewCompat#onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfoCompat)

public boolean performAccessibilityAction(View host, int action, Bundle args)

Performs the specified accessibility action on the view. For possible accessibility actions look at AccessibilityNodeInfoCompat.

The default implementation behaves as View#performAccessibilityAction(int, Bundle) for the case of no accessibility delegate been set.

Parameters:

host: View on which to perform the action.
action: The action to perform.
args: Optional action arguments.

Returns:

Whether the action was performed.

See also: View#performAccessibilityAction(int, Bundle)

public void sendAccessibilityEvent(View host, int eventType)

Sends an accessibility event of the given type. If accessibility is not enabled this method has no effect.

The default implementation behaves as View#sendAccessibilityEvent(int) for the case of no accessibility delegate been set.

Parameters:

host: The View hosting the delegate.
eventType: The type of the event to send.

See also: View#sendAccessibilityEvent(int)

public void sendAccessibilityEventUnchecked(View host, AccessibilityEvent event)

Sends an accessibility event. This method behaves exactly as AccessibilityDelegateCompat.sendAccessibilityEvent(View, int) but takes as an argument an empty and does not perform a check whether accessibility is enabled.

The default implementation behaves as View#sendAccessibilityEventUnchecked(AccessibilityEvent) for the case of no accessibility delegate been set.

Parameters:

host: The View hosting the delegate.
event: The event to send.

See also: View#sendAccessibilityEventUnchecked(AccessibilityEvent)

public boolean dispatchPopulateAccessibilityEvent(View host, AccessibilityEvent event)

Dispatches an to the host View first and then to its children for adding their text content to the event.

The default implementation behaves as View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) for the case of no accessibility delegate been set.

Parameters:

host: The View hosting the delegate.
event: The event.

Returns:

True if the event population was completed.

See also: View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)

public void onPopulateAccessibilityEvent(View host, AccessibilityEvent event)

Gives a chance to the host View to populate the accessibility event with its text content.

The default implementation behaves as ViewCompat#onPopulateAccessibilityEvent(AccessibilityEvent) for the case of no accessibility delegate been set.

Parameters:

host: The View hosting the delegate.
event: The accessibility event which to populate.

See also: ViewCompat#onPopulateAccessibilityEvent(View, AccessibilityEvent)

public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event)

Initializes an with information about the the host View which is the event source.

The default implementation behaves as ViewCompat#onInitalizeAccessibilityEvent(View v, AccessibilityEvent event) for the case of no accessibility delegate been set.

Parameters:

host: The View hosting the delegate.
event: The event to initialize.

See also: ViewCompat#onInitializeAccessibilityEvent(View, AccessibilityEvent)

public boolean onRequestSendAccessibilityEvent(ViewGroup host, View child, AccessibilityEvent event)

Called when a child of the host View has requested sending an and gives an opportunity to the parent (the host) to augment the event.

The default implementation behaves as ViewGroupCompat#onRequestSendAccessibilityEvent(ViewGroup, View, AccessibilityEvent) for the case of no accessibility delegate been set.

Parameters:

host: The View hosting the delegate.
child: The child which requests sending the event.
event: The event to be sent.

Returns:

True if the event should be sent

See also: ViewGroupCompat#onRequestSendAccessibilityEvent(ViewGroup, View, AccessibilityEvent)

public AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View host)

Gets the provider for managing a virtual view hierarchy rooted at this View and reported to s that explore the window content.

The default implementation behaves as ViewCompat#getAccessibilityNodeProvider(View) for the case of no accessibility delegate been set.

Returns:

The provider.

See also: AccessibilityNodeProviderCompat