Allow image loading to be paused on scroll
I want to pause loading on scoll
Can you give us more context on why would you want to do that?
save 4G flow.
By "flow" do you mean "data usage"?
yup!
I would be interested in this feature too.Something like how UIL does it.
I think the easiest way to achieve this at the moment would be to add request queueing in ThreadHandoffProducer.
Right now Fresco first looks up if the image is available immediately in Bitmap cache. If it misses then execution gets to ThreadHandoffProducer which moves execution of the image request from UI thread to background thread. We could have additional check there to see if image loading is paused or not and depending on that resume request immediately or queue it for execution later.
I am happy to provide more directions.
https://github.com/facebook/fresco/blob/master/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/ThreadHandoffProducer.java
Sorry for the late reply.But I think Fresco also determines if a view is visible in order to download an image. Can you point me to that piece of the source code?
This is the code that ends up kicking off the downloads (and cancelling them): https://github.com/facebook/fresco/blob/master/drawee/src/main/java/com/facebook/drawee/view/DraweeView.java#L101:L124
Hi, I finally got to this task now and would need some help if you could provide me a bit of detail.
The required behaviour is:
When a Recycler/List View is being flung you want to pause the image loading The image-requests obtained in this duration should be queued with a lesser priority
When a RecyclerView is Settling/Idle ,the image loading would be resumed: The image-requests obtained now would have to be given priority in the request queue.
Current behaviour is:the requests get queued unconditionally,which leads to a bad UX.
Any thoughts on how this behaviour could be achieved?
bump
Just realized that this feature has been implemented in c3253ba2367fd3c956e2877a9aa528e66092836c
Fresco.getImagePipeline().resume() and Fresco.getImagePipeline().pause() from https://github.com/facebook/fresco/issues/356#issuecomment-199776583
I'm closing this since this should be possible with resume() and pause() as stated above.