Spring 2021 Lecture & HW 8: Networking & 3rd Party APIs
Your task this week is to create a simple newsfeed application to display the top stories on the New York Times website. We'll provide some guidelines below, but you will have the freedom to design the UI how you like!
1. Your app should be making networking calls to the NYT times API, specifically their Top Stories API (link). Your networking calls should be wrapped in coroutines, and we highly recommend that you use OkHttp for making HTTP requests and Moshi for JSON parsing. You are welcomed to use other libraries, but we may not be able to help you very much.
2. Your app should display at least one
Activitythat contains a
RecyclerViewand at least 4 filter buttons. The filter buttons should correspond to sections supported by the Top Stories API (there are 26 different ones to choose from!), and the
RecyclerViewshould display at least 20 articles. Clicking on the filter buttons should filter the displayed list accordingly.
The list that your
RecyclerViewconsumes must contain objects from a custom data class, not a built-in class like
3. Each cell in the
RecyclerViewshould, at the very least, display information about the article's title, section, and published date. You are welcome to include more information from the networking call.
4. Finally, clicking on a cell in the
RecyclerViewshould open up the article in an external browser app. You'll need intents for this.
These are optional challenge problems, and completing each successfully will earn you 1 extra point per problem. If you do attempt a challenge problem, make sure to include a
README.txtthat states which problem(s) you've attempted!
- Add a search bar to the app that interfaces with the Article Search API (link). The HTTP response from the networking call should be displayed in some user-friendly way.
WebViewto display the content of the articles inside the app. This may be considerably difficult to implement 👀
For this assignment, you may need to figure out a few things on your own. Some classes that may be helpful for this assignment include:
For basic functionality:
For challenge problems: