Created Android App using Marvel API to learn about MVI (Model-View-Intent) Architecture.
MVI stands for Model-View-Intent. MVI works in a very different way compared to its distant relatives, MVC, MVP or MVVM. The role of each MVI components is as follows:
- Model represents a state. Models in MVI should be immutable to ensure a unidirectional data flow between them and the other layers in your architecture.
- Like in MVP, Interfaces in MVI represent Views, which are then implemented in one or more Activities or Fragments.
- Intent represents an intention or a desire to perform an action, either by the user or the app itself. For every action, a View receives an Intent. The Presenter observes the Intent, and Models translate it into a new state.
What we used here:
- Kotlin
- RxJava2
- Retrofit
- Coil
- Hilt
- Getting API Key from Marvel API
- Open or create
gradle.properties
file in your root project. - Edit to put your API key:
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official
base_url="https://gateway.marvel.com:443/"
public_key="public_key_here"
private_key="private_key_here"
- Rebuild or Re-open the project.
Start learning from these branches:
master
Full code implementation.section-1-home-page
contains MVI implementation at home page.section-2-detail-page
contains MVI implementation at detail page.
- Ahmad Kamil Almasyhur @kamilmasyhur
- Danviero Yuzwan @yuzwan19