LifecycleAwareListenersOwner

class LifecycleAwareListenersOwner<T> : LifecycleAwareListeners<T>

Provides access to a list of listeners with active Android Lifecycle owners from LifecycleAwareListeners.

Lifecycle owners are considered active only when their state is Lifecycle.State.STARTED or Lifecycle.State.RESUMED.

Constructors

Link copied to clipboard
fun LifecycleAwareListenersOwner()

Properties

Link copied to clipboard
open override val activeListeners: Sequence<T>

The registered listeners that are in an active state and are thus ready to handle callbacks.

Inherited properties

Link copied to clipboard
val active: LiveData<Boolean>

true when at least one of the registered listeners is active; false otherwise.

Functions

Link copied to clipboard
fun asLifecycleAwareListeners(): LifecycleAwareListeners<T>

Returns this as LifecycleAwareListeners.

Inherited functions

Link copied to clipboard
fun addListener(lifecycleOwner: LifecycleOwner, listener: T)

Add a listener that will receive events when its LifecycleOwner is active.

Link copied to clipboard
fun addListenerForever(listener: T)

Add a listener that will always receive events.

Link copied to clipboard
fun removeListener(listener: T)

Remove listener.

Link copied to clipboard
fun removeListeners(owner: LifecycleOwner)

Remove all listeners registered with a lifecycle owner.