PoolingContainer


public final class PoolingContainer


Summary

Public methods

static final void

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

static final void

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

static final void

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

static final boolean

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

static final boolean

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

static final void

Remove a callback that was previously added by addPoolingContainerListener

static final void
setPoolingContainer(@NonNull View receiver, boolean isPoolingContainer)

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

Public methods

addPoolingContainerListener

public static final void addPoolingContainerListener(
    @NonNull View receiver,
    @NonNull PoolingContainerListener listener
)

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

Parameters
@NonNull View receiver

the child view to receive callbacks regarding

callPoolingContainerOnRelease

public static final void callPoolingContainerOnRelease(@NonNull View receiver)

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

public static final void callPoolingContainerOnReleaseForChildren(@NonNull ViewGroup receiver)

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.

public static final boolean isPoolingContainer(@NonNull View receiver)

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!

public static final boolean isWithinPoolingContainer(@NonNull View receiver)

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

removePoolingContainerListener

public static final void removePoolingContainerListener(
    @NonNull View receiver,
    @NonNull PoolingContainerListener listener
)

Remove a callback that was previously added by addPoolingContainerListener

public static final void setPoolingContainer(@NonNull View receiver, boolean isPoolingContainer)

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!