Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 2.74 KB

Exercise_6_1_New_Datasource.md

File metadata and controls

44 lines (33 loc) · 2.74 KB

Objectives:

  • Learn how to make HTTP request, get response, parse the response and display the data in UI.

Should know what are supported methods for a HTTP request, what is RESTful API, json, xml...

  • Network operation should be run on another thread out of main thread to prevent UI blocking

Use your knowledge about threads and processes to do this.

Requirements:

Please notice how to get more posts by using after parameter.

  • Implements another class called NetworkBasedFeedDataStore to make HTTP request and get reddit posts. (The skeleton code for this class can be found here: NetworkBasedFeedDataStore)
  • There will be a delay while waiting for the request to be made, please use SwipeRefreshLayout to show a loading indicator and provides pull to refresh action.

Pull to refresh is an action when user pulls down on the list, the data will be refreshed with the latest one.

Pull to refresh

  • Loading indicator should be hidden after data has been pulled and displayed on UI.
  • Users always want to read a lot, so developer would provides a way to load more posts for them.
    • When user scrolls to the end of the list, call the API to get more posts.
    • Show a loading indicator similar to the screenshot below while loading and replace it by new data when complete.

Load more indicator

  • If the network call for the first page has failed (by multiple reasons): please show a UI like this:

Empty layout

  • When user pull to refresh, what is currently displayed on the UI will be discarded and user will see the first page of posts again.

References: