Description
By adhering to the clean architecture principles, the innermost layers of an app (i.e., where all the business logic of the app resides) should be “frontend agnostic”. This means that this layers are completely decoupled from the Android framework, and could be ideally implemented as pure Java packages. Additionally, as this layers represent the core of Android apps, they should be developed before all other layers. Changes to the innermost layers should be driven exclusively by business decisions.
Example
We created a simple MVP example.
If we take a look at our MVP example we see that almost everything is decoupled from our Android framework. Only the Activity is coupled to the Android framework. The Presenter only views this MainActivity as a View. So there is no direct link to the Android framework.
Each component can easily be tested. Since the MainPresenter has no actual reference to the MainActivity the MainPresenter is Android-independent making the presenter testable without an emulator.
When the Presenter wants the view to show the users, it calls, mainView.showUsers(Employees).
These are methods accessible by the MainPresenter:
Check out the Github page to view the complete repository.