Skip to content

Instantly share code, notes, and snippets.

@vestrel00
Created July 28, 2017 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vestrel00/bd4e6aa1519eb6c6e0e5d158265989bf to your computer and use it in GitHub Desktop.
Save vestrel00/bd4e6aa1519eb6c6e0e5d158265989bf to your computer and use it in GitHub Desktop.
C: 1 - ui/common/view/BaseViewFragment.java
public abstract class BaseViewFragment<T extends Presenter> extends BaseFragment
implements MVPView {
@Inject
protected T presenter;
@Override
public void onViewStateRestored(Bundle savedInstanceState) {
super.onViewStateRestored(savedInstanceState);
// Only start the presenter when the views have been bound.
// See BaseFragment.onViewStateRestored
presenter.onStart(savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
presenter.onResume();
}
@Override
public void onPause() {
super.onPause();
presenter.onPause();
}
@CallSuper
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
presenter.onSaveInstanceState(outState);
}
@Override
public void onDestroyView() {
presenter.onEnd();
super.onDestroyView();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment