Closed oldergod closed 6 years ago
Far too much happens in onCreate
, but I'll get it refactored eventually. I need to get a layer teased out between something pushing view models and the rendering so that rotation doesn't even trigger a new query.
I need to get a layer teased out between something pushing view models and the rendering so that rotation doesn't even trigger a new query.
FWIW, I believe the recyclerview scroll position resets because of the thread switch; after rotation, the layout adapter applies the saved scroll position to a new, not yet defined, list of items.
Right. So a view model available synchronously after rotation will solve that.
On Wed, Jan 17, 2018 at 11:33 PM Benoît Quenaudon notifications@github.com wrote:
I need to get a layer teased out between something pushing view models and the rendering so that rotation doesn't even trigger a new query.
FWIW, I believe the recyclerview scroll position resets because of the thread switch; after rotation, the layout adapter applies the saved scroll position to a new, not yet defined, list of items.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/JakeWharton/SdkSearch/issues/39#issuecomment-358534974, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEfjTTvkUTZJKy31XQF3HmgDTSkOqks5tLsmRgaJpZM4Rg5TW .
Hi @JakeWharton , First of all thank you for this amazing project. Can we use onSavedInstanceState() method of the layout manager to save state of recycler view when activity is rotated in onSavedInstanceState method of activity and then restoring it appropriately. It will be less tedious I think. Like mentioned in this link: https://stackoverflow.com/questions/28236390/recyclerview-store-restore-state-between-activities/28262885 Do tell me if I am wrong somewhere. If this approach seems OK to you I will send a quick PR?
That should be the default behavior. The problem is that we set an empty adapter before the actual data shows up on the next frame. A view model decoupled from the activity lifecycle will make the problem magically go away.
On Fri, Jan 26, 2018 at 7:19 PM Amanjeet Singh notifications@github.com wrote:
Hi @JakeWharton https://github.com/jakewharton , First of all thank you for this amazing project. Can we use onSavedInstanceState() method of the layout manager to save state of recycler view when activity is rotated in onSavedInstanceState method of activity and then restoring it appropriately. It will be less tedious I think. Like mentioned in this link: https://stackoverflow.com/questions/28236390/recyclerview-store-restore-state-between-activities/28262885 Do tell me if I am wrong somewhere. If this approach seems OK to you I will send a quick PR?
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/JakeWharton/SdkSearch/issues/39#issuecomment-360941070, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEbidt3BRyqRBJZk8XraGzIJj-0BCks5tOmuYgaJpZM4Rg5TW .
Agreed, with this case I'll definitely try the solution with viewmodel and will send PR if I solved it. Thanks :)
That's lowercase "view model" not the architecture component ViewModel. I don't understand the purpose of the architecture component existing...
On Fri, Jan 26, 2018 at 7:38 PM Amanjeet Singh notifications@github.com wrote:
Agreed, with this case I'll definitely try the solution with ViewModel. Thanks :)
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/JakeWharton/SdkSearch/issues/39#issuecomment-360943242, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEaAGlGSrv-Dx7LDSttRbhy4-iFOpks5tOm_ngaJpZM4Rg5TW .
Sorry my bad the small one I was also referring to the same but typed wrong. PS: Updated that 👍
That's lowercase "view model" not the architecture component ViewModel. I don't understand the purpose of the architecture component existing...
Do you advise against AAC ViewModel solution here? It could emit view's states and survive config changes? Why would it be bad?
This is almost fixed. The presenter is now retained across rotation and the old results are populated back into the UI. There's just a timing problem now of getting the first model after rotation.
This is fixed by f9fc452, but the keyboard still pops up on rotation. It'd be nice to retain it's state by having something other than the query edit text hold focus when you interact with the list.
This doesn't happen on my phone, only emulators. Closing as resolved.
Keyboard pops up on rotation thingy happens on current play store version. (on real device)
What device?
On Sun, Mar 11, 2018 at 5:34 AM Ankit Saliya notifications@github.com wrote:
Keyboard pops up on rotation thingy happens on current play store version. (on real device)
— You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub https://github.com/JakeWharton/SdkSearch/issues/39#issuecomment-372101738, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEdmocEgw7e5FdKbVh1w_ncaSsqgCks5tdO-hgaJpZM4Rg5TW .
Xioami MI A1. It has stock 8.0.0 running on it.