RVAdapter¶
-
public class
RVAdapterextends RecyclerView.Adapter<RVAdapter.PostViewHolder>¶ Adapter that provides the
Posts and/orEvents of aorg.codethechange.culturemesh.models.Networkto displayed, scrollable lists
Constructors¶
RVAdapter¶
-
public
RVAdapter(List<FeedItem> netPosts, OnItemClickListener listener, Context context)¶ Initialize instance fields with provided parameters
Parameters: - netPosts – List of objects to represent in the displayed list
- listener – Listener to handle clicks on list tiems
- context –
Contextin which the list will be displayed
Methods¶
getItemCount¶
-
public int
getItemCount()¶ Get the number of items to display
Returns: Number of items in the list of items to display ( RVAdapter.netPosts)
getNetPosts¶
getUserAttendingEvents¶
onBindViewHolder¶
-
public void
onBindViewHolder(PostViewHolder pvh, int i)¶ Link the provided
PostViewHolderto an object in the listRVAdapter.netPosts, which is used to fill the fields in thePostViewHolderParameters: - pvh – Item in the displayed list whose fields to fill with information
- i – Index of object in
RVAdapter.netPoststhat will serve as the source of information to fill into the displayed list item
onCreateViewHolder¶
-
public PostViewHolder
onCreateViewHolder(ViewGroup parent, int viewType)¶ Create a new
PostViewHolderfrom aViewcreated by inflating the layout described byR.layout.post_view.Parameters: - parent – Parent for created
Viewused to createPostViewHolder - viewType – Not used
Returns: A new
PostViewHolderfor inclusion in the displayed list- parent – Parent for created