Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

khunzohn/CleanMVI

Repository files navigation

Clean MVI

This project started out as a follow up sample project for our talk at DroidYangon 2019. The app includes handling of reactive friendly use cases in clean mvi way: toggling favourite status, filtering and sorting for example. It also showcases the application of the following important concepts:

  • Immutability (No var. Data can't be modified once emitted from the Model)
  • Unidirectional data flow (view -> intent -> model -> view )
  • Single source of truth (Only one source of data emission: The Model)
  • Dependency Inversion (Business rule depends on data sources? NO. Data sources depend on abstraction defined by Business Rule)

Model here means a combination of Interactor and Repository

It also leverages epoxy lib to construct view sections. With kotlin declarative syntax, it's an awesome experience to build complex ui with only a single recyclre view.

Not necessary a requirement but using mosby lib helps you hit the ground running a lot faster. The lib provides retaining presenter which survives device orientation changes and some MVI related goodies. With a bit more work, we can definitely use google's viewmodel in place of mosby presenter though. Just a matter of personal preferences. Don't forget to change orientation while testing and see the result.

The selling point of MVI is state management. This little sample wouldn't worth a penny if it falls short of it. To make the game a bit more competitive, offline support is added to the mix, showing progressBar is split into two modes: Circle progress[when data is empty] and horizontal progress[when data is not empty]. Showing error also has two modes. Just turn off network data to see the error. Well, have fun architecting!

Screen Shots

Apple Products Favourite Filter Favourite + New Filter

About

Sample project showcasing the use of MVI+clean architecture

Topics

Resources

Readme

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors