itemLongClickEvents
fun <T : Adapter> AdapterView<T>.itemLongClickEvents(handled: (AdapterViewItemLongClickEvent) -> Boolean = { true }): Flow<AdapterViewItemLongClickEvent>
Create a Flow of item long click events on the AdapterView instance.
Parameters
handled
function to be invoked with each value to determine the return value of the underlying AdapterView.OnItemLongClickListener. Note that the Flow will only emit when this function evaluates to true.
Note: Created flow keeps a strong reference to the AdapterView instance until the coroutine that launched the flow collector is cancelled.
Example of usage:
adapterView.itemLongClickEvents { it.position == 0 }
.onEach { event ->
// handle adapter view item long click event
}
.launchIn(uiScope)
Content copied to clipboard