facebook/fresco

Callbacks do not work when both `setLowResImageRequest` and `setImageRequest` are used

Open

#2,497 opened on May 6, 2020

View on GitHub
 (4 comments) (0 reactions) (0 assignees)Java (3,750 forks)batch import
buggood first issuehelp wanted

Repository metrics

Stars
 (17,072 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

val normalUriString = "https://www.google.com.hk/logos/doodles/2020/stay-and-play-at-home-with-popular-past-google-doodles-halloween-2016-6753651837108773-s.png"
val 404UriString = "https://www.google.com.hk/404"

vImage.controller = Fresco.newDraweeControllerBuilder()
     .setLowResImageRequest(ImageRequest.fromUri(Uri.parse(normalUriString)))
     .setImageRequest(ImageRequest.fromUri(Uri.parse(404UriString)))
     .setControllerListener(object : BaseControllerListener<ImageInfo>() {
         override fun onFailure(id: String?, throwable: Throwable?) {
             Log.e("TAG", "onFailure")
         }

         override fun onIntermediateImageSet(id: String?, imageInfo: ImageInfo?) {
             Log.e("TAG", "onIntermediateImageSet")
         }

         override fun onFinalImageSet(id: String?, imageInfo: ImageInfo?, animatable: Animatable?) {
             Log.e("TAG", "onFinalImageSet")
         }
     })
     .setOldController(vImage.controller)
     .build()

fun clearCache() {
     Fresco.getImagePipeline().clearCaches()
}

expect:

E/TAG: onIntermediateImageSet
E/TAG: onFailure

actually: It works the first time, but after calling clearCache a few times(call several times), It doesn't work:

E/TAG: onFinalImageSet

Reproduction

As shown above

Contributor guide