TimelineActivity

public class TimelineActivity extends DrawerActivity implements DrawerActivity.WaitForSubscribedList

Show a feed of org.codethechange.culturemesh.models.Posts and org.codethechange.culturemesh.models.Events for the currently selected Network

Fields

BUNDLE_NETWORK

static final String BUNDLE_NETWORK

The tag for showing that we’re passing in the network to a new activity.

FILTER_CHOICE_EVENTS

static final String FILTER_CHOICE_EVENTS

The key in SharedPreferences for determining whether to display events in the feed.

FILTER_CHOICE_NATIVE

static final String FILTER_CHOICE_NATIVE

The key in SharedPreferences for determining whether to display posts in the feed.

FILTER_LABEL

final String FILTER_LABEL

The tag for FragmentManager to know we’re opening the filter dialog.

joinNetwork

Button joinNetwork

settings

static SharedPreferences settings

The app’s preferences

Methods

animateFAB

void animateFAB()

This function controls the animation for the FloatingActionButtons. When the user taps the pencil icon, two other floating action buttons rise into view - create post and create event. The

createDefaultNetwork

protected void createDefaultNetwork()

Use API methods to fetch details of the user’s selected network. Then setup activity to display that network’s feed.

createNoNetwork

protected void createNoNetwork()

If the user has no selected network, direct them to ExploreBubblesOpenGLActivity

onBackPressed

public void onBackPressed()

Handle the back button being pressed. If the drawer is open, close it. If the user has scrolled down the feed, return it to the start. Otherwise, go back to the previous activity.

onCreate

protected void onCreate(Bundle savedInstanceState)

Setup user interface using layout defined in R.layout.activity_timeline and initialize instance fields with that layout’s fields (elements)

Parameters:

onCreateOptionsMenu

public boolean onCreateOptionsMenu(Menu menu)

Inflate menu from R.menu.timeline

Parameters:
  • menuMenu to inflate
Returns:

Always returns true

onOptionsItemSelected

public boolean onOptionsItemSelected(MenuItem item)

{@inheritDoc}

Parameters:
Returns:

If item is selected or if it has the same ID as R.id.action_settings, return true. Otherwise, return the result of DrawerActivity.onOptionsItemSelected(MenuItem) with parameter item

onStart

protected void onStart()

Check if user has selected a network to view, regardless of whether the user is subscribed to any networks yet. Previously, we checked if the user joined a network, and instead navigate the user to ExploreBubbles. This is not ideal because if a user wants to check out a network before joining one, then they will be unable to view the network. Also calls DrawerActivity.onStart()

onSubscribeListFinish

public void onSubscribeListFinish()

If the user is subscribed to the network, they are able to write posts and events. If the user is not subscribed to the network, there should be a pretty button for them that encourages the user to join the network. This control flow relies on checking if the user is subscribed to a network or not, which requires an instantiated subscribedNetworkIds set in DrawerActivity. This set is instantiated off the UI thread, so we need to wait until that thread completes. Thus, this function is called by DrawerActivity after the network thread completes.

onSwipeRefresh

public void onSwipeRefresh()

Restart activity to refresh the feed