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;
}
}
Aggregations