[6.7.0][HDMap][Overlay] 优化地图marker的处理逻辑;当地图控件从窗口中移除时,断开Java层与Marker之间的引用,规避内存泄露
This commit is contained in:
@@ -77,4 +77,6 @@ interface IMoGoOverlayManager {
|
||||
fun hideAllPointsExceptOwners(vararg owners: String)
|
||||
|
||||
fun updateAnimPoint(options: Point.Options, mapTag:String = DEFAULT)
|
||||
|
||||
fun clear()
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.Carmodel.T2
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.zhidaoauto.map.sdk.inner.abs.IMapController
|
||||
import com.zhidaoauto.map.sdk.inner.abs.IMarkerController
|
||||
@@ -37,4 +38,16 @@ class MoGoAutoView: MapAutoView {
|
||||
return controller.addSelfCar(markerOptions)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
Logger.d(TAG, "-- onAttachedToWindow --")
|
||||
CallerMapUIServiceManager.getOverlayManager()?.clear()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
Logger.d(TAG, "-- onDetachedFromWindow --")
|
||||
CallerMapUIServiceManager.getOverlayManager()?.clear()
|
||||
}
|
||||
}
|
||||
@@ -458,4 +458,13 @@ internal class MoGoOverlayManagerImpl: IMoGoOverlayManager {
|
||||
override fun updateAnimPoint(options: Options, mapTag:String) {
|
||||
mapInstance.getMogoMap(mapTag)?.addAnimPoint(options)
|
||||
}
|
||||
|
||||
override fun clear() {
|
||||
synchronized(points) {
|
||||
points.clear()
|
||||
}
|
||||
synchronized(lines) {
|
||||
lines.clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user