Package com.example.lottery.adapter
Class InvitedListAdapter
java.lang.Object
androidx.recyclerview.widget.RecyclerView.Adapter<InvitedListAdapter.ViewHolder>
com.example.lottery.adapter.InvitedListAdapter
public class InvitedListAdapter
extends androidx.recyclerview.widget.RecyclerView.Adapter<InvitedListAdapter.ViewHolder>
Adapter for invited entrants RecyclerView to display a list of entrants that have been invited to the specific event
Responsibilities:
- bind data to invited entrants recyclerview
- render each piece of data
- handle user interaction
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassstores and recycles views as they are scrolled off screenNested classes/interfaces inherited from class androidx.recyclerview.widget.RecyclerView.Adapter
androidx.recyclerview.widget.RecyclerView.Adapter.StateRestorationPolicy -
Constructor Summary
ConstructorsConstructorDescriptionInvitedListAdapter(android.content.Context context, List<EntrantEvent> data) data is passed into the constructor -
Method Summary
Modifier and TypeMethodDescriptionintget total number of rowsvoidonBindViewHolder(InvitedListAdapter.ViewHolder holder, int position) binds the data to the TextView in each rowonCreateViewHolder(android.view.ViewGroup parent, int viewType) inflates the row layout from xml when neededMethods inherited from class androidx.recyclerview.widget.RecyclerView.Adapter
bindViewHolder, createViewHolder, findRelativeAdapterPositionIn, getItemId, getItemViewType, getStateRestorationPolicy, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onAttachedToRecyclerView, onBindViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewDetachedFromWindow, onViewRecycled, registerAdapterDataObserver, setHasStableIds, setStateRestorationPolicy, unregisterAdapterDataObserver
-
Constructor Details
-
InvitedListAdapter
data is passed into the constructor- Parameters:
context- context we want to interactdata- data we will manipulate to display
-
-
Method Details
-
onCreateViewHolder
@NonNull public InvitedListAdapter.ViewHolder onCreateViewHolder(android.view.ViewGroup parent, int viewType) inflates the row layout from xml when needed- Specified by:
onCreateViewHolderin classandroidx.recyclerview.widget.RecyclerView.Adapter<InvitedListAdapter.ViewHolder>- Parameters:
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.- Returns:
-
onBindViewHolder
binds the data to the TextView in each row- Specified by:
onBindViewHolderin classandroidx.recyclerview.widget.RecyclerView.Adapter<InvitedListAdapter.ViewHolder>- Parameters:
holder- the view we want to setposition- index to get data from the arraylist
-
getItemCount
public int getItemCount()get total number of rows- Specified by:
getItemCountin classandroidx.recyclerview.widget.RecyclerView.Adapter<InvitedListAdapter.ViewHolder>- Returns:
- size of mData(rows number)
-