What is this project?

This course will replace my old java mvvm introduction: https://codingwithmitch.com/courses/rest-api-mvvm-retrofit2/.

Watch the new course here: https://codingwithmitch.com/courses/jetpack-compose-mvvm-for-beginners/

This is a beginner course.

Main Features

  1. Kotlin
  2. MVVM
  3. Jetpack Compose
  4. MutableState
    • Simpler than LiveData or Flow with respect to composables.
  5. Hilt
  6. Navigation Components
  7. Retrofit2
  8. Single Activity Architecture
  9. App Themes
  10. Custom Fonts
  11. Light and Dark theme
    • Toggle between themes

Compose features

  1. Snackbars
  2. Dialogs
  3. Theming
  4. Fonts
  5. Colors
  6. Animations introduction
    • creating a ‘shimmering’ loading animation
  7. ConstraintLayout
  8. Rows
  9. Columns
  10. Scaffold
  11. AppBar
  12. Circular Progress Indicator

Why not Flow or LiveData?

  1. LiveData
    • LiveData has always been a love/hate thing for me. It’s great for some things but can be very annoying for others. For example you MUST have an observer for livedata to emit anything. Making it pretty useless in a repository or anywhere except viewmodel->view communication.
  2. Flow
    1. Flow is great. I use flows for my use cases when building out clean architecture. You don’t need an “android observer” because flow lives in the coroutine world and there’s even support for operators like RxJava has.
    2. Easily converted from livedata with a single function call.
    3. Tons of other useful properties. Check out the flow docs.
  3. StateFlow
    1. StateFlow is the newest addition to kotlinx.coroutines.flow. Simply put StateFlow is a flow with special properties.
    2. Originally I had planned to use StateFlow in this course but it’s really just totally unnecessary. I don’t want to show you an unrealistic example of how to use something so I’m sticking with the very simple MutableState in viewmodels.

References

  1. https://github.com/android/compose-samples
  2. https://developer.android.com/jetpack/compose
  3. https://developer.android.com/jetpack/compose/state
  4. Color system

GitHub

https://github.com/mitchtabian/MVVMRecipeApp