public class NetworkSummaryAdapter
extends <any>
Modifier and Type | Class and Description |
---|---|
(package private) static interface |
NetworkSummaryAdapter.OnNetworkTapListener
Interface for all listeners for clicks on list items
|
(package private) class |
NetworkSummaryAdapter.PostViewHolder
This ViewHolder is for network_summary, a CardView for networks.
|
Modifier and Type | Field and Description |
---|---|
private NetworkSummaryAdapter.OnNetworkTapListener |
listener
Listener for clicks on items
|
private java.util.ArrayList<com.culturemesh.android.models.Network> |
networks
Network s to show in the list |
private java.util.HashMap<java.lang.String,java.lang.Integer> |
postCounts
Mappings from
Network.id (as a String ) to its counts of
Post s and
User s |
private java.util.HashMap<java.lang.String,java.lang.Integer> |
userCounts
Mappings from
Network.id (as a String ) to its counts of
Post s and
User s |
Constructor and Description |
---|
NetworkSummaryAdapter(java.util.ArrayList<com.culturemesh.android.models.Network> networks,
java.util.HashMap<java.lang.String,java.lang.Integer> postCounts,
java.util.HashMap<java.lang.String,java.lang.Integer> userCounts,
NetworkSummaryAdapter.OnNetworkTapListener listener)
Initialize instance fields with parameters
|
Modifier and Type | Method and Description |
---|---|
int |
getItemCount()
Get the number of
Network s that are stored in the list |
java.util.ArrayList<com.culturemesh.android.models.Network> |
getNetworks()
Get the list of
Network s |
java.util.HashMap<java.lang.String,java.lang.Integer> |
getPostCounts()
Get the mappings between
Network.id (as a String ) and the number of
Post s in that network. |
java.util.HashMap<java.lang.String,java.lang.Integer> |
getUserCounts()
Get the mappings between
Network.id (as a String ) and the number of
User s in that network. |
void |
onBindViewHolder(NetworkSummaryAdapter.PostViewHolder holder,
int position)
|
NetworkSummaryAdapter.PostViewHolder |
onCreateViewHolder(android.view.ViewGroup parent,
int viewType)
Create a new
NetworkSummaryAdapter.PostViewHolder from the View created
by inflating R.layout#network_summary |
private java.util.ArrayList<com.culturemesh.android.models.Network> networks
Network
s to show in the listprivate java.util.HashMap<java.lang.String,java.lang.Integer> postCounts
Network.id
(as a String
) to its counts of
Post
s and
User
sprivate java.util.HashMap<java.lang.String,java.lang.Integer> userCounts
Network.id
(as a String
) to its counts of
Post
s and
User
sprivate NetworkSummaryAdapter.OnNetworkTapListener listener
NetworkSummaryAdapter(java.util.ArrayList<com.culturemesh.android.models.Network> networks, java.util.HashMap<java.lang.String,java.lang.Integer> postCounts, java.util.HashMap<java.lang.String,java.lang.Integer> userCounts, NetworkSummaryAdapter.OnNetworkTapListener listener)
networks
- List of Network
s to displaypostCounts
- Mapping from the ID of each Network
to the number of
Post
s it containsuserCounts
- Mapping from the ID of each Network
to the number of
User
s it containslistener
- Listener to handle clicks on list itemspublic java.util.ArrayList<com.culturemesh.android.models.Network> getNetworks()
Network
sNetwork
s being shown in the listpublic java.util.HashMap<java.lang.String,java.lang.Integer> getPostCounts()
Network.id
(as a String
) and the number of
Post
s in that network.Network
ID to the number of
Post
s in the networkpublic java.util.HashMap<java.lang.String,java.lang.Integer> getUserCounts()
Network.id
(as a String
) and the number of
User
s in that network.Network
ID to the number of
User
s in the networkpublic NetworkSummaryAdapter.PostViewHolder onCreateViewHolder(android.view.ViewGroup parent, int viewType)
NetworkSummaryAdapter.PostViewHolder
from the View
created
by inflating R.layout#network_summary
parent
- Parent for created View
used to create the new
NetworkSummaryAdapter.PostViewHolder
viewType
- Not usedView
public void onBindViewHolder(NetworkSummaryAdapter.PostViewHolder holder, int position)
holder
- ViewHolder whose fields to fill inposition
- Index of Network
in networks
whose
information will be used to fill in the fields of holder
public int getItemCount()
Network
s that are stored in the list