Lecture 5 & HW 5: Compose, Navigation, and Networking

Lecture Demo:

Discussion: YouTube

Discussion Demo:

Homework Instructions:

Objectives

Your goal this week is to create a simple social media app with basic navigation. This will include a home page containing posts, a page for each post when clicked that shows the post and replies to the post, and a profile page, where the user can have their information. (Posts, Replies, and Information may be hardcoded)

For this assignment, do not use Intents. Use Jetpack Composes navigation library instead, which can pass arguments between screens.

Requirements:

  1. Create a Composable that will represent your main screen (i.e. MainScreen). Your MainScreen should have a LazyList that contains at least 10 different posts. Each cell in the LazyList must include an image, post title, author, and content, and the cell must be built from a custom layout. You also must use a model to represent the information in each cell. Be clever with your models, especially with your image, to make it easier for your LazyList to use.

  2. Clicking on a cell should open a new activity (ie. PostDetailScreen) that displays a Composable with the post’s image, title, author, and content (i.e. PostDetailScreen).

  3. In PostDetailScreen, there should be a reply button and a way for the user to add a reply to the post. When the user clicks the reply button, the reply should be added to the post, and the user should be redirected back to MainScreen. The list in MainScreen should also reflect this change.

  4. Create a Composable that will represent the profile screen (i.e. ProfileScreen). This will allow you to view any replies to posts and also store information for when you maKe a post.

Challenge Problems

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.txt that states which problem(s) you've attempted!

Searching for Posts (1 pt)

  • Allow the user to search through posts on the home screen, filtering out those that do not belong.

Create new Posts (2 pts)

  • Allow users to create new posts, this may require the addition of a new screen composable.

Profile Editing (3 pts)

  • Design and implement a profile page where details of profile are used when creating new posts.

References

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:

Last updated