-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
ImageView briefly losing the image only on 4.14.2 (produces a flicker) #4958
Comments
If you call It would be interesting to see the Engine logs when you make these requests: https://bumptech.github.io/glide/doc/debugging.html#unexpected-cache-misses My guess is that in 4.14.1, the request is never made due to this logic: glide/library/src/main/java/com/bumptech/glide/RequestBuilder.java Lines 800 to 812 in 18bba92
glide/library/src/main/java/com/bumptech/glide/request/SingleRequest.java Lines 769 to 778 in 18bba92
The next possibility if the isEquivalentTo logic isn't relevant in either 4.14.1 or 4.14.2 is that there's been a change to the memory cache key. If that's the case, you will see a difference in the Engine logs between 4.14.1 and 4.14.2, somewhere around here:
But again I don't see either the listener or the transition in the key implementation:
|
Oh there is one bug for compose at least which is that we do not implement equals/hashcode for |
Thanks for answering!
It only works if I call neither of those. So I was assuming that it happens for new object instances, where I was not able to turn on those logs using I did these tests with different pages and different images. I omitted the url, but it's always the same in each test and we're not using custom cache keys. On 4.14.2:
On 4.14.1:
I can also see these logs in both versions:
We must be doing something wrong regarding But looking at the logs something has happened between 4.14.1 and 4.14.2. On the latter it tries to load the image with different sizes, where on the first it would be consistent. Now, how does this relate with having a Does this make sense, somehow? Let me know what else can I do. |
I can make some XML changes to avoid I've been playing around with some changes to try to avoid using We do have a |
The differences in Glide between 4.14.1 and 4.14.2 are here: 4.14.1...4.14.2. I don't see anything that seems like it would impact the size determination. Glide does not look at maxWidth or maxHeight. It might be interesting to try to debug the SizeDeterminer to see how it's managing to acquire a different sizes on 4.14.2:
One thing you can do though is just use |
I guess the issue is caused by this change. glide/library/src/main/java/com/bumptech/glide/RequestBuilder.java Lines 1257 to 1273 in ca47d9e
This Here is the call stack:
Therefore, the // Using the `com.bumptech.glide.request.RequestListener`
Glide.with(fragment)
.load(url)
.listener(object : RequestListener {
/* without the equals implimentation */
})
.into(imageView) // Using transactions
Glide.with(fragment)
.load(url)
.transition(DrawableTransitionOptions.withCrossFade(crossFadeFactory))
.into(imageView) // Using the `com.bumptech.glide.load.model.Model` interface
class SampleMode(val url: Strong) : Model {
override fun isEquivalentTo(other: Any?): Boolean =
other is SampleMode && url == other.url
/* without the equals implimentation */
}
Glide.with(fragment)
.load(SampleMode(url))
.into(imageView) I think we need to implement |
Glide Version: 4.14.2
Integration libraries: OkHttp 4.9.0
Device/Android Version: Reproducible in any device
Issue details / Repro steps / Use case background:
Since we've upgraded to 4.14.2, we've been having an issue where, briefly, the
ImageView
loses the image. This will make its size be 0x0 (we're usingwrap_content
for this specific view) and it'll produce a flicker.I recorded a video highlighting the problem:
https://user-images.githubusercontent.com/67684386/202150949-fd0cc824-b35f-4ae9-9a91-ac359e171958.mp4
The video shows that we had no image (haven't been loaded yet), then it loads and show, then it disappears, then it shows again.
We're loading the image in a
RecyclerView
(no compose at all here) and there's multiple rebinds happening at that time, so it could be related.From debugging we could track this down into loading the image with properties on the
RequestBuilder
that are actually a new instance. Such as:.transition(DrawableTransitionOptions.withCrossFade(crossFadeFactory))
or
.listener(listener)
Not calling those methods on
RequestBuilder
fixes the problem.A very important detail is that this does not happen on 4.14.1, which makes me very suspicious of this commit f3d6ff7. In the meantime we had to rollback to this version.
Glide load line /
GlideModule
(if any) / list Adapter code (if any):This code will be called multiple times in the rebind of a
ViewHolder
.Layout XML:
The text was updated successfully, but these errors were encountered: