android-components / / Observable


interface Observable<T> (source)

Interface for observables. This interface is implemented by ObserverRegistry so that classes that want to be observable can implement the interface by delegation:

    class MyObservableClass : Observable<MyObserverInterface> by registry {


Name Summary
isObserved abstract fun isObserved(): Boolean
If the observable has registered observers.
notifyAtLeastOneObserver abstract fun notifyAtLeastOneObserver(block: T.() -> Unit): Unit
Notifies all registered observers about a change. If there is no observer the notification is queued and sent to the first observer that is registered.
notifyObservers abstract fun notifyObservers(block: T.() -> Unit): Unit
Notifies all registered observers about a change.
pauseObserver abstract fun pauseObserver(observer: T): Unit
Pauses the provided observer. No notifications will be sent to this observer until resumeObserver is called.
register abstract fun register(observer: T): Unit
abstract fun register(observer: T, owner: LifecycleOwner, autoPause: Boolean = false): Unit
abstract fun register(observer: T, view: <ERROR CLASS>): Unit
Registers an observer to get notified about changes.
resumeObserver abstract fun resumeObserver(observer: T): Unit
Resumes the provided observer. Notifications sent since it was last paused (see pauseObserver]) are lost and will not be re-delivered.
unregister abstract fun unregister(observer: T): Unit
Unregisters an observer.
unregisterObservers abstract fun unregisterObservers(): Unit
Unregisters all observers.
wrapConsumers abstract fun <R> wrapConsumers(block: T.(R) -> Boolean): List<(R) -> Boolean>
Returns a list of lambdas wrapping a consuming method of an observer.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.


Name Summary
DeviceConstellation interface DeviceConstellation : Observable<DeviceEventsObserver>
Describes available interactions with the current device and other devices associated with an OAuthAccount.
EngineSession abstract class EngineSession : Observable<Observer>
Class representing a single engine session.
FxaAccountManager open class FxaAccountManager : Closeable, Observable<AccountObserver>
An account manager which encapsulates various internal details of an account lifecycle and provides an observer interface along with a public API for interacting with an account. The internal state machine abstracts over state space as exposed by the fxaclient library, not the internal states experienced by lower-level representation of a Firefox Account; those are opaque to us.
FxaDeviceConstellation class FxaDeviceConstellation : DeviceConstellation, Observable<DeviceEventsObserver>
Provides an implementation of DeviceConstellation backed by a FirefoxAccount.
LegacySessionManager class LegacySessionManager : Observable<Observer>
This class provides access to a centralized registry of all active sessions.
Media abstract class Media : Observable<Observer>
Value type that represents a media element that is present on the currently displayed page in a session.
MediaStateMachine object MediaStateMachine : Observable<Observer>
A state machine that subscribes to all Session instances and watches changes to their Media to create an aggregated MediaState.
NearbyConnection class NearbyConnection : Observable<NearbyConnectionObserver>
A class that can be run on two devices to allow them to connect. This supports sending a single message at a time in each direction. It contains internal synchronization and may be accessed from any thread.
ObserverRegistry class ObserverRegistry<T> : Observable<T>
A helper for classes that want to get observed. This class keeps track of registered observers and can automatically unregister observers if a LifecycleOwner is provided.
Session class Session : Observable<Observer>
Value type that represents the state of a browser session. Changes can be observed.
SessionManager class SessionManager : Observable<Observer>
This class provides access to a centralized registry of all active sessions.
TabsAdapter class TabsAdapter : Adapter<TabViewHolder>, TabsTray, Observable<Observer>
RecyclerView adapter implementation to display a list/grid of tabs.
TabsTray interface TabsTray : Observable<Observer>
Generic interface for components that provide “tabs tray” functionality.
WorkManagerSyncDispatcher class WorkManagerSyncDispatcher : SyncDispatcher, Observable<SyncStatusObserver>, Closeable