androidx.customview.poolingcontainer

Interfaces

PoolingContainerListener

A callback to inform a child View within a container that manages its children's lifecycle outside of the View hierarchy (such as a RecyclerView) when that child should dispose any resources it holds.

Extension functions summary

Unit

Add a callback for when this View should dispose its resources.

Unit

Calls PoolingContainerListener.onRelease on any PoolingContainerListeners attached to this View or any of its children.

Unit

Calls PoolingContainerListener.onRelease on any PoolingContainerListeners attached to any of its children (not including the ViewGroup itself)

Unit

Remove a callback that was previously added by addPoolingContainerListener

Extension properties summary

Boolean

Whether this View is a container that manages the lifecycle of its child Views.

Boolean

Whether one of this View's ancestors has isPoolingContainer set to true

Extension functions

addPoolingContainerListener

fun View.addPoolingContainerListener(listener: PoolingContainerListener): Unit

Add a callback for when this View should dispose its resources.

Parameters
View

the child view to receive callbacks regarding

callPoolingContainerOnRelease

fun View.callPoolingContainerOnRelease(): Unit

Calls PoolingContainerListener.onRelease on any PoolingContainerListeners attached to this View or any of its children.

At the point when this is called, the View should be detached from the window.

callPoolingContainerOnReleaseForChildren

fun ViewGroup.callPoolingContainerOnReleaseForChildren(): Unit

Calls PoolingContainerListener.onRelease on any PoolingContainerListeners attached to any of its children (not including the ViewGroup itself)

At the point when this is called, the View should be detached from the window.

removePoolingContainerListener

fun View.removePoolingContainerListener(
    listener: PoolingContainerListener
): Unit

Remove a callback that was previously added by addPoolingContainerListener

Extension properties

var View.isPoolingContainerBoolean

Whether this View is a container that manages the lifecycle of its child Views.

Any View that sets this to true must call callPoolingContainerOnRelease on child Views before they are discarded and may possibly not be used in the future. This includes when the view itself is detached from the window, unless it is being held for possible later reattachment and its children should not release their resources.

Warning: Failure to call callPoolingContainerOnRelease when a View is removed from the hierarchy and discarded is likely to result in memory leaks!

val View.isWithinPoolingContainerBoolean

Whether one of this View's ancestors has isPoolingContainer set to true