A sample android app that shows Clean Architecture implementation using MVP design pattern.
Implemented by Clean Architecture
- Presentation (Activity/Fragment and Presenter)
- Domain (Interactor/Usecases, Repository Interface and Model classes)
- Data (Local/remote datastore and Repository implementation)
Dependencies between components
Activity/Fragment --> Presenter --> Usecase(Interactor) --> Repository --> LocalDataStore(Room DB)
Communication between layers
All the layers are communicated through callbacks.
- UI calls method from ViewModel.
- ViewModel executes Use case.
- Use case combines data from Album and Photo Repositories.
- Each Repository returns data from a Data Source (Cached or Remote).
- Information flows back to the UI where we display the list of posts.
- Navigator
- ResourceManger
Scenario
At a glance:
- Use can either Register or Login if already registered
- Once authenticated, show list of todos with option to add new todo
- Once tap on each item, show edit/delete todo screen
References
Unit testing
- https://www.pluralsight.com/guides/mvp-with-testing-part-2
- https://fernandocejas.com/2014/04/08/unit-testing-asynchronous-methods-with-mockito/
- https://www.codota.com/code/java/methods/org.mockito.Mockito/anyList
- https://github.com/techyourchance/unit-testing-in-android-course
- https://github.com/mitchtabian/Unit-Testing-2
Travis-Ci integration - https://github.com/codecov/example-android/blob/master/.travis.yml
Codecov and Travis-Ci integration - https://github.com/codecov/example-android