Hello there ,
In this project I tried showcasing how to build an Android Application with clean architecture and MVVM using some of the jetpack libraries with Kotlin Coroutines & Dagger Hilt. This App is using the Rick and Morty GraphQl as a remote data source.
This app is based on the Guide to app architecture article, Kotlin 1.4, and coroutine. I also used some android architecture components like LiveData, ViewModel.
- UI calls method from ViewModel.
- ViewModel executes Use case.
- Use case executes one or multiple Repositorie function.
- The Repository returns data from one or multiple Data Sources. the repository is the single source of truth (maybe i'll add room to support local data source later)
- Information flows back to the UI where we display the data fetched from data sources.
I made a diagram to show the flow of the data between the three layers(data, domain , presentation)
- Data
- This is my data layer and consists of the Repository implementation class as well as the remote data sources and mappers
- Domain
- This is the domain layer and consists of the domain models as well as the usecases.
- UI
- This is the presentation layer. I have set up packages by feature here. This consists of the view related code.
- DI
- This is where Dagger related code lives , I wanted to try out Hilt and see what it can deliver.
- Utils
- This is where most extension functions and constants.
- ViewModel - store and manage UI-related data in a lifecycle conscious way
- LiveData - notify the view when data changes .
- ViewBinding - easily write code that interacts with view
- Material - Material Components.
- Coroutine - performs background tasks
- Flows - for asynchronous data streams
- Coil - An image loading library for Android backed by Kotlin Coroutines
- Gson - JSON Parser
- Apollo- networking
- Dagger Hilt - dependency injector
- Espresso // UI test
- Barsita -UI tests Built on top of Espresso
- Junit // unit tests
- Truth // Makes your test assertions and failure messages more readable