Skip to content
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

Scroll position moves automatically when timestamps are updated #28

Open
ssawchenko opened this issue Oct 13, 2016 · 1 comment
Open

Comments

@ssawchenko
Copy link

ssawchenko commented Oct 13, 2016

Found on my Nexus 5 Running 6.0.1 (but I have seen this on other devices as well)

I have noticed an issue where whenever the timestamps are to be updated, the scroll position in the recyclerview will change, such that it seems to push the user "up" the list. You can see this issue more pronounced by changing the timestamps to update every 5 seconds (instead of 62) and always forcing the notifyItemChanged to be called.

Digging around it appears it may be an issue with RecyclerView itself (https://code.google.com/p/android/issues/detail?id=203574)

=== My Fix ===
I have made some changes to our forked repo that tries to circumvent the problem.

  • mRecyclerView.setHasFixedSize(true); // Fixes redraw resize issue that was forcing a scroll position change.
  • mRecyclerView.getItemAnimator().setChangeDuration(0); // Removes flicker happening on notifyItemChanged redraw.

It still needs testing, and the animation now doesn't look as nice when adding new chats, but the scrolling bug appears to be solved by this.

If I have time I will look at making a PR against the lib with these changes.

@jchunchar
Copy link

Nice catch -- definitely feel free to make a PR with your fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants