package com.arellomobile.mvp;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Date: 19-Dec-15
 * Time: 13:25
 *
 * @author Alexander Blinov
 * @author Yuri Shmakov
 * @author Konstantin Tckhovrebov
 */
public class MvpFragment extends Fragment
{
	private MvpDelegate<? extends MvpFragment> mMvpDelegate;

	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);

		getMvpDelegate().onCreate(savedInstanceState);
	}

	public void onStart()
	{
		super.onStart();

		getMvpDelegate().onAttach();
	}

	@Override
	public void onDestroyView()
	{
		super.onDestroyView();

		getMvpDelegate().onDetach();
	}

	@Override
	public void onDestroy()
	{
		super.onDestroy();

		if (isRemoving())
		{
			getMvpDelegate().onDestroy();
		}
	}

	public void onSaveInstanceState(Bundle outState)
	{
		super.onSaveInstanceState(outState);

		getMvpDelegate().onSaveInstanceState(outState);
	}

	public MvpDelegate getMvpDelegate()
	{
		if (mMvpDelegate == null)
		{
			mMvpDelegate = new MvpDelegate<>(this);
		}

		return mMvpDelegate;
	}
}
package com.arellomobile.mvp;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Date: 19-Dec-15
 * Time: 13:25
 *
 * @author Alexander Blinov
 * @author Yuri Shmakov
 * @author Konstantin Tckhovrebov
 */
public class MvpFragment extends Fragment
{
	private MvpDelegate<? extends MvpFragment> mMvpDelegate;

	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);

		getMvpDelegate().onCreate(savedInstanceState);
	}

	public void onStart()
	{
		super.onStart();

		getMvpDelegate().onAttach();
	}

	@Override
	public void onDestroyView()
	{
		super.onDestroyView();

		getMvpDelegate().onDetach();
	}

	@Override
	public void onDestroy()
	{
		super.onDestroy();

		if (isRemoving() || getActivity().isFinishing())
		{
			getMvpDelegate().onDestroy();
		}
	}

	public void onSaveInstanceState(Bundle outState)
	{
		super.onSaveInstanceState(outState);

		getMvpDelegate().onSaveInstanceState(outState);
	}

	public MvpDelegate getMvpDelegate()
	{
		if (mMvpDelegate == null)
		{
			mMvpDelegate = new MvpDelegate<>(this);
		}

		return mMvpDelegate;
	}
}

Update MvpFragment.java