Created
May 4, 2017 08:47
-
-
Save cloudshooterhuman/5f9840f124a03442fd7a6b214386a95d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Note : | |
We will use MVP as default architecture cause it's easy to implement comparing to MVVM. | |
Instead we will implement some features with MVVM architecture. | |
## Why we need an Architecture ? | |
1. The Android API is tightly coupled. | |
2. Make the app easy to test (the must important part). | |
3. Make the app modular. | |
4. Make app change/fix easy. | |
## The Model-View-Presenter Pattern : | |
* Model — the data layer. | |
* View — the UI layer | |
* Presenter — fetch the data from the Model and handle the View state. | |
In practice : | |
* Model — The Model works with the remote and local data sources to get and save the data. | |
`List<Agency> agencies;` | |
* View : | |
`public interface AgencyMvpView extends BaseView { | |
void onAgencySendResult(Boolean result, int code, AgencyResponse agencyResponse); | |
void loadMarkers(Boolean result, int code, AgencyResponse agencyResponse); | |
void loadCities(); | |
}` | |
* Presenter : | |
`public class AgencyPresenter implements BasePresenter<AgencyMvpView> { | |
private AgencyMvpView agencyMvpView; | |
private Subscription subscription; | |
... | |
}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment