Class CommentAdapter

java.lang.Object
androidx.recyclerview.widget.RecyclerView.Adapter<com.example.lottery.adapter.CommentAdapter.CommentViewHolder>
com.example.lottery.adapter.CommentAdapter

public class CommentAdapter extends androidx.recyclerview.widget.RecyclerView.Adapter<com.example.lottery.adapter.CommentAdapter.CommentViewHolder>
RecyclerView adapter for displaying comments on an event, with optional delete support for organizers and admins.
  • Nested Class Summary

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

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

    Constructors
    Constructor
    Description
    CommentAdapter(List<Comment> comments, boolean canDelete, String eventId)
    Creates a new CommentAdapter.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    void
    onBindViewHolder(com.example.lottery.adapter.CommentAdapter.CommentViewHolder holder, int position)
     
    com.example.lottery.adapter.CommentAdapter.CommentViewHolder
    onCreateViewHolder(android.view.ViewGroup parent, int viewType)
     

    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

    • CommentAdapter

      public CommentAdapter(List<Comment> comments, boolean canDelete, String eventId)
      Creates a new CommentAdapter.
      Parameters:
      comments - list of comments to display
      canDelete - whether the current user can delete comments
      eventId - the event whose comments are shown
  • Method Details

    • onCreateViewHolder

      @NonNull public com.example.lottery.adapter.CommentAdapter.CommentViewHolder onCreateViewHolder(@NonNull android.view.ViewGroup parent, int viewType)
      Specified by:
      onCreateViewHolder in class androidx.recyclerview.widget.RecyclerView.Adapter<com.example.lottery.adapter.CommentAdapter.CommentViewHolder>
    • onBindViewHolder

      public void onBindViewHolder(@NonNull com.example.lottery.adapter.CommentAdapter.CommentViewHolder holder, int position)
      Specified by:
      onBindViewHolder in class androidx.recyclerview.widget.RecyclerView.Adapter<com.example.lottery.adapter.CommentAdapter.CommentViewHolder>
    • getItemCount

      public int getItemCount()
      Specified by:
      getItemCount in class androidx.recyclerview.widget.RecyclerView.Adapter<com.example.lottery.adapter.CommentAdapter.CommentViewHolder>