glide icon indicating copy to clipboard operation
glide copied to clipboard

The same url but with different priority

Open vchernyshov opened this issue 3 years ago • 0 comments
trafficstars

Hi,

I need to preload a lot of images with different priorities. I'm doing it like this:

model.images.map { item ->
            val target = GlideApp.with(contextProvider.get())
                .load(imageMapper.map(model.settings, item.image))
                .priority(item.priority.toGlidePriority())
                .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
                .preload()
            target.request
        }.let { requests -> requestsCache.addAll(requests) }

In the same time app could try to load the same image because it was requested from UI:

GlideApp.with(to.context)
                .load(image.url)
                .priority(Priority.IMMEDIATE)
                .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
                .set(Downsampler.ALLOW_HARDWARE_CONFIG, allowHardwareImages)
                .into(to)

The question is what will be in this case with requests? Will UI request start other request or will it pick first?

vchernyshov avatar May 19 '22 09:05 vchernyshov