PostsFrag

public class PostsFrag extends Fragment

Created by Dylan Grosz (dgrosz@stanford.edu) on 11/10/17.

Fields

maxEventId

String maxEventId

maxPostId

String maxPostId

noPosts

TextView noPosts

The textview that is shown if no feed items have been created for this network.

queue

RequestQueue queue

selectedNetwork

long selectedNetwork

settings

SharedPreferences settings

Methods

fetchNewPage

public void fetchNewPage(Response.Listener<Void> listener)

If the user has exhausted the list of fetched posts/events, this will fetch another batch of posts.

Parameters:
  • listener – the listener that will be called when we finish fetching the stuffs.

onAttach

public void onAttach(Context context)

{@inheritDoc}

Parameters:

onCreate

public void onCreate(Bundle savedInstanceState)

{@inheritDoc} Also initialize PostsFrag.settings and PostsFrag.queue

Parameters:

onCreateView

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

Create user interface and handle clicks on posts by launching SpecificPostActivity, which displays more detailed information.

Parameters:
  • inflater – Inflates R.layout.fragment_posts into a full user interface that is a child of container
  • container – Parent of created user interface
  • savedInstanceState – Not used
Returns:

Inflated user interface

onDetach

public void onDetach()

{@inheritDoc}

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)