bumptech / bumptech/glide

Glide v4.10.0 loading wrong images in reyclerview after scrolling up and down

Open
#4,607 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
35k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
8

Description

Glide Version:
I'm using Glide v4.10.0

Integration libraries:
OkHttp3 & Gson

Issue details:

When I scroll up & down a few pages and come back I notice that viewholders(with no url) has same images as neighbour viewholders(with url).

Note:
1. It works fine till 4.9.0 but it's broken from 4.10.0 and above. I tried updating to glide v4.12.0(latest version) but the issue still exists.
2. I tried to solve the issue using view tags but it doesn't do anything.
2. I'm already handling empty url case by clearing the imageview with Glide.with(context).clear(imageView).

GlideApp.with(IntouchApp.getAppContext())
.load(mDisplayedUri)
.transition(DrawableTransitionOptions.withCrossFade())
.apply(
new RequestOptions()
.override(Photo.THUMBNIL_MAX_SIZE, Photo.THUMBNIL_MAX_SIZE)
.dontAnimate()
.transform(new CircleTransform())
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.placeholder(mPlaceholder)
)
.listener(new RequestListener() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) {
if (mIsPhotoShown != null) {
mIsPhotoShown.photoShown(false);
}
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT && mShimmerFrameLayout != null && mShimmerFrameLayout.isShimmerStarted()) {
mShimmerFrameLayout.stopShimmer();
mShimmerFrameLayout.setShimmer(null);
}
if (e != null) {
e.printStackTrace();
}
return false;
}

@Override
public boolean onResourceReady(Drawable resource, Object model, Target target, DataSource dataSource, boolean isFirstResource) {
if (mIsPhotoShown != null) {
mIsPhotoShown.photoShown(true);
}
setScaleType(ImageView.ScaleType.FIT_XY);
setPhotoClickListener();
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT && mShimmerFrameLayout != null && mShimmerFrameLayout.isShimmerStarted()) {
mShimmerFrameLayout.stopShimmer();
mShimmerFrameLayout.setShimmer(null);
}
return false;
}
})
.into(mImageView);

XML:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.