Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 1.96 KB

README.md

File metadata and controls

25 lines (16 loc) · 1.96 KB

ToDo MvRx

gif

This ToDo app follows the specification outlined in the Google Samples Android Architecture repo.

It is 100% feature complete and has significantly fewer lines of code compared to other archtiecture blueprints. Running cloc on src/main for MvRx yields:

Language LOC MvRx mvp-kotlin mvvm-live-kotlin mvp mvp-clean mvp-java
Kotlin 803 1541 1564 0 0 0
Java 0 0 0 2171 2777 2145
XML 501 608 751 608 608 611
Total 1304 2149 2315 2779 2385 2756

Architecture

ToDo-MvRx uses Room, Epoxy, and Navigation Components for its core architecture.

It then uses TasksViewModel to act as an in-memory cache and owner of multiple repositories. It could merge db + network but for the sake of having an actual single source of truth, it loads two different database sources that connect to the same database but have different artifical delays. It then proxies all tasks calls to each of them.

All task state is shared between Fragments using this ViewModel.

Snackbars for actions like adding a task are handled using this block of code which compares state changes to see when tasks have changed.