This Repository contains a simple MVVM Architecture using TheCatApi made in Kotlin without RX and without dagger2/Koin Just the basic 😉
Implementing Cat API
Made with Android Studio 4.1
-
BasicApp class: Override the Application() class to inject dependencies ( like repositories )
-
data: Contains local entities, DTO's, Api services, repositories and also the NetworkProvider
-
ui: Just contain View Classes like Activities/Fragment, Adapters, etc...
-
utils: Contain tools and extensions ( like a BindingExtension to use Glide directly into a layout.xml )
-
viewmodels: Contain all the ViewModels classes provinding views with data
This project is basically a very simple representation of the MVVM ( without any optional library like Dagger2/Koin or RXJava/RXKotlin ) and this is how it's implemented
-
ViewModel
-
Expose models get from the service to the view
-
Can be create with a factory to allow the injection of dependencies
-
-
View ( ui )
-
Subscribe to the ViewModel
-
Observe data exposed by the ViewModel
-
Update the UI when ViewModel data's change
-
In fact I used some librairies to make this simple project but don't worry these librairies can be used in other architecture ( MVP, MVC, etc )
The project use AndroidX
-
Glide media management and image loading framework for Android
-
Retrofit2 HTTP client for Android
-
Retrofit LiveData Adapter A Retrofit 2 CallAdapter.Factory for Android LiveData
-
Retrofit Converter Moshi A Converter which uses Moshi for serialization to and from JSON.
-
Moshi Moshi is a modern JSON library for Android and Java. It makes it easy to parse JSON into Java objects
If you have any trouble of understanding or if you want to help me to improve myself let me know ! 😊