/**
  * Sets a presenter factory. Call this method before onCreate/onFinishInflate to override default
  * {@link ReflectionPresenterFactory} presenter factory. Use this method for presenter dependency
  * injection.
  */
 @Override
 public void setPresenterFactory(PresenterFactory<P> presenterFactory) {
   presenterDelegate.setPresenterFactory(presenterFactory);
 }
 /**
  * Returns a current attached presenter. This method is guaranteed to return a non-null value
  * between onResume/onPause and onAttachedToWindow/onDetachedFromWindow calls if the presenter
  * factory returns a non-null value.
  *
  * @return a currently attached presenter or null.
  */
 public P getPresenter() {
   return presenterDelegate.getPresenter();
 }
 /** Returns a current presenter factory. */
 public PresenterFactory<P> getPresenterFactory() {
   return presenterDelegate.getPresenterFactory();
 }
 @Override
 public void onPause() {
   super.onPause();
   presenterDelegate.onPause(getActivity().isFinishing());
 }
 @Override
 public void onResume() {
   super.onResume();
   presenterDelegate.onResume(this);
 }
 @Override
 public void onSaveInstanceState(Bundle bundle) {
   super.onSaveInstanceState(bundle);
   bundle.putBundle(BUNDLE_PRESENTER_STATE, presenterDelegate.onSaveInstanceState());
 }
 @Override
 public void onCreate(Bundle bundle) {
   super.onCreate(bundle);
   if (bundle != null)
     presenterDelegate.onRestoreInstanceState(bundle.getBundle(BUNDLE_PRESENTER_STATE));
 }