Package com.example.lottery.adapter
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
ConstructorsConstructorDescriptionCommentAdapter(List<Comment> comments, boolean canDelete, String eventId) Creates a new CommentAdapter. -
Method Summary
Modifier and TypeMethodDescriptionintvoidonBindViewHolder(com.example.lottery.adapter.CommentAdapter.CommentViewHolder holder, int position) com.example.lottery.adapter.CommentAdapter.CommentViewHolderonCreateViewHolder(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
-
Constructor Details
-
CommentAdapter
Creates a new CommentAdapter.- Parameters:
comments- list of comments to displaycanDelete- whether the current user can delete commentseventId- 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:
onCreateViewHolderin classandroidx.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:
onBindViewHolderin classandroidx.recyclerview.widget.RecyclerView.Adapter<com.example.lottery.adapter.CommentAdapter.CommentViewHolder>
-
getItemCount
public int getItemCount()- Specified by:
getItemCountin classandroidx.recyclerview.widget.RecyclerView.Adapter<com.example.lottery.adapter.CommentAdapter.CommentViewHolder>
-