Class EventCommentsAdapter

java.lang.Object
androidx.recyclerview.widget.RecyclerView.Adapter<com.example.breeze_seas.EventCommentsAdapter.CommentViewHolder>
com.example.breeze_seas.EventCommentsAdapter

public class EventCommentsAdapter extends androidx.recyclerview.widget.RecyclerView.Adapter<com.example.breeze_seas.EventCommentsAdapter.CommentViewHolder>
EventCommentsAdapter renders one event-level comments list for both entrant and organizer flows.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Listener notified when the organizer taps the delete affordance for a comment.

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

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

    Constructors
    Constructor
    Description
    EventCommentsAdapter(boolean canModerateEntrantComments, EventCommentsAdapter.OnDeleteCommentClickListener deleteCommentClickListener)
    Creates the shared comments adapter.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the number of visible comments.
    void
    onBindViewHolder(com.example.breeze_seas.EventCommentsAdapter.CommentViewHolder holder, int position)
    Binds one comment row into the visible list.
    com.example.breeze_seas.EventCommentsAdapter.CommentViewHolder
    onCreateViewHolder(android.view.ViewGroup parent, int viewType)
    Inflates one comment row.
    void
    setCanAdminComments(boolean canAdminComments)
    Updates whether admin delete controls should be shown on all comments.
    void
    setCanModerateEntrantComments(boolean canModerateEntrantComments)
    Updates whether organizer-only delete controls should be shown for entrant comments.
    void
    Replaces the adapter contents with a new comment snapshot.

    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

    • EventCommentsAdapter

      public EventCommentsAdapter(boolean canModerateEntrantComments, @NonNull EventCommentsAdapter.OnDeleteCommentClickListener deleteCommentClickListener)
      Creates the shared comments adapter.
      Parameters:
      canModerateEntrantComments - Whether delete controls should be shown for entrant comments.
      deleteCommentClickListener - Listener for organizer delete actions.
  • Method Details

    • setCanModerateEntrantComments

      public void setCanModerateEntrantComments(boolean canModerateEntrantComments)
      Updates whether organizer-only delete controls should be shown for entrant comments.
      Parameters:
      canModerateEntrantComments - true when the current viewer can moderate comments.
    • setCanAdminComments

      public void setCanAdminComments(boolean canAdminComments)
      Updates whether admin delete controls should be shown on all comments. When true, delete is visible on both entrant and organizer comments. Intended for admins who can remove any comment regardless of author role.
      Parameters:
      canAdminComments - true when the current viewer can delete any comment.
    • submitList

      public void submitList(@NonNull List<EventCommentUIModel> newComments)
      Replaces the adapter contents with a new comment snapshot.
      Parameters:
      newComments - Latest comment rows to display.
    • onCreateViewHolder

      @NonNull public com.example.breeze_seas.EventCommentsAdapter.CommentViewHolder onCreateViewHolder(@NonNull android.view.ViewGroup parent, int viewType)
      Inflates one comment row.
      Specified by:
      onCreateViewHolder in class androidx.recyclerview.widget.RecyclerView.Adapter<com.example.breeze_seas.EventCommentsAdapter.CommentViewHolder>
      Parameters:
      parent - RecyclerView that will host the new row.
      viewType - Adapter view type for the requested row.
      Returns:
      ViewHolder bound to the inflated comment item.
    • onBindViewHolder

      public void onBindViewHolder(@NonNull com.example.breeze_seas.EventCommentsAdapter.CommentViewHolder holder, int position)
      Binds one comment row into the visible list.
      Specified by:
      onBindViewHolder in class androidx.recyclerview.widget.RecyclerView.Adapter<com.example.breeze_seas.EventCommentsAdapter.CommentViewHolder>
      Parameters:
      holder - ViewHolder receiving the comment data.
      position - Adapter position being bound.
    • getItemCount

      public int getItemCount()
      Returns the number of visible comments.
      Specified by:
      getItemCount in class androidx.recyclerview.widget.RecyclerView.Adapter<com.example.breeze_seas.EventCommentsAdapter.CommentViewHolder>
      Returns:
      Comment row count.