Skip to content

Callbacks do not work when both setLowResImageRequest and setImageRequest are used #2497

@jokermonn

Description

@jokermonn

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions