-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
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
Collect session-list in view-model scope in view models of the favorite list and changes list. #598
base: master
Are you sure you want to change the base?
Conversation
...of the favorite list and changes list. This fixes the bug that the vertical scroll position was not preserved when navigating to a session-detail-view and back to the list.
I'll have a look at the failing tests after I got some sleep and update the PR. Edit: done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue described #432 still happens for me. Tested on a tablet. I updated the description to mention that I reset the system date/time to test the issue.
Feel free to append a recording of your observations to your pull request. Maybe we are doing things differently.
@@ -80,6 +80,7 @@ class ChangeListFragment : AbstractListFragment() { | |||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |||
super.onViewCreated(view, savedInstanceState) | |||
observeViewModel() | |||
viewModel.observeChangeListParameter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not call the viewModel
directly from a fragment. The view (fragment) is supposed to only listen (observe) to state or event changes published by the view model through its public properties. The view (fragment) has to be "damn stupid".
You can rewrite the view model similar to what is done in FahrplanViewModel
. There the init
function is used to launch collecting a data stream like your repository.changedSessions.collect
.
Same for the StarredListFragment
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabianbieler If you have any questions or need help please let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabianbieler Please don't hesitate to reach out if you want assistance here.
Acknowledgments
Please check the following boxes with an
x
if they apply:Description
For both the change-list and the favorite-list:
collect the Flow of sessions in view-model scope, and send the converted parameters through a channel.
Before
See attached issue
After
Scroll position is preserved.
Resolves #432