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:

Methods

getItemCount

public int getItemCount()

Get the number of Networks that are stored in the list

Returns:Number of items in the list

getNetworks

public ArrayList<Network> getNetworks()

Get the list of Networks

Returns:List of Networks being shown in the list

getPostCounts

public HashMap<String, Integer> getPostCounts()

Get the mappings between Network.id (as a String) and the number of org.codethechange.culturemesh.models.Posts in that network.

Returns:Mappings that relate Network ID to the number of org.codethechange.culturemesh.models.Posts in the network

getUserCounts

public HashMap<String, Integer> getUserCounts()

Get the mappings between Network.id (as a String) and the number of org.codethechange.culturemesh.models.Users in that network.

Returns:Mappings that relate Network ID to the number of org.codethechange.culturemesh.models.Users in the network

onBindViewHolder

public void onBindViewHolder(PostViewHolder holder, int position)

Fill the fields of holder with the information stored in the Network at index position in NetworkSummaryAdapter.networks

Parameters:
  • holder – ViewHolder whose fields to fill in
  • position – Index of Network in NetworkSummaryAdapter.networks whose information will be used to fill in the fields of holder

onCreateViewHolder

public PostViewHolder onCreateViewHolder(ViewGroup parent, int viewType)

Create a new NetworkSummaryAdapter.PostViewHolder from the View created by inflating R.layout.network_summary

Parameters:
Returns:

ViewHolder that has been created using an inflated View