CommentsFrag

public class CommentsFrag extends Fragment

Fragment for displaying comments to posts

Fields

settings

SharedPreferences settings

The app’s shared settings that store user info and preferences

Methods

onAttach

public void onAttach(Context context)

{@inheritDoc}

Parameters:

onCreate

public void onCreate(Bundle savedInstanceState)

Initialize references to CommentsFrag.queue and CommentsFrag.settings.

Parameters:
  • savedInstanceState

onCreateView

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

Populate the activity with UI elements

Parameters:
  • inflater – Inflates the xml R.layout.fragment_comments into the displayed UI
  • container – TODO: What is this?
  • savedInstanceState – Saved state that can be restored. Not used.
Returns:

The inflated view produced by inflater

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)