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

Name Summary
<init> TabsAdapter(delegate: Observable<Observer> = ObserverRegistry())
RecyclerView adapter implementation to display a list/grid of tabs.

Functions

Name Summary
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: <ERROR CLASS>, 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

Name Summary
asView open fun asView(): <ERROR CLASS>
Convenience method to cast the implementation of this interface to an Android View object.

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.