sockeqwe / mosby

A Model-View-Presenter / Model-View-Intent library for modern Android apps
http://hannesdorfmann.com/mosby/
Apache License 2.0
5.49k stars 841 forks source link

[Question] How to save LCE view state using MvpLceActivity? #166

Closed fzymek closed 7 years ago

fzymek commented 7 years ago

Hello,

I am trying out mosby, and I have trouble implementing saving view state for lce view when using activity.

I tried creating custom view which implements both RestorableViewState and LceViewState and return this view createViewState. I've also implemented apply method but with device rotation view state was not saved and mosby was calling showLoading without caling loadData.

Is it even possible to use LCEViewState with activites?

sockeqwe commented 7 years ago

Sure, it is possible with Mosby. If you call MvpActiviy.setRetainInstancestate(true) in onCreate() you dont even have to use a RestireableViewState. Can you share some of your code?

Filip Zymek notifications@github.com schrieb am Fr., 30. Sep. 2016, 12:06:

Hello,

I am trying out mosby, and I have trouble implementing saving view state for lce view when using activity.

I tried creating custom view which implements both RestorableViewState and LceViewState and return this view createViewState. I've also implemented apply method but with device rotation view state was not saved and mosby was calling showLoading without caling loadData.

Is it even possible to use LCEViewState with activites?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sockeqwe/mosby/issues/166, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjnrjMQxmSjtizOSY0uyFsF2StPJoHgks5qvN8ggaJpZM4KK7bq .

fzymek commented 7 years ago

Ok, I got it working with calling setRetainInstance(true) in my activity and using RetainingLceViewState as my ViewState.

Thanks!