We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I faced with some issue and would be very appriciate if you could help with it. I use gradle com.hannesdorfmann.mosby3:viewstate:3.1.1
gradle com.hannesdorfmann.mosby3:viewstate:3.1.1
This is my Activity class:
class MainActivity : BaseViewStateActivity<MainActivityView, MainActivityPresenter, MainViewState>(), MainActivityView { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) } override fun onPostCreate(savedInstanceState: Bundle?) { super.onPostCreate(savedInstanceState) } override fun onNewViewStateInstance() { presenter.nextPage() } override fun createPresenter(): MainActivityPresenter = MainActivityPresenter() override fun createViewState(): MainViewState = MainViewState()
and ViewState:
class MainViewState : RestorableViewState<MainActivityView> { private val keyState = "MainViewState.KEY" var data = ArrayList<*>() override fun saveInstanceState(out: Bundle) { out.putString(keyState, "123") } override fun restoreInstanceState(args: Bundle?): RestorableViewState<MainActivityView> { var savedString = args?.getString(keyState) return this } override fun apply(view: MainActivityView?, retained: Boolean) { safeLet(view, data) { v, data -> v.updateRecycleView(data) } } }
The problem is that restoreInstanceState is never called. Could you please explain me the logic in
mosby/viewstate/src/main/java/com/hannesdorfmann/mosby3/mvp/delegate/ActivityMvpViewStateDelegateImpl.java
Line 75 in 7f22118
The first time an Activity is started, restoreInstanceState is not called, because the bundle is null
if (bundle != null && viewState instanceof RestorableViewState) { ... RestorableViewState restoredViewState = ((RestorableViewState) viewState).restoreInstanceState(bundle); ... }
but after rotate the screen, the method does not call as the program stops at line 92 (where return is called)
if (mosbyViewId != null) { VS viewState = PresenterManager.getViewState(activity, mosbyViewId); if (viewState != null) { // // ViewState restored from PresenterManager // setViewState(viewState, true, true); if (DEBUG) { Log.d(DEBUG_TAG, "ViewState reused from Mosby internal cache for view: " + delegateCallback.getMvpView() + " viewState: " + viewState); } return; } }
why is "return" called?
thank you in advance, Regards!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi, I faced with some issue and would be very appriciate if you could help with it.
I use
gradle com.hannesdorfmann.mosby3:viewstate:3.1.1
This is my Activity class:
and ViewState:
The problem is that restoreInstanceState is never called.
Could you please explain me the logic in
mosby/viewstate/src/main/java/com/hannesdorfmann/mosby3/mvp/delegate/ActivityMvpViewStateDelegateImpl.java
Line 75 in 7f22118
The first time an Activity is started, restoreInstanceState is not called, because the bundle is null
but after rotate the screen, the method does not call as the program stops at line 92 (where return is called)
why is "return" called?
thank you in advance,
Regards!
The text was updated successfully, but these errors were encountered: