java.lang.Object | ||
↳ | android.support.v7.widget.RecyclerView.Adapter | |
↳ | android.support.v17.leanback.widget.ItemBridgeAdapter |
Bridge from Presenter to RecyclerView.Adapter. Public to allow use by third party presenters.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ItemBridgeAdapter.AdapterListener | Interface for listening to view holder operations. | ||||||||||
ItemBridgeAdapter.ViewHolder | |||||||||||
ItemBridgeAdapter.Wrapper | Interface for wrapping a view created by presenter into another view. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the total number of items in the data set hold by the adapter.
| |||||||||||
Return the stable ID for the item at
position .
| |||||||||||
Return the view type of the item at
position for the purposes
of view recycling.
| |||||||||||
Called by RecyclerView to display the data at the specified position.
| |||||||||||
View.OnFocusChangeListener that assigned in
onCreateViewHolder(ViewGroup) may be chained, user should never change
View.OnFocusChangeListener after that.
| |||||||||||
Called when a view created by this adapter has been attached to a window.
| |||||||||||
Called when a view created by this adapter has been detached from its window.
| |||||||||||
Called when a view created by this adapter has been recycled.
| |||||||||||
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called when presenter is added to Adapter.
| |||||||||||
Called when ViewHolder has been attached to window.
| |||||||||||
Called when ViewHolder has been bound to data.
| |||||||||||
Called when ViewHolder is created.
| |||||||||||
Called when ViewHolder has been detached from window.
| |||||||||||
Called when ViewHolder has been unbound from data.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.support.v7.widget.RecyclerView.Adapter
| |||||||||||
From class
java.lang.Object
|
Returns the total number of items in the data set hold by the adapter.
Return the stable ID for the item at position
. If hasStableIds()
would return false this method should return NO_ID
. The default implementation
of this method returns NO_ID
.
position | Adapter position to query |
---|
Return the view type of the item at position
for the purposes
of view recycling.
The default implementation of this method returns 0, making the assumption of a single view type for the adapter. Unlike ListView adapters, types need not be contiguous. Consider using id resources to uniquely identify item view types.
position | position to query |
---|
position
. Type codes need not be contiguous.
Called by RecyclerView to display the data at the specified position. This method
should update the contents of the itemView
to reflect the item at
the given position.
Note that unlike ListView
, RecyclerView will not call this
method again if the position of the item changes in the data set unless the item itself
is invalidated or the new position cannot be determined. For this reason, you should only
use the position
parameter while acquiring the related data item inside this
method and should not keep a copy of it. If you need the position of an item later on
(e.g. in a click listener), use getAdapterPosition()
which will have
the updated adapter position.
holder | The ViewHolder which should be updated to represent the contents of the item at the given position in the data set. |
---|---|
position | The position of the item within the adapter's data set. |
View.OnFocusChangeListener
that assigned in
onCreateViewHolder(ViewGroup)
may be chained, user should never change
View.OnFocusChangeListener
after that.
parent | The ViewGroup into which the new View will be added after it is bound to an adapter position. |
---|---|
viewType | The view type of the new View. |
Called when a view created by this adapter has been attached to a window.
This can be used as a reasonable signal that the view is about to be seen
by the user. If the adapter previously freed any resources in
onViewDetachedFromWindow
those resources should be restored here.
holder | Holder of the view being attached |
---|
Called when a view created by this adapter has been detached from its window.
Becoming detached from the window is not necessarily a permanent condition; the consumer of an Adapter's views may choose to cache views offscreen while they are not visible, attaching an detaching them as appropriate.
holder | Holder of the view being detached |
---|
Called when a view created by this adapter has been recycled.
A view is recycled when a RecyclerView.LayoutManager
decides that it no longer
needs to be attached to its parent RecyclerView
. This can be because it has
fallen out of visibility or a set of cached views represented by views still
attached to the parent RecyclerView. If an item view has large or expensive data
bound to it such as large bitmaps, this may be a good place to release those
resources.
RecyclerView calls this method right before clearing ViewHolder's internal data and
sending it to RecycledViewPool. This way, if ViewHolder was holding valid information
before being recycled, you can call getAdapterPosition()
to get
its adapter position.
holder | The ViewHolder for the view being recycled |
---|
Called when presenter is added to Adapter.
Called when ViewHolder has been attached to window.
Called when ViewHolder has been bound to data.
Called when ViewHolder is created.
Called when ViewHolder has been detached from window.
Called when ViewHolder has been unbound from data.