NetworkSummaryAdapter¶
-
public class
NetworkSummaryAdapterextends 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
Networks to display - postCounts – Mapping from the ID of each
Networkto the number oforg.codethechange.culturemesh.models.Posts it contains - userCounts – Mapping from the ID of each
Networkto the number oforg.codethechange.culturemesh.models.Users 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.Posts in that network.Returns: Mappings that relate NetworkID to the number oforg.codethechange.culturemesh.models.Posts in the network
getUserCounts¶
-
public HashMap<String, Integer>
getUserCounts()¶ Get the mappings between
Network.id(as aString) and the number oforg.codethechange.culturemesh.models.Users in that network.Returns: Mappings that relate NetworkID to the number oforg.codethechange.culturemesh.models.Users in the network
onBindViewHolder¶
-
public void
onBindViewHolder(PostViewHolder holder, int position)¶ Fill the fields of
holderwith the information stored in theNetworkat indexpositioninNetworkSummaryAdapter.networksParameters: - holder – ViewHolder whose fields to fill in
- position – Index of
NetworkinNetworkSummaryAdapter.networkswhose information will be used to fill in the fields ofholder
onCreateViewHolder¶
-
public PostViewHolder
onCreateViewHolder(ViewGroup parent, int viewType)¶ Create a new
NetworkSummaryAdapter.PostViewHolderfrom theViewcreated by inflatingR.layout.network_summaryParameters: - parent – Parent for created
Viewused to create the newNetworkSummaryAdapter.PostViewHolder - viewType – Not used
Returns: ViewHolder that has been created using an inflated
View- parent – Parent for created