Class AdminQRDataAdapter

java.lang.Object
androidx.recyclerview.widget.RecyclerView.Adapter<AdminQRDataAdapter.ViewHolder>
com.example.rocket_launch.admin.AdminQRDataAdapter

public class AdminQRDataAdapter extends androidx.recyclerview.widget.RecyclerView.Adapter<AdminQRDataAdapter.ViewHolder>
Adapter for displaying QR code data in the admin panel. Handles binding data and deletion functionality. Author: Pouyan
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Interface for handling QR code deletion events.
    static class 
    ViewHolder class to hold views for each QR code item.

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

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

    Constructors
    Constructor
    Description
    Constructor for the adapter.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the total number of items in the adapter.
    void
    Binds data to the ViewHolder at the specified position.
    onCreateViewHolder(android.view.ViewGroup parent, int viewType)
    Inflates the item layout for each QR code and creates a ViewHolder.
    void
    Sets the listener for handling QR code deletion events.

    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

    • AdminQRDataAdapter

      public AdminQRDataAdapter(List<AdminQRDataFragment.QRCodeItem> qrCodeItems)
      Constructor for the adapter.
      Parameters:
      qrCodeItems - List of QRCodeItem objects to be displayed. Author: Pouyan
  • Method Details

    • onCreateViewHolder

      @NonNull public AdminQRDataAdapter.ViewHolder onCreateViewHolder(@NonNull android.view.ViewGroup parent, int viewType)
      Inflates the item layout for each QR code and creates a ViewHolder.
      Specified by:
      onCreateViewHolder in class androidx.recyclerview.widget.RecyclerView.Adapter<AdminQRDataAdapter.ViewHolder>
      Parameters:
      parent - The parent ViewGroup.
      viewType - The view type (not used here).
      Returns:
      A ViewHolder containing the inflated view. Author: Pouyan
    • onBindViewHolder

      public void onBindViewHolder(@NonNull AdminQRDataAdapter.ViewHolder holder, int position)
      Binds data to the ViewHolder at the specified position.
      Specified by:
      onBindViewHolder in class androidx.recyclerview.widget.RecyclerView.Adapter<AdminQRDataAdapter.ViewHolder>
      Parameters:
      holder - The ViewHolder to update.
      position - The position of the item in the list. Author: Pouyan
    • getItemCount

      public int getItemCount()
      Returns the total number of items in the adapter.
      Specified by:
      getItemCount in class androidx.recyclerview.widget.RecyclerView.Adapter<AdminQRDataAdapter.ViewHolder>
      Returns:
      The size of the QR code list. Author: Pouyan
    • setOnQRCodeDeleteListener

      public void setOnQRCodeDeleteListener(AdminQRDataAdapter.OnQRCodeDeleteListener listener)
      Sets the listener for handling QR code deletion events.
      Parameters:
      listener - The listener to be notified on deletion. Author: Pouyan