Lecture 4 & HW 4: LazyLists
Last updated
Last updated
Your goal is to recreate a simple version of Spotify's playlist view using LazyList
and topics learned from previous weeks. We'll provide some guidelines below, but you will have the freedom to design the UI how you'll like!
1. In MainActivity, create a Composable that will represent your main screen (i.e. MainScreen). Your MainScreen should have has a LazyList
that contains at least 10 different songs. Each cell in the LazyList
must include an image, song name, artist, and album, 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. SongDetailActivity.kt) that displays a Composable with the song's image, name, artist, and album (i.e. SongDetailScreen).
3. In SongDetailScreen, there should be a save button and a way for the user to edit the song name, artist, and album. When the user clicks the save button, the song title should change to the new one, and the user should be redirected back to MainActivity. The list in MainActivity should also reflect this change.
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!
Create an Implicit Intent to share songs and the details of the song to other apps.
Add a search bar at the top of the MainActivity in order to search for specific songs in the dataset.
Add an icon (ie. heart) to each cell in MainActivity for liking a song. When the user clicks on this icon, the icon should change color or shape to represented "liked". The user should also be able to undo the like.
Add two filter buttons to the top of MainActivity, one for displaying all songs and one for displaying liked songs. Clicking on the buttons should filter the songs accordingly.
Add the ability for the user to add new songs and delete songs from the playlist. You have the freedom to design the user interactions for this feature -- just make sure to describe how it works in the README.txt
.
In SongDetailActivity, add the ability to change the song image with an image from the user's internal storage. You will need to ask for permission to access the user's storage as well as account for what happens if the user denies permissions.
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:
LazyList
Intent
Bundle
For challenge problems:
PackageManager
ContextCompat
Manifest