Android APIs
public class

ItemBridgeAdapter

extends RecyclerView.Adapter<VH extends RecyclerView.ViewHolder>
java.lang.Object
   ↳ android.support.v7.widget.RecyclerView.Adapter<VH extends android.support.v7.widget.RecyclerView.ViewHolder>
     ↳ android.support.v17.leanback.widget.ItemBridgeAdapter

Class Overview

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

Summary

Nested Classes
class ItemBridgeAdapter.AdapterListener Interface for listening to view holder operations. 
class ItemBridgeAdapter.ViewHolder  
class ItemBridgeAdapter.Wrapper Interface for wrapping a view created by presenter into another view. 
Public Constructors
ItemBridgeAdapter(ObjectAdapter adapter, PresenterSelector presenterSelector)
ItemBridgeAdapter(ObjectAdapter adapter)
ItemBridgeAdapter()
Public Methods
void clear()
int getItemCount()
long getItemId(int position)
Return the stable ID for the item at position.
int getItemViewType(int position)
Return the view type of the item at position for the purposes of view recycling.
ArrayList<Presenter> getPresenterMapper()
ItemBridgeAdapter.Wrapper getWrapper()
void onBindViewHolder(RecyclerView.ViewHolder holder, int position)
RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
View.OnFocusChangeListener that assigned in onCreateViewHolder(ViewGroup) may be chained, user should never change View.OnFocusChangeListener after that.
void onViewAttachedToWindow(RecyclerView.ViewHolder holder)
Called when a view created by this adapter has been attached to a window.
void onViewDetachedFromWindow(RecyclerView.ViewHolder holder)
Called when a view created by this adapter has been detached from its window.
void onViewRecycled(RecyclerView.ViewHolder holder)
Called when a view created by this adapter has been recycled.
void setAdapter(ObjectAdapter adapter)
void setAdapterListener(ItemBridgeAdapter.AdapterListener listener)
void setPresenterMapper(ArrayList<Presenter> presenters)
void setWrapper(ItemBridgeAdapter.Wrapper wrapper)
[Expand]
Inherited Methods
From class android.support.v7.widget.RecyclerView.Adapter
From class java.lang.Object

Public Constructors

public ItemBridgeAdapter (ObjectAdapter adapter, PresenterSelector presenterSelector)

public ItemBridgeAdapter (ObjectAdapter adapter)

public ItemBridgeAdapter ()

Public Methods

public void clear ()

public int getItemCount ()

public long getItemId (int position)

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.

Parameters
position Adapter position to query
Returns
  • the stable ID of the item at position

public int getItemViewType (int position)

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.

Parameters
position position to query
Returns
  • integer value identifying the type of the view needed to represent the item at position. Type codes need not be contiguous.

public ArrayList<Presenter> getPresenterMapper ()

public ItemBridgeAdapter.Wrapper getWrapper ()

public void onBindViewHolder (RecyclerView.ViewHolder holder, int position)

public RecyclerView.ViewHolder onCreateViewHolder (ViewGroup parent, int viewType)

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

public void onViewAttachedToWindow (RecyclerView.ViewHolder holder)

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.

Parameters
holder Holder of the view being attached

public void onViewDetachedFromWindow (RecyclerView.ViewHolder holder)

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.

Parameters
holder Holder of the view being detached

public void onViewRecycled (RecyclerView.ViewHolder holder)

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.

Parameters
holder The ViewHolder for the view being recycled

public void setAdapter (ObjectAdapter adapter)

public void setAdapterListener (ItemBridgeAdapter.AdapterListener listener)

public void setPresenterMapper (ArrayList<Presenter> presenters)

public void setWrapper (ItemBridgeAdapter.Wrapper wrapper)