public class ContentCardAdapter extends <any> implements ItemTouchHelperAdapter
Constructor and Description |
---|
ContentCardAdapter(android.content.Context context,
LinearLayoutManager layoutManager,
java.util.List<Card> cardData,
IContentCardsViewBindingHandler contentCardsViewBindingHandler) |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
getImpressedCardIds() |
int |
getItemCount() |
long |
getItemId(int position) |
int |
getItemViewType(int position) |
boolean |
isControlCardAtPosition(int adapterPosition)
Returns whether the card at the adapter position is a control card.
|
boolean |
isItemDismissable(int position) |
void |
markOnScreenCardsAsRead()
Marks every on-screen card as read.
|
void |
onBindViewHolder(ContentCardViewHolder viewHolder,
int position) |
ContentCardViewHolder |
onCreateViewHolder(android.view.ViewGroup viewGroup,
int viewType) |
void |
onItemDismiss(int position) |
void |
onViewAttachedToWindow(ContentCardViewHolder holder) |
void |
onViewDetachedFromWindow(ContentCardViewHolder holder) |
void |
replaceCards(java.util.List<Card> newCardData) |
void |
setImpressedCardIds(java.util.List<java.lang.String> impressedCardIds)
Provides a list of the impressed card ids.
|
public ContentCardAdapter(android.content.Context context, LinearLayoutManager layoutManager, java.util.List<Card> cardData, IContentCardsViewBindingHandler contentCardsViewBindingHandler)
public ContentCardViewHolder onCreateViewHolder(android.view.ViewGroup viewGroup, int viewType)
public void onBindViewHolder(ContentCardViewHolder viewHolder, int position)
public int getItemViewType(int position)
public int getItemCount()
public void onItemDismiss(int position)
onItemDismiss
in interface ItemTouchHelperAdapter
public boolean isItemDismissable(int position)
isItemDismissable
in interface ItemTouchHelperAdapter
position
- The adapter position of the item.public void onViewAttachedToWindow(ContentCardViewHolder holder)
public void onViewDetachedFromWindow(ContentCardViewHolder holder)
public long getItemId(int position)
public void replaceCards(java.util.List<Card> newCardData)
public void markOnScreenCardsAsRead()
public java.util.List<java.lang.String> getImpressedCardIds()
List
snapshot of the impressed card ids.public void setImpressedCardIds(java.util.List<java.lang.String> impressedCardIds)
impressedCardIds
- a list of the card ids with impressions.public boolean isControlCardAtPosition(int adapterPosition)
adapterPosition
- A valid adapter position for the card data. Invalid positions will return false.Card.isControl()