public interface IContentCardsViewBindingHandler
extends android.os.Parcelable
ContentCardsFragment
. The methods here
closely mirror those of RecyclerView.Adapter
and are called as part of those methods in
the ContentCardAdapter
.Modifier and Type | Method and Description |
---|---|
int |
getItemViewType(android.content.Context context,
java.util.List<Card> cards,
int adapterPosition)
Returns the view type of the item at the given position for the purposes of view recycling purposes.
|
void |
onBindViewHolder(android.content.Context context,
java.util.List<Card> cards,
ContentCardViewHolder viewHolder,
int adapterPosition)
Called to display the data at the specified adapter position.
|
ContentCardViewHolder |
onCreateViewHolder(android.content.Context context,
java.util.List<Card> cards,
android.view.ViewGroup viewGroup,
int viewType)
Creates an
ContentCardViewHolder of the given type to represent an item in the ContentCards. |
ContentCardViewHolder onCreateViewHolder(android.content.Context context, java.util.List<Card> cards, android.view.ViewGroup viewGroup, int viewType)
ContentCardViewHolder
of the given type to represent an item in the ContentCards. You can create
a new View manually or inflate it from an XML layout file.
The new ContentCardViewHolder
will be used to display adapter items
using onBindViewHolder(Context, List, ContentCardViewHolder, int)
.context
- The application contextcards
- The collection of card items in the adapter. Should not be modified.viewGroup
- 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.ContentCardViewHolder
that holds a View of the given view type.RecyclerView.Adapter#onCreateViewHolder(ViewGroup, int)
void onBindViewHolder(android.content.Context context, java.util.List<Card> cards, ContentCardViewHolder viewHolder, int adapterPosition)
ContentCardViewHolder#itemView
to reflect the item at the given adapter position.context
- The application context.cards
- The collection of card items in the adapter. Should not be modified.viewHolder
- The ContentCardViewHolder
which should be updated to represent the contents
of the item at the given adapter position.adapterPosition
- The position of the item within the adapter's card items.RecyclerView.Adapter#onBindViewHolder(RecyclerView.ViewHolder, int)
int getItemViewType(android.content.Context context, java.util.List<Card> cards, int adapterPosition)
context
- The application context.cards
- The collection of card items in the adapter. Should not be modified.adapterPosition
- The position of the item within the adapter's card items.