@@ -88,7 +88,6 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
8888
8989 private var storedMapType: Int = options.mapType
9090 val waitingCameraUpdates = mutableListOf<CameraUpdate >()
91- private val controlLayerRun = Runnable { refreshContainerLayer(false ) }
9291
9392 private var markerId = 0L
9493 val markers = mutableMapOf<String , MarkerImpl >()
@@ -573,11 +572,11 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
573572 it.setOnCameraMoveListener {
574573 try {
575574 Log .d(TAG , " setOnCameraMoveListener: " )
576- view.removeCallbacks(controlLayerRun)
577- refreshContainerLayer(true )
575+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
576+ mapView?.let { it.parent?.onDescendantInvalidated(it, it) }
577+ }
578578 cameraMoveListener?.onCameraMove()
579579 cameraChangeListener?.onCameraChange(map?.cameraPosition?.toGms())
580- view.postDelayed(controlLayerRun, 200 )
581580 } catch (e: Exception ) {
582581 Log .w(TAG , e)
583582 }
@@ -770,7 +769,6 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
770769 markers.map { it.value.remove() }
771770 markers.clear()
772771// BitmapDescriptorFactoryImpl.unregisterMap(map)
773- view.removeCallbacks(controlLayerRun)
774772 view.removeView(mapView)
775773 // TODO can crash?
776774 mapView?.onDestroy()
@@ -863,27 +861,6 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
863861 }
864862 }
865863
866- private fun refreshContainerLayer (hide : Boolean = false) {
867- runCatching {
868- if (mapView == null ) return
869- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
870- view.onDescendantInvalidated(mapView!! , mapView!! )
871- }
872- val parentView = view.parent?.parent
873- if (parentView != null ) {
874- if (parentView is ViewGroup ) {
875- for (i in 0 until parentView.childCount) {
876- val viewChild = parentView.getChildAt(i)
877- // Uber is prone to route drift, so here we hide the corresponding layer
878- if (viewChild::class .qualifiedName?.startsWith(" com.ubercab" ) == true ) {
879- viewChild.visibility = if (hide) View .INVISIBLE else View .VISIBLE
880- }
881- }
882- }
883- }
884- }
885- }
886-
887864 override fun onTransact (code : Int , data : Parcel , reply : Parcel ? , flags : Int ): Boolean =
888865 if (super .onTransact(code, data, reply, flags)) {
889866 Log .d(TAG , " onTransact: $code , $data , $flags " )
0 commit comments