athkalia/Just-Another-Android-App

Change orientation change while loading

miguelslemos opened this issue · 4 comments

Hello, I found a problem when changing orientation while loading, the displayShotsList method is not called because the Activity is destroyed

Hello.

On configuration changes Mosby's library view state kicks in (http://hannesdorfmann.com/mosby/viewstate/) and restores the state after the activity has been recreated. If you attach a debugger in the MainActivityViewState apply() method you'll see how it gets restored

if you change orientation before saveShots be called once when public void apply(MainView view, boolean retained) is called List<Shot> shots is null that makes an empty screen

Oh right, that's what you meant :P
I was aware of this but wasn't really planning to fix it in this sample project but as you've noticed it, I'll think about what the best way it is to deal with it.
If you have any suggestions or want to make a PR then please feel free ! : >

This is easier than expected, tackled under #58 . We just don't unsubscribe when the presenter is retained by mosby