TimelineActivity¶
-
public class
TimelineActivity
extends DrawerActivity implements DrawerActivity.WaitForSubscribedList¶ Show a feed of
org.codethechange.culturemesh.models.Post
s andorg.codethechange.culturemesh.models.Event
s for the currently selectedNetwork
Fields¶
BUNDLE_NETWORK¶
FILTER_CHOICE_EVENTS¶
FILTER_CHOICE_NATIVE¶
FILTER_LABEL¶
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: - savedInstanceState – {@inheritDoc}
onOptionsItemSelected¶
-
public boolean
onOptionsItemSelected
(MenuItem item)¶ -
Parameters: - item – {@inheritDoc}
Returns: If
item
is selected or if it has the same ID asR.id.action_settings
, returntrue
. Otherwise, return the result ofDrawerActivity.onOptionsItemSelected(MenuItem)
with parameteritem
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.