Intro to Android Development
  • Welcome
  • Syllabus
  • Hack Challenge
  • Resources
    • Lecture Videos
    • Ed Discussion
    • Git & GitHub Help/How-To
    • Setting up Android Studio
    • Starting an Android Studio Project & Making an Emulator
    • Importing, Exporting, & Submitting Your Projects to CMS
  • SP25 Course Material
    • Week 1 | Course Logistics, Kotlin, & Basic UI
      • Relevant Links
      • Demo/Lecture: Eatery Card
      • A0: Eatery Card (Follow-Along)
    • Week 2 | States, Components, LazyColumn
      • Relevant Links
      • Demo: Todo List
      • A2: Shopping List
    • Week 3 | Navigation & Animations
      • Relevant Links
      • Demo: Onboarding
      • A3: Stock Trading (RobbingGood)
    • Week 4 | MVVM and Flows
      • Relevant Links
      • Demo: Eatery Card 2
      • A4: Chat of a Lifetime
    • Week 5 | Dumb Components & UIEvents
      • Relevant Links
      • Demo: Music Player
      • A5: Rate My Vibe
    • Week 6 | Coroutines, Networking, JSON
      • Relevant Links
      • Demo: Retrofit
      • A6: You Should Even Lift, Bro.
  • Bonus Week | Android Job Search
    • Relevant Links
    • Android Technical Interview Question!
  • Textbook
    • 1. Introduction to the Editor and Views
      • 1.1 Introduction to the Editor
      • 1.2 SDK Management
      • 1.3 Kotlin Overview
      • 1.4 Views
      • 1.5 Android Studio Project Demo + Understanding The Editor
    • 2. Jetpack Compose
      • 2.1 Introduction
      • 2.2 Layouts
      • 2.3 Modifiers
      • 2.4 Animations
      • 2.5 Lazy Lists
      • 2.6 Reactive UI
    • 3. Intents and Manifest
      • 3.1 Activities
      • 3.2 Implicit Intents
      • 3.3 Explicit Intents
      • 3.4 Manifest
      • 3.5 Permissions
      • 3.6 Summary
    • 4. Navigation
      • 4.1 Types of Navigation
      • 4.2 Implementation of the Bottom Navigation Bar
    • 5. Data and Persistent Storage
      • 5.1 Singleton Classes
      • 5.2 Shared Preferences
      • 5.3 Rooms
      • 5.4 Entities
      • 5.5 Data Access Objects
      • 5.6 Databases
    • 5.5 Concurrency
      • 5.5.1 Coroutines
      • 5.5.2 Implementation of Coroutines
      • 5.5.3 Coroutines with Networking Calls
    • 6. Networking and 3rd Party libraries
      • 6.1 HTTP Overview
      • 6.2 3rd Party Libraries
      • 6.3 JSON and Moshi
      • 6.4 Retrofit
      • 6.5 Summary
    • 7. MVVM Design Pattern
      • 7.1 Key Idea
      • 7.2 Implementation Ideas
    • 8. Flows
    • 9. The Art and Ontology of Software
    • 10. 🔥 Firebase
      • 10.1 Setting up Firebase
      • 10.2 Authentication
      • 10.3 Analytics
      • 10.4 Messaging
      • 10.5 Firestore
  • Additional Topics
    • Git and GitHub
    • Exporting to APK
  • Archive
    • Archived Native Android Textbook Pages
      • 1. Layouts and More Views
        • 1.1 File Structure and File Types
        • 1.2 Resource Files
        • 1.3 Button and Input Control
        • 1.4 ViewGroups
        • 1.5 Summary + A Note On Chapter 2 Topics
      • 2. RecyclerViews
        • 2.1 RecyclerViews
        • 2.2 RecyclerView Performance
        • 2.3 Implementation of a Recycler View
        • 2.4 Implementation with Input Controls
        • 2.5 Filtering RecyclerViews
        • 2.6 Recyclerview Demo
      • 3. ListViews and Searching
        • 3.1 ListView vs. RecyclerView
        • 3.2 ListView Performance
        • 3.3 Implementation of a ListView
        • 3.4 Searching in a List View
      • 4. Fragments
        • 4.1 What are Fragments?
        • 4.2 Lifecycle of a Fragment
        • 4.3 Integrating a Fragment into an Activity
        • 4.4 Sharing Data Between Fragments
        • 4.5 Fragment Slide Shows
      • 5. OkHttp
      • 6. Activity Lifecycle
      • 7. Implementation of Tab Layout
    • Fall 2024 Course Material
      • Lecture 1 & Exercise 1: Introduction to Android
      • Lecture 1.5: Beauty of Kotlin
      • Lecture 2 & HW 2: Modifiers, Lazylists and Reactive UI
      • Lecture 3 & HW 3: Animations, Intents and Manifest
      • Lecture 4 & HW 4: Coroutines & Navigation
      • Lecture 5 & HW 5: Persistent Storage, Networking, and JSON Parsing
      • Lecture 6 & HW 6: MVVM, Flows
      • Bonus Lectures & Bonus HW
      • Bonus Lecture: Industry Practice
    • Spring 2024 Course Material
      • Lecture 1 & Exercise 1: Introduction to Android
      • Lecture 4 & HW 4: LazyLists
      • Lecture 6 & HW 6: Networking, Data, and Persistent Storage
    • Spring 2020 Course Material
      • Week 1: Intro to the Editor
      • Week 2: Views and Layouts
      • Week 3: Intent and Manifest
      • Week 4: ListView and RecyclerView
      • Week 5: Fragments
      • Week 6: Networking
    • Spring 2021 Lecture & HW 8: Networking & 3rd Party APIs
    • HackOurCampus Workshop
Powered by GitBook
On this page
  • Textbook: LazyLists, 5. List Views and Searching
  • Lecture: Google Slides, YouTube
  • Discussion: Google Slides, YouTube
  • Homework: Spotify Playlist
  • Starter Code:
  • Objectives
  • Requirements:
  • Challenge Problems
  • Share Songs (1 pt)
  • Search For Songs (2 pts)
  • Preferential Treatment (2 pts)
  • Dynamic Playlist (2 pts)
  • Image Change (1 pt)
  • References

Was this helpful?

  1. Archive
  2. Spring 2024 Course Material

Lecture 4 & HW 4: LazyLists

PreviousLecture 1 & Exercise 1: Introduction to AndroidNextLecture 6 & HW 6: Networking, Data, and Persistent Storage

Last updated 1 year ago

Was this helpful?

Textbook: ,

Lecture: ,

Discussion: ,

Homework: Spotify Playlist

Starter Code:

Objectives

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!

Requirements:

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.

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!

Share Songs (1 pt)

  • Create an Implicit Intent to share songs and the details of the song to other apps.

Search For Songs (2 pts)

  • Add a search bar at the top of the MainActivity in order to search for specific songs in the dataset.

Preferential Treatment (2 pts)

  • 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.

Dynamic Playlist (2 pts)

  • 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.

Image Change (1 pt)

  • 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.

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:

  • LazyList

  • Intent

  • Bundle

For challenge problems:

  • PackageManager

  • ContextCompat

  • Manifest

LazyLists
5. List Views and Searching
Google Slides
YouTube
Google Slides
YouTube
238KB
HW4StarterCode.zip
archive