Package com.example.breeze_seas
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 ClassesModifier and TypeClassDescriptionstatic interfaceListener 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
ConstructorsConstructorDescriptionEventCommentsAdapter(boolean canModerateEntrantComments, EventCommentsAdapter.OnDeleteCommentClickListener deleteCommentClickListener) Creates the shared comments adapter. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of visible comments.voidonBindViewHolder(com.example.breeze_seas.EventCommentsAdapter.CommentViewHolder holder, int position) Binds one comment row into the visible list.com.example.breeze_seas.EventCommentsAdapter.CommentViewHolderonCreateViewHolder(android.view.ViewGroup parent, int viewType) Inflates one comment row.voidsetCanAdminComments(boolean canAdminComments) Updates whether admin delete controls should be shown on all comments.voidsetCanModerateEntrantComments(boolean canModerateEntrantComments) Updates whether organizer-only delete controls should be shown for entrant comments.voidsubmitList(List<EventCommentUIModel> newComments) 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
-
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-truewhen the current viewer can moderate comments.
-
setCanAdminComments
public void setCanAdminComments(boolean canAdminComments) Updates whether admin delete controls should be shown on all comments. Whentrue, delete is visible on both entrant and organizer comments. Intended for admins who can remove any comment regardless of author role.- Parameters:
canAdminComments-truewhen the current viewer can delete any comment.
-
submitList
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:
onCreateViewHolderin classandroidx.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:
onBindViewHolderin classandroidx.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:
getItemCountin classandroidx.recyclerview.widget.RecyclerView.Adapter<com.example.breeze_seas.EventCommentsAdapter.CommentViewHolder>- Returns:
- Comment row count.
-