android-components / mozilla.components.concept.tabstray / TabsTray

TabsTray

interface TabsTray : Observable<Observer> (source)

Generic interface for components that provide “tabs tray” functionality.

Types

Name Summary
Observer interface Observer
Interface to be implemented by classes that want to observe a tabs tray.

Functions

Name Summary
asView open fun asView(): <ERROR CLASS>
Convenience method to cast the implementation of this interface to an Android View object.
displaySessions abstract fun displaySessions(sessions: List<Session>, selectedIndex: Int): Unit
Displays the given list of sessions.
onSessionMoved abstract fun onSessionMoved(fromPosition: Int, toPosition: Int): Unit
Called after updateSessions() when a session changes it position.
onSessionsChanged abstract fun onSessionsChanged(position: Int, count: Int): Unit
Called after updateSessions() when count number of sessions are updated at the given position.
onSessionsInserted abstract fun onSessionsInserted(position: Int, count: Int): Unit
Called after updateSessions() when count number of sessions are inserted at the given position.
onSessionsRemoved abstract fun onSessionsRemoved(position: Int, count: Int): Unit
Called after updateSessions() when count number of sessions are removed from the given position.
updateSessions abstract fun updateSessions(sessions: List<Session>, selectedIndex: Int): Unit
Updates the list of sessions.

Inherited Functions

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.

Inheritors

Name Summary
BrowserTabsTray class BrowserTabsTray : RecyclerView, TabsTray
A customizable tabs tray for browsers.
TabsAdapter class TabsAdapter : Adapter<TabViewHolder>, TabsTray, Observable<Observer>
RecyclerView adapter implementation to display a list/grid of tabs.