1 package com.moiseum.wolnelektury.base.mvp;
3 import android.os.Bundle;
4 import android.support.annotation.NonNull;
5 import android.view.View;
7 import com.moiseum.wolnelektury.base.AbstractFragment;
11 * Fragment that creates {@link LifecyclePresenter} and in its lifecycle methods calls corresponding methods of
14 * @param <P> type of presenter for this fragment.
16 public abstract class PresenterFragment<P extends FragmentPresenter> extends AbstractFragment {
20 protected abstract P createPresenter();
22 protected P getPresenter() {
27 public void onCreate(Bundle savedInstanceState) {
28 super.onCreate(savedInstanceState);
29 presenter = createPresenter();
30 presenter.onCreate(savedInstanceState);
34 public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
35 super.onViewCreated(view, savedInstanceState);
36 presenter.onViewCreated(savedInstanceState);
40 public void onStart() {
46 public void onStop() {
52 public void onResume() {
58 public void onPause() {
64 public void onDestroyView() {
65 super.onDestroyView();
66 presenter.onDestroyView();
70 public void onDestroy() {
72 presenter.onDestroy();
76 public void onSaveInstanceState(@NonNull Bundle outState) {
77 super.onSaveInstanceState(outState);
78 presenter.onSaveInstanceState(outState);