Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 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.

abstract

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

open

ViewHolder for the ItemBridgeAdapter.

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

<init>(adapter: ObjectAdapter!)

Public methods
open Long
getItemId(position: Int)

open Unit

Sets the ObjectAdapter.

Unit

open FacetProvider!

open ItemBridgeAdapter.Wrapper!

Returns the Wrapper.

open Unit
setPresenter(presenterSelector: PresenterSelector!)

Changes Presenter that creates and binds the view.

open Unit

Clears the adapter.

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.

open ArrayList<Presenter!>!

Returns the presenter mapper array.

Unit

open Int

open Unit

Sets the AdapterListener.

open Unit

Sets the presenter mapper array.

Boolean

open Unit

Sets the Wrapper.

Unit

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

open Int
getItemViewType(position: Int)

Unit

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 has been unbound from data.

open Unit

Called when ViewHolder has been detached from window.

open Unit

Called when ViewHolder is created.

Inherited functions

Public constructors

<init>

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

<init>

ItemBridgeAdapter(adapter: ObjectAdapter!)

<init>

ItemBridgeAdapter()

Public methods

getItemId

open fun getItemId(position: Int): Long

setAdapter

open fun setAdapter(adapter: ObjectAdapter!): Unit

Sets the ObjectAdapter.

onViewRecycled

fun onViewRecycled(holder: RecyclerView.ViewHolder): Unit

getFacetProvider

open fun getFacetProvider(type: Int): FacetProvider!

getWrapper

open fun getWrapper(): ItemBridgeAdapter.Wrapper!

Returns the Wrapper.

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.

clear

open fun clear(): Unit

Clears the adapter.

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.

getPresenterMapper

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

Returns the presenter mapper array.

onViewDetachedFromWindow

fun onViewDetachedFromWindow(holder: RecyclerView.ViewHolder): Unit

getItemCount

open fun getItemCount(): Int

setAdapterListener

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

Sets the AdapterListener.

setPresenterMapper

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

Sets the presenter mapper array.

onFailedToRecycleView

fun onFailedToRecycleView(holder: RecyclerView.ViewHolder): Boolean

setWrapper

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

Sets the Wrapper.

onBindViewHolder

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

onBindViewHolder

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

getItemViewType

open fun getItemViewType(position: Int): Int

onViewAttachedToWindow

fun onViewAttachedToWindow(holder: RecyclerView.ViewHolder): Unit

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.

onUnbind

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

Called when ViewHolder has been unbound from data.

onDetachedFromWindow

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

Called when ViewHolder has been detached from window.

onCreate

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

Called when ViewHolder is created.