Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
HmsMap: Remove code that affects the experience
  • Loading branch information
DaVinci9196 committed Mar 19, 2025
commit 4e877347c7b5305b3edb86660333db9d98531f31
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)

private var storedMapType: Int = options.mapType
val waitingCameraUpdates = mutableListOf<CameraUpdate>()
private val controlLayerRun = Runnable { refreshContainerLayer(false) }

private var markerId = 0L
val markers = mutableMapOf<String, MarkerImpl>()
Expand Down Expand Up @@ -573,11 +572,11 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
it.setOnCameraMoveListener {
try {
Log.d(TAG, "setOnCameraMoveListener: ")
view.removeCallbacks(controlLayerRun)
refreshContainerLayer(true)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mapView?.let { it.parent?.onDescendantInvalidated(it, it) }
}
cameraMoveListener?.onCameraMove()
cameraChangeListener?.onCameraChange(map?.cameraPosition?.toGms())
view.postDelayed(controlLayerRun, 200)
} catch (e: Exception) {
Log.w(TAG, e)
}
Expand Down Expand Up @@ -770,7 +769,6 @@ 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 @@ -863,27 +861,6 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
}
}

private fun refreshContainerLayer(hide: Boolean = false) {
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
}
}
}
}
}
}

override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean =
if (super.onTransact(code, data, reply, flags)) {
Log.d(TAG, "onTransact: $code, $data, $flags")
Expand Down