LiveQueue

interface LiveQueue<T>

An interface for an object emitter which emits objects exactly once. This can be used to send effects that need to be handled only once, while also providing a mechanism to queue and handle effects that occur while the lifecycle-owner is in a paused state.

Parameters

T

The type of object to store

Functions

Link copied to clipboard
abstract fun clearObserver()

Removes the current observer and clears any queued effects.

Link copied to clipboard
abstract fun hasActiveObserver(): Boolean

Returns true if the current observer is in a Resumed state false if the current observer is not Resumed, or there is no current observer

Link copied to clipboard
abstract fun hasObserver(): Boolean

Returns true if there is an observer of this LiveQueue false if there is no current observer assigned

Link copied to clipboard
abstract fun setObserver(lifecycleOwner: LifecycleOwner, liveEffectsObserver: Observer<T>)

A utility method for calling .setObserver] that substitutes null for the optional observer. See linked method doc for full info.

abstract fun setObserver(lifecycleOwner: LifecycleOwner, liveEffectsObserver: Observer<T>, pausedEffectsObserver: Observer<Iterable<T>>?)

The LiveQueue supports only a single observer, so calling this method will override any previous observers set.