public class ListNetworksFragment extends Fragment implements NetworkSummaryAdapter.OnNetworkTapListener
Modifier and Type | Field and Description |
---|---|
(package private) android.widget.TextView |
emptyText
Displays
R.string#no_networks if there are no networks to display |
(package private) RequestQueue |
queue
Queue for asynchronous tasks
|
(package private) android.view.View |
root
Inflated user interface created by
ListNetworksFragment#onCreate(Bundle) |
(package private) RecyclerView |
rv
Scrollable list of networks
|
(package private) static java.lang.String |
SELECTED_USER
Key stored in the fragment's arguments and whose value is the ID of the user whose networks
are to be displayed.
|
Constructor and Description |
---|
ListNetworksFragment() |
Modifier and Type | Method and Description |
---|---|
private void |
checkAndAddNetwork(com.culturemesh.android.models.Network network)
We can only add networks to the NetworkSummaryAdapter when the usercounts and postcounts
values have been fetched.
|
static ListNetworksFragment |
newInstance(long selUser)
Returns a new instance of this fragment for the given section
number.
|
android.view.View |
onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState)
Setup the user interface to display the list of networks and populate that list with the
result of calling
API.Get#userNetworks(RequestQueue, long, Response.Listener) . |
void |
onItemClick(android.view.View v,
com.culturemesh.android.models.Network network)
This is the onClick() passed to NetworkSummaryAdapter.
|
void |
onStop()
This ensures that we are canceling all network requests if the user is leaving this activity.
|
android.view.View root
ListNetworksFragment#onCreate(Bundle)
RecyclerView rv
android.widget.TextView emptyText
R.string#no_networks
if there are no networks to displaystatic final java.lang.String SELECTED_USER
RequestQueue queue
public static ListNetworksFragment newInstance(long selUser)
public android.view.View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
API.Get#userNetworks(RequestQueue, long, Response.Listener)
.inflater
- Inflates the user interface specified in R.layout#rv_container
container
- Parent of the generated hierarchy of user interface elementssavedInstanceState
- Saved state to restoreprivate void checkAndAddNetwork(com.culturemesh.android.models.Network network)
network
- public void onItemClick(android.view.View v, com.culturemesh.android.models.Network network)
onItemClick
in interface NetworkSummaryAdapter.OnNetworkTapListener
v
- the CardView.network
- The Networkpublic void onStop()