Search in sources :

Example 1 with RestorableParcelableViewState

use of com.hannesdorfmann.mosby3.mvp.viewstate.RestorableParcelableViewState in project mosby by sockeqwe.

the class ViewGroupMvpViewStateDelegateImpl method onSaveInstanceState.

/**
   * Must be called from {@link View#onSaveInstanceState()}
   */
@Override
public Parcelable onSaveInstanceState() {
    VS viewState = delegateCallback.getViewState();
    if (viewState == null) {
        throw new NullPointerException("ViewState returned from getViewState() is null for MvpView " + delegateCallback.getMvpView());
    }
    Parcelable superState = delegateCallback.superOnSaveInstanceState();
    if (keepPresenter) {
        if (viewState instanceof RestorableParcelableViewState) {
            return new MosbyViewStateSavedState(superState, mosbyViewId, (RestorableParcelableViewState) viewState);
        }
        return new MosbyViewStateSavedState(superState, mosbyViewId, null);
    } else {
        return superState;
    }
}
Also used : RestorableParcelableViewState(com.hannesdorfmann.mosby3.mvp.viewstate.RestorableParcelableViewState) Parcelable(android.os.Parcelable)

Aggregations

Parcelable (android.os.Parcelable)1 RestorableParcelableViewState (com.hannesdorfmann.mosby3.mvp.viewstate.RestorableParcelableViewState)1