-
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
Pre Download the image and cache it with disklrucache #52
Comments
This would be a cool feature to have. |
It's actually possible to do this, just implement a nearly empty Target that returns the size of the image you want to download and pass that in as you would an image view or image view target. You can just leave onImageReady blank. This will cause the image to be downloaded and saved to the memory and disk caches. If you do that, feel free to create a pull request, or even use it to add prefetch() to Glide (in place of into() maybe). |
Nice job on the preloader. |
Is it possible to update de cached version with this request ? Let me explain the situation, we have a current cached version and it's needed to check if it is a new version. The idea is to update it when the new one is loaded without loosing the current image. |
great work on the preloader, also can this be worked the other way round as well ? like loading images which are only visible on the listview and cancelling/pausing all other requests. I think its possible if done with volley
|
Glide does cancel requests for you as you scroll. As long as you reuse views (use convertView in getView of your adapter or add a recycler listener and call Glide.cancel(imageView): http://developer.android.com/reference/android/widget/AbsListView.RecyclerListener.html), Glide will cancel loads for items that are no longer on screen. |
Going to close this for now, please reopen if you still need help or have a request! |
Hi, sjudd Is there any sample code for : "Just implement a nearly empty Target that returns the size of the image you want to download and pass that in as you would an image view or image view target. You can just leave onImageReadyBlank. This will cause the image to be downloaded and saved to the memory and disk caches." ? I couldn't find any code doing the same in the github repo, please be kind enough to point me to it, if it exists. Also for such a case will the RequestListener work ? |
Try Request listener should still be called as usual. |
@varunmaini you can also check out the flickr sample app, which uses preloaders: https://github.com/bumptech/glide/blob/master/samples/flickr/src/main/java/com/bumptech/glide/samples/flickr/FlickrPhotoGrid.java |
Thanks TWiStErRob and sjudd. I referred the above sample & SimpleTarget and managed to get a working code snippet. Thanks a lot for the prompt replies. |
Currently we either need to pass an ImageView and ImageViewTarget both requires imageviews, can`t we just download the image on background without having to display it on UI ?
The text was updated successfully, but these errors were encountered: