facebook/fresco

Not load image from url in custom InfoWindow on Google Maps

Open

#2373 aperta il 8 lug 2019

Vedi su GitHub
 (7 commenti) (1 reazione) (0 assegnatari)Java (3750 fork)batch import
enhancementgood first issuehelp wanted

Metriche repository

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

Descrizione

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? :'(

Guida contributor