private P restorePresenterOrRecreateNewPresenterAfterProcessDeath ( ) { P presenter ; if ( keepPresenterInstanceDuringScreenOrientationChanges ) { if ( mosbyViewId != null && ( presenter = PresenterManager . getPresenter ( getActivity ( ) , mosbyViewId ) ) != null ) { // // Presenter restored from cache // if ( DEBUG ) { Log . d ( DEBUG_TAG , "Reused presenter " + presenter + " for view " + delegateCallback . getMvpView ( ) ) ; } return presenter ; } else { // // No presenter found in cache, most likely caused by process death // presenter = createViewIdAndPresenter ( ) ; if ( DEBUG ) { Log . d ( DEBUG_TAG , "No presenter found although view Id was here: " + mosbyViewId + ". Most likely this was caused by a process death. New Presenter created" + presenter + " for view " + delegateCallback . getMvpView ( ) ) ; } return presenter ; } } else { // // starting first time, so create a new presenter // presenter = createViewIdAndPresenter ( ) ; if ( DEBUG ) { Log . d ( DEBUG_TAG , "New presenter " + presenter + " for view " + delegateCallback . getMvpView ( ) ) ; } return presenter ; } }
Creates the presenter instance if not able to reuse presenter from PresenterManager