preDraws

fun View.preDraws(proceedDrawingPass: () -> Boolean): Flow<Unit>

Create a Flow of pre-draw events on the View instance.

Parameters

proceedDrawingPass

function to be invoked to determine whether to proceed with the current drawing pass or cancel.

Note: Created flow keeps a strong reference to the View instance until the coroutine that launched the flow collector is cancelled.

Example of usage:

view.preDraws { shouldProceedDrawingPass }
.onEach {
// handle pre-draw
}
.launchIn(uiScope)