Register now for Android Dev Summit 2019!

ItemBridgeAdapter

open class ItemBridgeAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder!>, FacetProviderAdapter
kotlin.Any
   ↳ androidx.recyclerview.widget.RecyclerView.Adapter<androidx.recyclerview.widget.RecyclerView.ViewHolder>
   ↳ androidx.leanback.widget.ItemBridgeAdapter

Bridge from Presenter to RecyclerView.Adapter. Public to allow use by third party Presenters.

Summary

Nested classes

open

Interface for listening to ViewHolder operations.

open

ViewHolder for the ItemBridgeAdapter.

abstract

Interface for wrapping a view created by a Presenter into another view.

Public constructors

<init>(adapter: ObjectAdapter!, presenterSelector: PresenterSelector!)

<init>(adapter: ObjectAdapter!)

Public methods

open Unit

Clears the adapter.

open FacetProvider!

open Int

open Long
getItemId(position: Int)

open Int
getItemViewType(position: Int)

open ArrayList<Presenter!>!

Returns the presenter mapper array.

open ItemBridgeAdapter.Wrapper!

Returns the Wrapper.

Unit

Unit
onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int, payloads: MutableList<Any?>)

RecyclerView.ViewHolder
onCreateViewHolder(parent: ViewGroup, viewType: Int)

View.OnFocusChangeListener that assigned in Presenter#onCreateViewHolder(ViewGroup) may be chained, user should never change View.OnFocusChangeListener after that.

Boolean

Unit

Unit

Unit

open Unit

Sets the ObjectAdapter.

open Unit

Sets the AdapterListener.

open Unit
setPresenter(presenterSelector: PresenterSelector!)

Changes Presenter that creates and binds the view.

open Unit

Sets the presenter mapper array.

open Unit

Sets the Wrapper.

Protected methods

open Unit
onAddPresenter(presenter: Presenter!, type: Int)

Called when presenter is added to Adapter.

open Unit

Called when ViewHolder has been attached to window.

open Unit

Called when ViewHolder has been bound to data.

open Unit

Called when ViewHolder is created.

open Unit

Called when ViewHolder has been detached from window.

open Unit

Called when ViewHolder has been unbound from data.

Inherited functions

Public constructors

<init>

ItemBridgeAdapter(adapter: ObjectAdapter!, presenterSelector: PresenterSelector!)

<init>

ItemBridgeAdapter(adapter: ObjectAdapter!)

<init>

ItemBridgeAdapter()

Public methods

clear

open fun clear(): Unit

Clears the adapter.

getFacetProvider

open fun getFacetProvider(type: Int): FacetProvider!

getItemCount

open fun getItemCount(): Int

getItemId

open fun getItemId(position: Int): Long

getItemViewType

open fun getItemViewType(position: Int): Int

getPresenterMapper

open fun getPresenterMapper(): ArrayList<Presenter!>!

Returns the presenter mapper array.

getWrapper

open fun getWrapper(): ItemBridgeAdapter.Wrapper!

Returns the Wrapper.

onBindViewHolder

fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int): Unit

onBindViewHolder

fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int, payloads: MutableList<Any?>): Unit

onCreateViewHolder

fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder

View.OnFocusChangeListener that assigned in Presenter#onCreateViewHolder(ViewGroup) may be chained, user should never change View.OnFocusChangeListener after that.

Parameters
parent ViewGroup: The ViewGroup into which the new View will be added after it is bound to an adapter position.
viewType ViewGroup: The view type of the new View.
Return
RecyclerView.ViewHolder: A new ViewHolder that holds a View of the given view type.

onFailedToRecycleView

fun onFailedToRecycleView(holder: RecyclerView.ViewHolder): Boolean

onViewAttachedToWindow

fun onViewAttachedToWindow(holder: RecyclerView.ViewHolder): Unit

onViewDetachedFromWindow

fun onViewDetachedFromWindow(holder: RecyclerView.ViewHolder): Unit

onViewRecycled

fun onViewRecycled(holder: RecyclerView.ViewHolder): Unit

setAdapter

open fun setAdapter(adapter: ObjectAdapter!): Unit

Sets the ObjectAdapter.

setAdapterListener

open fun setAdapterListener(listener: ItemBridgeAdapter.AdapterListener!): Unit

Sets the AdapterListener.

setPresenter

open fun setPresenter(presenterSelector: PresenterSelector!): Unit

Changes Presenter that creates and binds the view.

Parameters
presenterSelector PresenterSelector!: Presenter that creates and binds the view.

setPresenterMapper

open fun setPresenterMapper(presenters: ArrayList<Presenter!>!): Unit

Sets the presenter mapper array.

setWrapper

open fun setWrapper(wrapper: ItemBridgeAdapter.Wrapper!): Unit

Sets the Wrapper.

Protected methods

onAddPresenter

protected open fun onAddPresenter(presenter: Presenter!, type: Int): Unit

Called when presenter is added to Adapter.

onAttachedToWindow

protected open fun onAttachedToWindow(viewHolder: ItemBridgeAdapter.ViewHolder!): Unit

Called when ViewHolder has been attached to window.

onBind

protected open fun onBind(viewHolder: ItemBridgeAdapter.ViewHolder!): Unit

Called when ViewHolder has been bound to data.

onCreate

protected open fun onCreate(viewHolder: ItemBridgeAdapter.ViewHolder!): Unit

Called when ViewHolder is created.

onDetachedFromWindow

protected open fun onDetachedFromWindow(viewHolder: ItemBridgeAdapter.ViewHolder!): Unit

Called when ViewHolder has been detached from window.

onUnbind

protected open fun onUnbind(viewHolder: ItemBridgeAdapter.ViewHolder!): Unit

Called when ViewHolder has been unbound from data.