subsampling-scale-image-view icon indicating copy to clipboard operation
subsampling-scale-image-view copied to clipboard

AsyncTask is unsuitable and it would produce bug

Open xyato opened this issue 5 years ago • 1 comments

There are some AsyncTasks In SubsamplingScaleImageView.java,and all tasks in background are not controlled, you can reproduce an bug by the following code snippet, eg.

scaleImageView.setImage(imageSource1); // the imageSource1 will take 30s to show completely scaleImageView.setImage(imageSource2); // this imageSource2 will take 2s to show completely

we expect to see imageSource2, but imageSource1 will be shown after 30s.

I suggest using rxjava instead of AsyncTask

xyato avatar Jul 22 '20 11:07 xyato

I believe this can also be fixed by holding a set of ongoing AsyncTasks and cancelling all of them in methods like setImage() and recycle().

MaxPoon avatar Feb 27 '21 04:02 MaxPoon