ListUserEventsFragment

public class ListUserEventsFragment extends Fragment implements RVAdapter.OnItemClickListener

This fragment lists the the events a user is subscribed to. It is used in ViewProfileActivity.

Fields

emptyText

TextView emptyText

Text field that displays R.string.no_events if there are no events to display

queue

RequestQueue queue

Queue for asynchronous tasks

rv

RecyclerView rv

Scrollable list of events.

Methods

newInstance

public static ListUserEventsFragment newInstance(long selUser)

Returns a new instance of this fragment for the given section number.

onCreateView

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)

Setup the user interface to display the list of events and populate that list with the result of calling API.Get.userEvents(RequestQueue,long,String,Response.Listener).

Parameters:
  • inflater – Inflates the user interface specified in R.layout.rv_container
  • container – Parent of the generated hierarchy of user interface elements
  • savedInstanceState – Saved state to restore
Returns:

Inflated user interface

onItemClick

public void onItemClick(FeedItem item)

When an item is clicked, if it is a Post, the user is sent to a screen to view the post in more detail, including comments. If the item is an Event, no action is taken.

Parameters:
  • item – The item that was clicked

onStop

public void onStop()

This ensures that we are canceling all network requests if the user is leaving this activity. We use a RequestFilter that accepts all requests (meaning it cancels all requests)