public class RVAdapter
extends <any>
Post
s and/or Event
s of a
Network
to displayed, scrollable listsModifier and Type | Class and Description |
---|---|
static interface |
RVAdapter.OnItemClickListener
Interface listeners for clicks on items must implement
|
(package private) static class |
RVAdapter.PostViewHolder
Stores the
View elements of each item in the displayed list. |
Modifier and Type | Field and Description |
---|---|
private android.content.Context |
context
The
Context in which the list is displayed |
private RVAdapter.OnItemClickListener |
listener
The listener that will handle all clicks on items in the list
|
private java.util.List<com.culturemesh.android.models.FeedItem> |
netPosts
All of the items that are represented in the displayed list, including those not currently
visible due to scrolling.
|
private java.util.Set<java.lang.Long> |
userAttendingEvents
This contains the events in this network that the user is attending, which affects
some aspects of the event UI.
|
Constructor and Description |
---|
RVAdapter(java.util.List<com.culturemesh.android.models.FeedItem> netPosts,
RVAdapter.OnItemClickListener listener,
android.content.Context context)
Initialize instance fields with provided parameters
|
Modifier and Type | Method and Description |
---|---|
int |
getItemCount()
Get the number of items to display
|
java.util.List<com.culturemesh.android.models.FeedItem> |
getNetPosts()
Get the items being represented as elements of the displayed list (not just the ones
currently visible).
|
java.util.Set<java.lang.Long> |
getUserAttendingEvents()
Get the events in this network that the user is attending, which affects
some aspects of the event UI.
|
void |
onBindViewHolder(RVAdapter.PostViewHolder pvh,
int i)
Link the provided
RVAdapter.PostViewHolder to an object in the list netPosts ,
which is used to fill the fields in the RVAdapter.PostViewHolder |
RVAdapter.PostViewHolder |
onCreateViewHolder(android.view.ViewGroup parent,
int viewType)
Create a new
RVAdapter.PostViewHolder from a View created by inflating the layout
described by R.layout#post_view . |
private java.util.Set<java.lang.Long> userAttendingEvents
private java.util.List<com.culturemesh.android.models.FeedItem> netPosts
private android.content.Context context
Context
in which the list is displayedprivate final RVAdapter.OnItemClickListener listener
public RVAdapter(java.util.List<com.culturemesh.android.models.FeedItem> netPosts, RVAdapter.OnItemClickListener listener, android.content.Context context)
netPosts
- List of objects to represent in the displayed listlistener
- Listener to handle clicks on list tiemscontext
- Context
in which the list will be displayedpublic java.util.List<com.culturemesh.android.models.FeedItem> getNetPosts()
public java.util.Set<java.lang.Long> getUserAttendingEvents()
public RVAdapter.PostViewHolder onCreateViewHolder(android.view.ViewGroup parent, int viewType)
RVAdapter.PostViewHolder
from a View
created by inflating the layout
described by R.layout#post_view
.parent
- Parent for created View
used to create RVAdapter.PostViewHolder
viewType
- Not usedRVAdapter.PostViewHolder
for inclusion in the displayed listpublic void onBindViewHolder(RVAdapter.PostViewHolder pvh, int i)
RVAdapter.PostViewHolder
to an object in the list netPosts
,
which is used to fill the fields in the RVAdapter.PostViewHolder
pvh
- Item in the displayed list whose fields to fill with informationi
- Index of object in netPosts
that will serve as the source of
information to fill into the displayed list itempublic int getItemCount()
netPosts
)