ComposableSwitchViewHolder

A concrete implementation of ActionableComposableViewHolder for displaying an item view that includes a switch widget.

This ViewHolder is responsible for binding data to the switch, handling its state changes, and managing interactions with the underlying data model. It observes changes in the selectableItem and updates the switch's checked state accordingly. It also allows the user to toggle the switch, which in turn updates the selectableItem.

Accessibility is handled by making the switch focusable only when there's a custom click listener attached to the item view, ensuring that both the item view and the switch are not focusable simultaneously, which can be confusing for accessibility services.

The ViewHolder also manages resources by disposing of any active DisposableHandle and clearing listeners when the view is recycled.

Constructors

Link copied to clipboard
constructor(frameView: View)

Functions

Link copied to clipboard
open override fun bindData(viewData: ViewData)
Link copied to clipboard
open override fun onBind(itemView: View)

Binds click events on the parent ViewHolder's view to this ActionableComposableViewHolder's doAction if the parent view doesn't handle click events itself.

Link copied to clipboard
open override fun onViewRecycled(itemView: View)

Cleans up any resources when the view is recycled. It removes the click listener from the itemView and sets the doAction to null.