Skip to content

Commit

Permalink
fixed microg#2743 crash
Browse files Browse the repository at this point in the history
  • Loading branch information
DaVinci9196 committed Jan 15, 2025
1 parent da80a75 commit a3816df
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
markers.map { it.value.remove() }
markers.clear()
// BitmapDescriptorFactoryImpl.unregisterMap(map)
view.removeCallbacks(controlLayerRun)
view.removeView(mapView)
// TODO can crash?
mapView?.onDestroy()
Expand Down Expand Up @@ -798,17 +799,20 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
}

private fun refreshContainerLayer(hide: Boolean = false) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
view.onDescendantInvalidated(mapView!!, mapView!!)
}
val parentView = view.parent?.parent
if (parentView != null) {
if (parentView is ViewGroup) {
for (i in 0 until parentView.childCount) {
val viewChild = parentView.getChildAt(i)
// Uber is prone to route drift, so here we hide the corresponding layer
if (viewChild::class.qualifiedName?.startsWith("com.ubercab") == true) {
viewChild.visibility = if (hide) View.INVISIBLE else View.VISIBLE
runCatching {
if (mapView == null) return
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
view.onDescendantInvalidated(mapView!!, mapView!!)
}
val parentView = view.parent?.parent
if (parentView != null) {
if (parentView is ViewGroup) {
for (i in 0 until parentView.childCount) {
val viewChild = parentView.getChildAt(i)
// Uber is prone to route drift, so here we hide the corresponding layer
if (viewChild::class.qualifiedName?.startsWith("com.ubercab") == true) {
viewChild.visibility = if (hide) View.INVISIBLE else View.VISIBLE
}
}
}
}
Expand Down

0 comments on commit a3816df

Please sign in to comment.