fresco icon indicating copy to clipboard operation
fresco copied to clipboard

Allow image loading to be paused on scroll

Open JiangDaYa0 opened this issue 11 years ago • 12 comments

I want to pause loading on scoll

JiangDaYa0 avatar Aug 04 '15 09:08 JiangDaYa0

Can you give us more context on why would you want to do that?

plamenko avatar Aug 05 '15 11:08 plamenko

save 4G flow.

JiangDaYa0 avatar Aug 07 '15 09:08 JiangDaYa0

By "flow" do you mean "data usage"?

plamenko avatar Aug 07 '15 15:08 plamenko

yup!

JiangDaYa0 avatar Aug 13 '15 05:08 JiangDaYa0

I would be interested in this feature too.Something like how UIL does it.

notsatyarth avatar Aug 14 '15 06:08 notsatyarth

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

michalgr avatar Aug 14 '15 10:08 michalgr

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?

notsatyarth avatar Sep 30 '15 13:09 notsatyarth

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

IanChilds avatar Sep 30 '15 13:09 IanChilds

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?

notsatyarth avatar Feb 04 '16 07:02 notsatyarth

bump

notsatyarth avatar Mar 28 '16 10:03 notsatyarth

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

notsatyarth avatar Mar 28 '16 11:03 notsatyarth

I'm closing this since this should be possible with resume() and pause() as stated above.

oprisnik avatar Jan 19 '18 14:01 oprisnik