Not load image from url in custom InfoWindow on Google Maps
#2,373 opened on 2019年7月8日
説明
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? :'(