Class OffersWithResponsesAdapter
- java.lang.Object
-
- androidx.recyclerview.widget.RecyclerView.Adapter<VH>
-
- com.cheetahdigital.uikit.widget.list.ListAdapter<D,VH>
-
- com.cheetahdigital.uikit.widget.list.EndlessListAdapter<BaseData,OffersWithResponsesViewHolder>
-
- com.cheetahdigital.offers.ui.list.offerswithresponses.OffersWithResponsesAdapter
-
public class OffersWithResponsesAdapter extends EndlessListAdapter<BaseData,OffersWithResponsesViewHolder>
TheRecyclerView.Adapter
used inOffersWithResponsesListFragment
CLIPPED
- clipped processing status ofOfferResponse
PENDING
- pending processing status ofOfferResponse
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.cheetahdigital.uikit.widget.list.EndlessListAdapter
EndlessListAdapter.ProgressViewHolder, EndlessListAdapter.ReloadViewHolder
-
Nested classes/interfaces inherited from class com.cheetahdigital.uikit.widget.list.ListAdapter
ListAdapter.EmptyViewHolder
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CLIPPED
static java.lang.String
PENDING
-
Fields inherited from class com.cheetahdigital.uikit.widget.list.EndlessListAdapter
VIEW_TYPE_PROGRESS, VIEW_TYPE_RELOAD
-
Fields inherited from class com.cheetahdigital.uikit.widget.list.ListAdapter
VIEW_TYPE_HEADER, VIEW_TYPE_NORMAL
-
-
Constructor Summary
Constructors Constructor Description OffersWithResponsesAdapter(java.util.List<BaseData> dataList, OfferWithResponseClipListener clipListener, OfferWithResponseClickListener offerWithResponseClickListener)
Constructor for StellarOffersWithResponsesAdapter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAll(java.util.List<BaseData> data)
Appends all of the elements in the specified collection to the end of this list and notifies registered observers that the item list has been changed.protected void
bindNormalViewHolder(OffersWithResponsesViewHolder holder, int position)
Abstract method to bind the normal view holder.protected OffersWithResponsesViewHolder
createNormalViewHolder(android.view.ViewGroup parent, int viewType)
Abstract method to create normal view holder.protected boolean
isOfferClipped(Offer offer)
Checks if an offer is clipped based on isClippedprotected boolean
isOfferResponseClipped(OfferResponse offerResponse)
Checks if an offer response is clipped based on processing statusvoid
refreshItem(int id)
Refreshes the item by removing the loading icon and changing to its previous state.void
updateClipState(int id)
Updates the clip state of an offer or offer response.-
Methods inherited from class com.cheetahdigital.uikit.widget.list.EndlessListAdapter
getItemCount, getItemViewType, getReload, isAppending, onBindViewHolder, onCreateViewHolder, setIsAppending, setReload
-
Methods inherited from class com.cheetahdigital.uikit.widget.list.ListAdapter
addItem, addItem, clear, getDataList, getItemAt, getPlaceHolderResource, insertItems, isListEmpty, removeItem, replaceItemAt, setCustomEmptyMessageResource, setPlaceHolderResource, sort
-
Methods inherited from class androidx.recyclerview.widget.RecyclerView.Adapter
bindViewHolder, createViewHolder, getItemId, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onAttachedToRecyclerView, onBindViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewDetachedFromWindow, onViewRecycled, registerAdapterDataObserver, setHasStableIds, unregisterAdapterDataObserver
-
-
-
-
Field Detail
-
CLIPPED
public static final java.lang.String CLIPPED
- See Also:
- Constant Field Values
-
PENDING
public static final java.lang.String PENDING
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OffersWithResponsesAdapter
public OffersWithResponsesAdapter(@NonNull java.util.List<BaseData> dataList, OfferWithResponseClipListener clipListener, OfferWithResponseClickListener offerWithResponseClickListener)
Constructor for StellarOffersWithResponsesAdapter.- Parameters:
dataList
- list ofBaseData
containingOffer
andOfferResponse
clipListener
-OfferWithResponseClickListener
offerWithResponseClickListener
-OfferWithResponseClickListener
-
-
Method Detail
-
addAll
public void addAll(java.util.List<BaseData> data)
Description copied from class:ListAdapter
Appends all of the elements in the specified collection to the end of this list and notifies registered observers that the item list has been changed.- Overrides:
addAll
in classListAdapter<BaseData,OffersWithResponsesViewHolder>
- Parameters:
data
- list of items to add
-
createNormalViewHolder
protected OffersWithResponsesViewHolder createNormalViewHolder(android.view.ViewGroup parent, int viewType)
Description copied from class:ListAdapter
Abstract method to create normal view holder.- Specified by:
createNormalViewHolder
in classListAdapter<BaseData,OffersWithResponsesViewHolder>
- Parameters:
parent
- used to get resourceviewType
- type of view- Returns:
- view holder for non special items
-
isOfferResponseClipped
protected boolean isOfferResponseClipped(OfferResponse offerResponse)
Checks if an offer response is clipped based on processing status- Parameters:
offerResponse
-OfferResponse
- Returns:
- true if offerResponse is clipped, false if not clipped
-
isOfferClipped
protected boolean isOfferClipped(Offer offer)
Checks if an offer is clipped based on isClipped- Parameters:
offer
-Offer
- Returns:
- true if offer is clipped, false if not clipped
-
bindNormalViewHolder
protected void bindNormalViewHolder(OffersWithResponsesViewHolder holder, int position)
Description copied from class:ListAdapter
Abstract method to bind the normal view holder.- Specified by:
bindNormalViewHolder
in classListAdapter<BaseData,OffersWithResponsesViewHolder>
- Parameters:
holder
- view holder to vindSposition
- index of the item
-
updateClipState
public void updateClipState(int id)
Updates the clip state of an offer or offer response. If the id is an offer,Offer.setClipped(boolean)
is updated. If the id is an offer response,OfferResponse.setProcessingStatus(String)
is set to eitherPENDING
orCLIPPED
.- Parameters:
id
- id of offer or offer response to update
-
refreshItem
public void refreshItem(int id)
Refreshes the item by removing the loading icon and changing to its previous state.- Parameters:
id
- id of item to refresh
-
-