idanatz / OneAdapter

A Viewholderless Adapter for RecyclerView, who supports builtin diffing, states (paging, empty...), events (clicking, swiping...), and more.
MIT License
470 stars 45 forks source link

Calling update method force recyclerview to scroll to updated position if not visible #22

Closed ampeixoto closed 4 years ago

ampeixoto commented 4 years ago

Maybe I am doing something wrong, but I am setting up the Adapter as explained in the documentation (I am using databinding), but when I call the method update() of the OneAdapter instance, the recyclerview scrolls to the updated position if it is not visible.

I dont want this behavior... If it is not visible, it should stay in the same scroll position. Is this behavior expected or there is any way to avoid this?

By the way, great library! Started to using it and it seems very handy.

idanatz commented 4 years ago

Hi, Thanks :)

a couple of questions:

  1. on what situation you use update when you are in data binding mode? if its to update the data in the adapter there is no need, just update the model and the update will re-render the changes.

  2. what do you mean "if it not visible"? not visible on the screen or the view is set to GONE in some form?

Please share as much information as possible.

Either way, I tested updating the model when it's in GONE state or outside of the user-visible items and no scroll has happened. Please check the sample project in the DataBinding section and see if the issue can be reproduced there.

Else, if you can upload a minimal project as possible that reproduce this bug it will be appreciated.

ampeixoto commented 4 years ago

Hello.

Sorry, but I had to drop the task where I was using OneAdapter, so I am not actively searching a solution for it anymore. But I will reply to your questions:

  1. I was exactly calling the update method after updating the model. I didnt test without the update method to see if the view was updated properly.
  2. By not visible I mean not visible on the screen (user scrolled to another section of the screen)