android-components / mozilla.components.browser.tabstray / TabsAdapter

TabsAdapter

class TabsAdapter : Adapter<TabViewHolder>, TabsTray, Observable<Observer> (source)

RecyclerView adapter implementation to display a list/grid of tabs.

Constructors

<init>

TabsAdapter(delegate: Observable<Observer> = ObserverRegistry())

RecyclerView adapter implementation to display a list/grid of tabs.

Functions

displaySessions

fun displaySessions(sessions: List<Session>, selectedIndex: Int): Unit

Displays the given list of sessions.

getItemCount

fun getItemCount(): Int

onBindViewHolder

fun onBindViewHolder(holder: TabViewHolder, position: Int): Unit

onCreateViewHolder

fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TabViewHolder

onSessionMoved

fun onSessionMoved(fromPosition: Int, toPosition: Int): Unit

Called after updateSessions() when a session changes it position.

onSessionsChanged

fun onSessionsChanged(position: Int, count: Int): Unit

Called after updateSessions() when count number of sessions are updated at the given position.

onSessionsInserted

fun onSessionsInserted(position: Int, count: Int): Unit

Called after updateSessions() when count number of sessions are inserted at the given position.

onSessionsRemoved

fun onSessionsRemoved(position: Int, count: Int): Unit

Called after updateSessions() when count number of sessions are removed from the given position.

onViewRecycled

fun onViewRecycled(holder: TabViewHolder): Unit

unsubscribeHolders

fun unsubscribeHolders(): Unit

updateSessions

fun updateSessions(sessions: List<Session>, selectedIndex: Int): Unit

Updates the list of sessions.

Inherited Functions

asView

open fun asView(): View

Convenience method to cast the implementation of this interface to an Android View object.