Request: Provide way to download & cache images without assigning to views
Is it possible to provide a way to download & cache an image (either disk, memory, or both) without assigning the image to a view?
Use case example: We'd like to iterate through a list and call a method that downloads & caches an image from each item in the list. This is so the images are pre-cached and display quicker when scrolling for certain listviews within an app.
Currently images are only loaded when the cell becomes visible which at times can provide a slower than ideal experience especially when the network link is slow.
This would be handy
Sent from my iPhone
On Feb 10, 2016, at 5:14 PM, Aaron Hohns [email protected] wrote:
Is it possible to provide a way to download & cache an image (either disk, memory, or both) without assigning the image to a view?
Use case example: We'd like to iterate through a list and call a method that downloads & caches an image from each item in the list. This is so the images are pre-cached and display quicker when scrolling for certain listviews within an app.
Currently images are only loaded when the cell becomes visible which at times can provide a slower than ideal experience especially when the network link is slow.
— Reply to this email directly or view it on GitHub.
+1
+1
+1
I'd like to see this done too.
We could have some helper method to do that, but in my opinion, we also need to modify scheduler to support task priorities to avoid normal image loading tasks starvation.
@ahohns @highplains @dspacey89 @andrewSvsg @c1rus https://github.com/molinch/FFImageLoading/commit/74d161a5683bd9008aef8aa764eb9e8f7429f9a0 I added DownloadImageAndAddToDiskCache helper method for a start. What do you think? As always, some testing needed.
Is there a way to check if the image has already previously been downloaded first?
On Tue, Feb 23, 2016 at 1:19 PM, Daniel Luberda [email protected] wrote:
@ahohns https://github.com/ahohns @highplains https://github.com/highplains @dspacey89 https://github.com/dspacey89 @andrewSvsg https://github.com/andrewSvsg @c1rus https://github.com/c1rus 74d161a https://github.com/molinch/FFImageLoading/commit/74d161a5683bd9008aef8aa764eb9e8f7429f9a0 I added DownloadImageAndAddToDiskCache helper method for a start. What do you think?
— Reply to this email directly or view it on GitHub https://github.com/molinch/FFImageLoading/issues/143#issuecomment-187885857 .
Not currently, I could modify method to just download image if it's not in cache. What do you think?
Ya that could work, can you return a value from the function that indicates whether the image exists in the cache when the function exits?
@highplains Yes, I just commited that.
nice any way to get that into a RC on nuget?
On Tue, Feb 23, 2016 at 3:35 PM, Daniel Luberda [email protected] wrote:
@highplains https://github.com/highplains Yes, I just commited that changes.
— Reply to this email directly or view it on GitHub https://github.com/molinch/FFImageLoading/issues/143#issuecomment-187945428 .
RC2 nuget already released. Could you test it?
ya ill give it a go tomorrow for sure
On Tue, Feb 23, 2016 at 4:14 PM, Daniel Luberda [email protected] wrote:
RC2 nuget already released. Could you test it?
— Reply to this email directly or view it on GitHub https://github.com/molinch/FFImageLoading/issues/143#issuecomment-187958702 .
What does the lib do if I'm downloading the same images in the background that the user is requesting while scrolling? Just out of curiosity.
For now, prioritizing is not implemented (it's on a todo list), so basically it just runs those downloads simultaneously with "standard" image downloading tasks.
Did anyone test it?
Looking good so far!
@highplains Thanks for testing!
I want to modify that method, so the downloading would only work when no other image loading tasks are running. My idea is to:
- Modify
ITaskSchedulerso it would exposeHasPendingTasksproperty DownloadBytesAndCacheAsync(https://github.com/molinch/FFImageLoading/blob/master/source/FFImageLoading.Shared/ImageService.cs#L373) will not be called untilHasPendingTasks = false, wait otherwise.
What do you think about this approach? @molinch
In my app pictures are downloading frequently as the user scrolls, i would still like to be "pre-downloading" pictures later in the list while that is happening. Can you open it up as a options so we can choose?
On Fri, Mar 4, 2016 at 9:40 AM, Daniel Luberda [email protected] wrote:
@highplains https://github.com/highplains Thanks for testing!
I want to modify that method, so the downloading would only work when no other image loading tasks are running. My idea is to:
- Modify ITaskScheduler so it would expose HasPendingTasks property
- DownloadBytesAndCacheAsync ( https://github.com/molinch/FFImageLoading/blob/master/source/FFImageLoading.Shared/ImageService.cs#L373) will not be called until HasPendingTasks = false, wait otherwise.
What do you think about this approach? @molinch https://github.com/molinch
— Reply to this email directly or view it on GitHub https://github.com/molinch/FFImageLoading/issues/143#issuecomment-192348639 .