I am not sure if this is Picasso issue, GridLayoutManager issue or my implementation is just flawed (see the sample app).
The issue is described on stackoverflow under:
http://stackoverflow.com/questions/29311428/recyclerview-with-gridlayoutmanager-and-picasso-showing-wrong-image
git clone https://github.com/gswierczynski/recycler-view-grid-layout-with-picasso.git
Tap on an item calls notifyItemChanged with parameter equal to the position of that item.
RecyclerView with GridLayoutManager (spanCount = 3). List items are CardViews with ImageView inside.
When all the items does not fit the screen calling notifyItemChanged on one item causes more than one calls to onBindViewHolder(). One call is for position from notifyItemChanged others for items not visible on the screen.
Sometimes the item at position passed to the notiryItemChanged is loaded with an image belonging to an item that is not on the screen (most likely due to recycling of the view holder - although I would assume that if the item remains in place then the passed viewholder would be the same).
I have found Jake's comment on other issue here about calling load() even if the file/uri is null. Image is loaded on every onBindViewHolder here.
Thanks. If only all issues reported would be as well executed...
We'll have a look soon!
Any luck reproducing it on your end?
I think the issue is connected in some way to the behavior of ItemAnimator.
Please see the explanation HERE.
When setSupportsChangeAnimations(false) is used the issue is not present.
I have also noticed that just scrolling the recycler view may produce wrong placement of the loaded images.
Thanks for the very detailed bug report. I havent read the whole thing but did you come into a conclusion to this?
I had the same issue in my app where calling notifyItemChanged(position) flashed the item and an image from one of the other tiles would replace the one on the item that was notified.
setSupportsChangeAnimations(false) and setHasStableIds(true) seem to prevent this from happening
Same issue.
@gswierczynski 's report is quite enough.
Looking forward for a fix.
Thx a lot.
What's the status on merging this bugfix?
6991476576985d5d1cec1b37b61bc24d1d4bf4c7
Since I am affected by this bug how can I get a version of picasso (as a dependency) incorporating this bugfix?
I still see that this issue exists in com.squareup.picasso:picasso:2.5.2
setSupportsChangeAnimations(false) and setHasStableIds(true) seem to prevent this from happening
Most helpful comment
I had the same issue in my app where calling notifyItemChanged(position) flashed the item and an image from one of the other tiles would replace the one on the item that was notified.
setSupportsChangeAnimations(false) and setHasStableIds(true) seem to prevent this from happening