Class CancelledListAdapter

java.lang.Object
androidx.recyclerview.widget.RecyclerView.Adapter<CancelledListAdapter.ViewHolder>
com.example.lottery.adapter.CancelledListAdapter

public class CancelledListAdapter extends androidx.recyclerview.widget.RecyclerView.Adapter<CancelledListAdapter.ViewHolder>
Adapter for cancelled entrants RecyclerView to display a list of entrants that cancelled the specific event

Responsibilities:

  • bind data to cancelled entrants recyclerview
  • render each piece of data
  • handle user interaction
  • implement US 02.06.02 Be able to see a list of all the cancelled entrants

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    stores and recycles views as they are scrolled off screen

    Nested classes/interfaces inherited from class androidx.recyclerview.widget.RecyclerView.Adapter

    androidx.recyclerview.widget.RecyclerView.Adapter.StateRestorationPolicy
  • Constructor Summary

    Constructors
    Constructor
    Description
    CancelledListAdapter(android.content.Context context, List<EntrantEvent> data)
    data is passed into the constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    get total number of rows
    void
    binds the data to the TextView in each row
    onCreateViewHolder(android.view.ViewGroup parent, int viewType)
    inflates the row layout from xml when needed

    Methods 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CancelledListAdapter

      public CancelledListAdapter(android.content.Context context, List<EntrantEvent> data)
      data is passed into the constructor
      Parameters:
      context - context we want to interact
      data - data we will manipulate to display
  • Method Details

    • onCreateViewHolder

      @NonNull public CancelledListAdapter.ViewHolder onCreateViewHolder(android.view.ViewGroup parent, int viewType)
      inflates the row layout from xml when needed
      Specified by:
      onCreateViewHolder in class androidx.recyclerview.widget.RecyclerView.Adapter<CancelledListAdapter.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

      public void onBindViewHolder(CancelledListAdapter.ViewHolder holder, int position)
      binds the data to the TextView in each row
      Specified by:
      onBindViewHolder in class androidx.recyclerview.widget.RecyclerView.Adapter<CancelledListAdapter.ViewHolder>
      Parameters:
      holder - the view we want to set
      position - index to get data from the arraylist
    • getItemCount

      public int getItemCount()
      get total number of rows
      Specified by:
      getItemCount in class androidx.recyclerview.widget.RecyclerView.Adapter<CancelledListAdapter.ViewHolder>
      Returns:
      size of mData(rows number)