Skip to content

Instantly share code, notes, and snippets.

@nesquena
Last active December 25, 2015 05:49
Show Gist options
  • Save nesquena/d88cf3606a308359323f to your computer and use it in GitHub Desktop.
Save nesquena/d88cf3606a308359323f to your computer and use it in GitHub Desktop.
Project 4: Fragment Twitter Client

Project 4: Fragment Twitter Client

This is the feedback guide for Project 4 - Fragment Twitter Client. It covers the key issues that we see most often when engineers submit this homework.

  • Did you properly organize your source into folders? In Android apps, try to start organizing your source code into the correct folders for better maintainability. Check out the organizing your source guide for more details.

  • Did you properly keep your controllers clean? Remember the mantra fat models, skinny controllers. Do not just throw a bunch of code carelessly in the Activity. Think about proper encapsulation and object design and create Models and Service Objects that the controller delegates tasks to. Also, instead of putting a bunch of stuff right in onCreate, extract the different tasks into seperate methods called by the onCreate function.

  • Did you properly setup the Home and Mention tabs? A big part of this assignment is setting up the tabs for the main activity. The video shows one approach for setting the listeners for the tabs, but did you use the FragmentTabListener pattern? If you aren't sure, check out the ActionBar Tabs with Fragments cliffnotes for a better approach to tabs.

  • Did you setup your fragments properly? There should be three fragments HomeTimelineFragment, MentionsTimelineFragment and UserTimelineFragment which all extend from the base TimelineFragment. The base fragment class should have 90% of the code and the specialized fragments should focus on loading the particular data into the ListView by executing a network request. Avoid code duplication between the fragment classes, share the code within base as much as possible.

  • Does endless pagination work for all timelines? Ensure that the endless pagination works for all timelines (home, mentions and user). Verify when new content loads, that the content belongs in the correct timelines.

  • Can I view a user's profile? Verify that when you click on the profile image for a user on a tweet, that a profile activity opens that shows the correct user's information including their user timeline. This ProfileActivity should have a header section with the user's information (number of tweets, followers, etc) and then an embedded user timeline fragment.

  • What happens if I click on a user's profile image while I am on their profile? If I am already on a user's profile and I click their image again, I should not be taken a second instance of their profile. That would cause a recursive situation, we are better off avoiding. There are a few ways to do this including setting an intent flag such as FLAG_ACTIVITY_SINGLE_TOP that doesn't allow the same activity to have multiple instances directly on top of each other in the stack.

  • Does app successfully post a tweet? When I compose a tweet, I should see that tweet in my home timeline (if that tab is selected). One approach for implementing this is you could add a public method to the fragment (i.e refreshTimeline) and then in onActivityResult for the activity after coming back from compose you could check to see the selected tab from the ActionBar (or just the index and only take the action to add tweet if the expected tab is selected.

Bonus

In addition, consider the following bonus (optional) feedback:

  • Did you setup a character counter during compose? Twitter only accepts 140 characters or less. Did you setup a character counter that displays the remaining characters in real-time? Check the event listeners cliffnotes for more details. Also, do you disable posting when the character count is too long?

  • Have you considered polishing the UI of your twitter client? By default, your twitter client probably looks boring and uninteresting. Take a little time to spruce up your UI and add visual polish with this guide and by reviewing the cloning a screen tutorial and Q&A.

  • Did you use ActionBarSherlock for tabs? Regular ActionBar tabs only work in API 11 and above. This means that tabs don't work with Gingerbread. Many popular apps use ActionBarSherlock to support tabs for all versions of Android. Consider setting up the library and using the Sherlock approach for maximum compatibility using the ActionBar Tabs cliffnotes.

  • Do you handle the offline case gracefully and keep around tweets that show up when the app loads? Most real apps don't have blank timelines when they load. Instead, they keep around past tweets from previous loads to display immediately. Then when the new data comes back, the list is reloaded. Did you properly persist tweets to disk and then retrieve them from disk and display them immediately (or at least on network failure?). See Persisting Data and ActiveAndroid Guide for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment