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

TabsTray

interface TabsTray : Observable<Observer> (source)

Generic interface for components that provide "tabs tray" functionality.

Types

Observer

interface Observer

Interface to be implemented by classes that want to observe a tabs tray.

Functions

asView

open fun asView(): View

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

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: View): 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.

Inheritors

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.