facebook/fresco

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

Open

#2497 aperta il 6 mag 2020

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)Java (3750 fork)batch import
buggood first issuehelp wanted

Metriche repository

Star
 (17.072 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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

Guida contributor