- API (Services) - Network Tempalte
- App (Application) - Base Application
- DB (Database) - Room / Realm
- DI (Dependency Injection) - Hilt
- EXT (Constants) - Constants
- ENTITY (DataModels) - Entity and Models
- INTERACTORS (PhotoInteractor) - Model
- PRESENTATION (Views and ViewModels - ViewBindings) - Intent / Action
- UTILS (Extensions / DataState etc) - Helper classes
The idea of this project would be to give a very simple implementation of the MVI architecture that you might use on daily basis in your projects as a base. So you could basically go forward with more complex and advanced usage of it. Currently we have introduced. Simple View State - ViewModel State - Networking and Caching with Room and Model State we have a network request which we cache in our db and afte that show the data.
- Model-View-Intent is a tool to create maintainable and scalable apps.
- A unidirectional and cyclical data flow.
- A consistent state during the lifecycle of Views.
- Immutable Models that provide reliable behavior and thread safety on big apps.
- The downside of using MVI rather than other architecture patterns for Android is that the learning curve for this pattern tends to be a bit longer. You need a decent amount of knowledge of other intermediate and advanced topics such as reactive programming, multi-threading and RxJava. Architecture patterns such as MVC or MVP might be easier to grasp for new Android developers.
-
The following has been applied.
-
Views observe user action and renders different state - ViewModel - adds or removes - Interactor or Business Logic would create a new model with different state.
-
Testing haven't been integrated in this project. But would be fairly simple to do that. Firebase Cloud, Espresso, Robo etc.
-
Added all the libraries for base setup for AndroidX on request for testing setup soon.
- The project doesn't have any CD integrated. But if anyone would like to have that i would provide a sample implementation to any of the following: BitBucket, Github, CircleCI, Travis or any other.
- Bintray - Maven/JCenter Center automation and Distribution can be added also the scripts can be added without any issues or incompatibility
- The Gradle scripts and managment haven't been updated to production build since the project is unknown and the future requirements are also. Once someone has a proposal i can add it and update a base default one. Which most people have in their company.
- The language of the code would stay Kotlin. The architecture can be applied and rotated to MVP fairly easy and to Java after if you want.
- It has been years for me when i started in University adding code documentation and i would like to think and continue to do that as a good developers practise. SOLID would be kept in mind for this project at all times. Do please let me know if i have an error somewhere. Appreciate it.
- Plugins that i have personally used in our company and in my personal work.
- Here you can find a very clean arch that will be updated in the future with some small samples and cool integrations over the time. I would be adding some more about that soon when i can find some more time.
- Could be added if requested. Currently doesn't contain implementation.
- Could add ComposeViews for customViews or Composable View implementation if required. Would probably add it in the future.
- The projectu uses lifecycle aware components
- DiffUtil to be updated with the new implementation
-
Base Mapper for Entity and Network Models
-
If time Composable Integration with Migration Strategy and Integration of standalone or custom View
-
KSP will be integrated at a later date when most libraries support it!
-
Kotlin Extensions, MediatorLiveData, Transformations and more
-
Simplify and extend the project further
-
RxJava3 implementation and render
-
Reducer etc
-
Next update will contain MVIKotlin implementation and MVICore implementation 89in different branches.
- MVI CORE BADOO - https://github.com/badoo/MVICore
- MVI Kotlin - https://github.com/arkivanov/MVIKotlin
- Kotlin Multiplatform Plugin - https://kotlinlang.org/docs/mobile/setup.html
Take your time with these two architectures since they are quite good to be used in production and also it might not fit the best with every project, team and organization. Also if you wish you could go in multiplatform it's quite interesting and nice how you could go forward!
Feel free to use. If you can add me to any credits would appreciate it. Thanks. A good base would be to have something like the new projects that i will be adding for MVI and KotlinMultiplatform with MVI. You could also adapt this project for KotlinMultiplatform.