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 |
Unit |
Calls |
Unit |
Remove a callback that was previously added by |
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 |
Extension functions
View.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 |
listener: PoolingContainerListener |
the listener that produces onRelease callbacks, triggering resource disposal |
View.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.
ViewGroup.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.
View.removePoolingContainerListener
fun View.removePoolingContainerListener(
listener: PoolingContainerListener
): Unit
Remove a callback that was previously added by addPoolingContainerListener
Extension properties
View.isPoolingContainer
var View.isPoolingContainer: Boolean
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!
View.isWithinPoolingContainer
val View.isWithinPoolingContainer: Boolean
Whether one of this View's ancestors has isPoolingContainer set to true