Kotlin, MVVM, Navigation Component, Hilt, Jetpack Compose, Retrofit2

Overview

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
Comments
  • Using .orEmpty() for nullable lists

    Using .orEmpty() for nullable lists

    https://github.com/mitchtabian/MVVMRecipeApp/blob/196b126f9f2e7e8540fb0e32444f6d228318e78c/app/src/main/java/com/codingwithmitch/mvvmrecipeapp/network/model/RecipeNetworkMapper.kt#L19

    It'd be nice to replace the ?: ListOf with .orEmpty() as suggested here as well https://twitter.com/kotlin/status/1337306632477356034?s=20.

    It just removes some ambiguity for someone maybe not so familiar with the ?: Kotlin syntax. Totally a preference though, I just thought it'd be nice to let you know this exists.

    opened by StylianosGakis 1
  • Manage token with some classes

    Manage token with some classes

    create AuthorizationInterceptor.kt create TokenManager.kt create providers for the classes in NetworkModule

    send token with AuthorizationInterceptor.kt in header of each request, remove the token from any request in RecipeRepository.kt

    create okHttpClient fun for addInterceptor the AuthorizationInterceptor

    and formatting some classes with(ctrl + alt + l)

    opened by mahdizareeii 0
  • Updated gradle dependencies, with version specific code changes in the Kotlin class

    Updated gradle dependencies, with version specific code changes in the Kotlin class

    The current repository has some compatibility issues with Android Studio Arctic Fox. This issue won't allow the project to build and run. I've updated all dependencies to the latest stable version and made version-specific changes in the Kotlin classes.

    Changes in Gradle:

    • Updated build:gradle 7.0.0-alpha05 -> 7.0.2
    • Updated compose 1.0.0-beta01 -> 1.0.2
    • Updated hilt-android-gradle-plugin 2.28-alpha -> 2.38.1
    • Updated core-ktx 1.3.2 -> 1.6.0
    • Updated appcompat 1.2.0 -> 1.3.1
    • Updated material 1.2.1 -> 1.4.0
    • Updated constraintlayout 2.0.4 -> 2.1.0
    • Updated constraintlayout-compose 1.0.0-alpha03 -> 1.0.0-beta02
    • Updated activity-compose 1.3.0-alpha03 -> 1.3.1
    • Updated navigation-fragment-ktx 2.3.2 -> 2.3.5
    • Updated hilt-android 2.28-alpha -> 2.37
    • Updated hilt-lifecycle-viewmodel 1.0.0-alpha01 -> 1.0.0-alpha03

    Changes in Kotlin Class:

    di

    • AppModile
    • NetworkModule
    • RepositoryModule

    ApplicationComponent is Deprecated in Dagger Version 2.30 and removed in Dagger Version 2.31. Alternatively, SingletonComponent should be used instead of ApplicationComponent

    presentation -> ui -> recipe

    • RecipeViewModel
    • RecipeListViewModel

    In HILT alpha03, @ViewModelInject is deprecated and replaced by @HiltViewModel. We need to add the @HiltViewModel annotation at the class level, and the @Inject annotation at the constructor. Additionally, we don't need the @Assisted annotation anymore.

    opened by prokash-sarkar 0
  • Updated the way we animate heart animation in compose

    Updated the way we animate heart animation in compose

    Solution for those who are facing issues with the older things(or some things that now compose doesn't support). Took me hours to find the perfect one solution, hope you will find it clear and concise. Let me know about some changes, tried to keep it as close as to the final result. Happy Hacktoberfest🤝✨

    opened by Sagar0-0 0
  • Update how we animate in compose

    Update how we animate in compose

    Closes #4 Found that the older way of animating in compose doesn't work anymore, so updated the way how we animate in compose. Basically, using rememberInfiniteTransition(). Reference: Android official docs Happy Hacktoberfest🤝✨

    opened by Sagar0-0 0
Owner
Mitch Tabian
youtube.com/c/codingwithmitch
Mitch Tabian
Navigation-Compose - A sample to showcase Kotlin, MVVM, Hilt, Coroutines, StateFlow, Jetpack compose

Navigation-Compose A sample to showcase Kotlin, MVVM, Hilt, Coroutines, StateFlo

Mohammadali Rezaei 6 Jul 13, 2022
Android App made by Jetpack Compose Components with Kotlin, MVVM Pattern, Multi Module, Navigation, Hilt, Coroutines, Retrofit and cached data by Room

Android App made by Jetpack Compose Components with Kotlin, MVVM Pattern, Multi Module, Navigation, Hilt, Coroutines, Retrofit and cached data by Room

Yogi Dewansyah 13 Aug 31, 2022
Android App made by Jetpack Compose Components with Kotlin, MVVM Pattern, Multi Module, Navigation, Hilt, Coroutines, Retrofit and cached data by Room

Mobile Banking Android App made by Jetpack Compose Components with Kotlin, MVVM Pattern, Multi Module, Navigation, Hilt, Coroutines, Retrofit and cach

Yogi Dewansyah 13 Aug 31, 2022
Compose-navigation - Set of utils to help with integrating Jetpack Compose and Jetpack's Navigation

Jetpack Compose Navigation Set of utils to help with integrating Jetpack Compose

Adam Kobus 5 Apr 5, 2022
🚀 Android project template with Compose, MVVM, Hilt and Navigation

compose-android-template An Android project template with MVVM, Hilt, Navigation and Compose ✍️ Author ?? theapache64 Twitter: @theapache64 Email: the

theapache64 55 Jan 3, 2023
A library that enables Safe Navigation for you Composable destinations when using Jetpack Compose Navigation

A library that enables Safe Navigation for you Composable destinations when using Jetpack Compose Navigation

Roman Levinzon 59 Oct 19, 2022
Android -MVVM-Jetpack Compose-Kotlin Flows-Dagger Hilt-Retrofilt2-Coil

android-mvvm-jetpack-compose-kotlin-flows Android -MVVM-Jetpack Compose-Kotlin Flows-Dagger Hilt-Retrofilt2-Coil A sample project that presents a mode

Emad Seliem 8 Jul 27, 2022
A sample project in Kotlin to demonstrate Jetpack Compose, MVVM, Coroutines, Hilt, Room, Coil, Retrofit, Moshi, Leak Canary and Repository pattern

Jetpack-Compose-Boilerplate This repository contains a sample project in Kotlin to demonstrate Jetpack Compose, MVVM, Coroutines, Hilt, Room, Coil, Re

Areg Petrosyan 14 Dec 12, 2022
Android weather app using Hilt, Coroutines, Retrofit, Jetpack (Compose, Room, ViewModel) based on MVVM architecture

Atmostate A weather app written with Jetpack Compose using OpenWeatherMap Get the APK Features offline caching fetching data for current user location

Ramzan Sheikh 114 Dec 5, 2022
Android Clean Architecture with MVVM using Jetpack component

Android Clean Architecture with MVVM using Jetpack component ?? What is Clean Architecture? Clean architecture is a category of software design patter

Jbsolutions 6 Dec 10, 2022
A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose

Authentication A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose Scree

Felix Kariuki 5 Dec 29, 2022
🗻 Unopinionated, easy-to-use, and customizable Badge component for Jetpack Compose

Cobadge ?? Unopinionated, easy-to-use, and customizable Badge component for Jetpack Compose Getting started In this section I will walk you through th

Michael Grigoryan 5 Jun 28, 2022
ComposeImageBlurhash is a Jetpack Compose component with the necessary implementation to display a blurred image while the real image is loaded from the internet. Use blurhash and coil to ensure good performance.

compose-image-blurhash ComposeImageBlurhash is a Jetpack Compose component with the necessary implementation to display a blurred image while the real

Orlando Novas Rodriguez 24 Nov 18, 2022
Icontent - Jetpack Compose component to show all random content sended by Inmersoft guide backend

icontent IContent is a library that allows loading audio visual content generica

Orlando Novas Rodriguez 3 Nov 3, 2022
❤️ A heart-shaped toggle switch component built using Jetpack Compose

heart-switch A heart-shaped toggle switch component built using Jetpack Compose. Inspired by Tore Bernhoft's I heart toggle Dribbble shot and Anatoliy

Anton Popov 30 Dec 14, 2022
A Coordinator Layout-like component in Jetpack Compose.

CollapsingToolbarInCompose Branches master: Initial code. column_version: Resulting code using a Column. ?? lazycolumn_version: Resulting code using a

Glenn 38 Dec 9, 2022
Jetpack Compose component box.

Jetpack Compose Component Box About The Project ℹ️ This project is a project where you can find and use custom components in Jetpack Compose. Our goal

Mert Toptas 43 Dec 10, 2022
A Jetpack Compose component used for displaying Markdown-formatted text.

MarkdownText A library for displaying Markdown contents within Jetpack Compose. Uses Coil Current limitations Lists that are annotated with the * must

Arnau Mora 4 Dec 15, 2022
A Simple Blog App using Jetpack Compose, Flow, Navigation Compose, Room and Firebase

BlogCompose A Simple Blog App using Jetpack Compose, Flow, Navigation Compose, Room and Firebase Instructions Download your Firebase configuration fil

null 4 Oct 10, 2022