facebook/fresco

Not load image from url in custom InfoWindow on Google Maps

Open

#2,373 opened on Jul 8, 2019

View on GitHub
 (7 comments) (1 reaction) (0 assignees)Java (17,072 stars) (3,750 forks)batch import
enhancementgood first issuehelp wanted

Description

Description

I'm using a custom InfoWindow and clustering its markers on google maps and I have to show an image from an Url using SimpleDraweeView when the InfoWindow appears but it didn't work.

I've tried:

class CustomInfoWindow(private val context: Activity) : GoogleMap.InfoWindowAdapter {
    
  override fun getInfoContents(p0: Marker?): View {
        val mInfoView = context.layoutInflater.inflate(R.layout.view_custom_info_window, null)
        val data = p0?.tag as Data
        mInfoView.sdvImage.setImageURI(data.imageURL)

        return mInfoView
    }

...

}
class CustomInfoWindow(private val context: Activity) : GoogleMap.InfoWindowAdapter {

    override fun getInfoContents(p0: Marker?): View {
        val mInfoView = context.layoutInflater.inflate(R.layout.view_custom_info_window, null)
        val data = p0?.tag as Data

        // Build control listener for marker images
        val controllerListener = object : BaseControllerListener<ImageInfo>() {
            fun onFinalImageSet(id: String, @Nullable imageInfo: ImageInfo, @Nullable anim: Animatable) {
                if (marker.isInfoWindowShown) {
                    marker.hideInfoWindow()
                    marker.showInfoWindow()
                }
            }
        }

        val controller = Fresco.newDraweeControllerBuilder()
            .setControllerListener(controllerListener)
            .setUri(data.imageURL)
            .build()

       mInfoView. sdvImage.controller = controller

        return mInfoView
    }

    override fun getInfoWindow(p0: Marker?): View? {
        return null
    }
  • Fresco version: 2.0.0
  • Platform version: Android

UPDATE

Testing on Huawei P30 (Android 9 - EMUI 9.1.0), Huawei Mate 20 (Android 9) and Nokia 3 (Android 8) doesn't work, but on Moto C Plus (Android 7) works partially because it doesn't do "As Circle", but it shows the correct image

UPDATE 2 When open an InfoWindow with both code the logs are

V/unknown:AbstractDraweeController: controller 2eaab39 null -> null: initialize V/unknown:AbstractDraweeController: controller 2eaab39 null -> 69: initialize V/unknown:AbstractDraweeController: controller 2eaab39 69: setHierarchy: com.facebook.drawee.generic.GenericDraweeHierarchy@52c757e

Anyone? :'(

Contributor guide