NetworkSummaryAdapter¶
-
public class
NetworkSummaryAdapter
extends RecyclerView.Adapter<NetworkSummaryAdapter.PostViewHolder>¶ This functions as the recyclerview adapter for the listview in ViewProfileActivity, where the user can view other users’ subscribed networks.
Constructors¶
NetworkSummaryAdapter¶
-
NetworkSummaryAdapter
(ArrayList<Network> networks, HashMap<String, Integer> postCounts, HashMap<String, Integer> userCounts, OnNetworkTapListener listener)¶ Initialize instance fields with parameters
Parameters: - networks – List of
Network
s to display - postCounts – Mapping from the ID of each
Network
to the number oforg.codethechange.culturemesh.models.Post
s it contains - userCounts – Mapping from the ID of each
Network
to the number oforg.codethechange.culturemesh.models.User
s it contains - listener – Listener to handle clicks on list items
- networks – List of
Methods¶
getItemCount¶
getNetworks¶
getPostCounts¶
-
public HashMap<String, Integer>
getPostCounts
()¶ Get the mappings between
Network.id
(as aString
) and the number oforg.codethechange.culturemesh.models.Post
s in that network.Returns: Mappings that relate Network
ID to the number oforg.codethechange.culturemesh.models.Post
s in the network
getUserCounts¶
-
public HashMap<String, Integer>
getUserCounts
()¶ Get the mappings between
Network.id
(as aString
) and the number oforg.codethechange.culturemesh.models.User
s in that network.Returns: Mappings that relate Network
ID to the number oforg.codethechange.culturemesh.models.User
s in the network
onBindViewHolder¶
-
public void
onBindViewHolder
(PostViewHolder holder, int position)¶ Fill the fields of
holder
with the information stored in theNetwork
at indexposition
inNetworkSummaryAdapter.networks
Parameters: - holder – ViewHolder whose fields to fill in
- position – Index of
Network
inNetworkSummaryAdapter.networks
whose information will be used to fill in the fields ofholder
onCreateViewHolder¶
-
public PostViewHolder
onCreateViewHolder
(ViewGroup parent, int viewType)¶ Create a new
NetworkSummaryAdapter.PostViewHolder
from theView
created by inflatingR.layout.network_summary
Parameters: - parent – Parent for created
View
used to create the newNetworkSummaryAdapter.PostViewHolder
- viewType – Not used
Returns: ViewHolder that has been created using an inflated
View
- parent – Parent for created