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.
onTabsChanged abstract fun onTabsChanged(position: Int, count: Int): Unit
Called after updateTabs() when count number of tabs are updated at the given position.
onTabsInserted abstract fun onTabsInserted(position: Int, count: Int): Unit
Called after updateTabs() when count number of tabs are inserted at the given position.
onTabsMoved abstract fun onTabsMoved(fromPosition: Int, toPosition: Int): Unit
Called after updateTabs() when a tab changes it position.
onTabsRemoved abstract fun onTabsRemoved(position: Int, count: Int): Unit
Called after updateTabs() when count number of tabs are removed from the given position.
updateTabs abstract fun updateTabs(tabs: Tabs): Unit
Updates the list of tabs.

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.