Closed MMarco94 closed 6 years ago
I think you're missing the diskCacheStrategy
in the loop. The logs say that it's using RESULT cache, I don't think that's what you want.
If these are the only Glide lines dealing with these images, then no-one will populate the RESULT cache (default) ever. Only the original and smallest images will be SOURCE cached. You have to specify the .diskCacheStrategy
for both read and write operations together.
Well, you're right, but unfortunately this doesn't solve the issue.
Further investigation revealed that the issue appears only if the scaleType of the image is matrix. This is still a problem since I need to use that scaleType.
Hmm, that's interesting because I don't see any transformations in the EngineKey
s. Try forcing .dontTransform()
on all loads, thumbnail or not. Since you're loading the nearest size, you'll probably hit the sizing near inSampleSize == 1
and any transformation would just slow loads down.
Using .dontTransform()
makes things worse since now it's not working for all scaleTypes.
Any chance the ImageView is circular or otherwise custom? Try .dontAnimate()
on all loads as well.
Using .dontAnimate()
doesn't have any effect on the issue: used in conjuncion with dontTransform
it doesn't work well with all scaleTypes, used alone is doesn't work with the matrix scaleType.
Out of reasonable ideas... try .fitCenter()
to force similar behavior to non-matrix. See GenericRequestBuilder.into(ImageView)
.
Can you please build a small repro app so I can try to debug (or you find the solution while building it ;)?
Ok, I'll do it tomorrow. Thanks for your help in the meantime
I just noticed something, though I don't know how that can mess things up: the outer load is Image
and the thumbs are all String
s/Uri
s. You could also try a getThumbnailLoader(context, image).into(imageView)
to get this difference out of the picture and use uniform models.
Calling getThumbnailLoader(context, image).into(imageView)
displays the image with lower resolution, but that's intended, since the lower resolution image is the only one that is downloaded (I've clear the data of the app before installing) since the other downloaders are using NetworkDisablingLoader.
Anyway, is there a better way to achieve what I'm trying to do? I'm starting to think that the nested thumbnailing is really heavy: for example, in the worst case in which all the images are saved on disk, the app will load all of them (if I understand correctly how Glide works).
This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.
Glide Version: 3.7.0
Integration libraries: No OkHttp3 nor Volley
Device/Android Version:OnePlus 3
Hi. I've got a list of different URLs for the same image, with different sizes. Using a custom BaseGlideUrlLoader, I'm loading the image which resolution is closer to the resolution of the ImageView. This works flawlessly.
However, I'm trying to achieve the following: I want to use as thumbnail whatever image I've got in RAM/disk. To do so I use the following code:
Basically, getThumbnailLoader builds a GenericRequestBuilder with the image in the highest resolution, which thumbnail is the second image with higher resolution and so on, until the smaller image.
However, using this code, it's always displayed the image in lower resolution, which is strange, since the url that my ImageGlideLoader returns is correct (it returns in fact the url which bet approximate the size of the ImageView). I've tried to simplify the code and use only the smaller image as thumbnail, without nesting, and it works, but I need to try to use all the sizes, since it's more likely to have a cache hit.
Is there a problem with nested thumbnails? Am I doing something wrong? I'm attaching the log that the library outputs during this process.
Stack trace / LogCat: