https://github.com/lykhonis/mvp
New Android -> MVP, DI, Unit Testing in Android
https://github.com/lykhonis/mvp
Last synced: about 1 year ago
JSON representation
New Android -> MVP, DI, Unit Testing in Android
- Host: GitHub
- URL: https://github.com/lykhonis/mvp
- Owner: lykhonis
- License: apache-2.0
- Created: 2015-05-23T00:51:33.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-06-26T16:02:40.000Z (almost 11 years ago)
- Last Synced: 2025-02-09T12:29:34.133Z (over 1 year ago)
- Language: Java
- Size: 152 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Movel-View-Presenter for Android
#### Presenter
Presenter is base class to extend from to make presenters per view. Calling `create` to create new presenter instace. In the example caching technique is used to cache presenters. Presenters will survive configuration changes and will be removed only in a case of finishing activity.
E.g. In a case of Fragment being View (MVP)
```java
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mPresenter.attachView(this);
}
@Override
public void onDestroyView() {
super.onDestroyView();
mPresenter.detachView(!getActivity().isFinishing());
}
```
There is still space for saving/restoring state through Bundle though. But even in this case, if we lose process (heap) state, we will consider it as fresh start and reload data. This is extreme case and may be ignored to keep code clean and maintainable.