[6.2.4] fix bug of sound play helper , devices extends lenovo , npl of map init

This commit is contained in:
zhongchao
2023-12-18 12:01:23 +08:00
parent e60d0bfe38
commit 2d7d9ea25a
7 changed files with 44 additions and 12 deletions

View File

@@ -36,12 +36,12 @@ class MogoMap private constructor() {
/**
* 业务使用时根据地图是否加载来判定 是否获取IMogoMap实例
*/
fun getMogoMap(instance: String = DEFAULT): IMogoMap {
fun getMogoMap(instance: String = DEFAULT): IMogoMap? {
return if (mapCache[instance] == null) {
CallerLogger.e("$M_MAP$TAG", "getMogoMap func has error with no instance in mapCache")
mapCache[DEFAULT]!!
mapCache[DEFAULT]
} else {
mapCache[instance]!!
mapCache[instance]
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.map.identify;
import com.mogo.map.IMogoMap;
import com.mogo.map.MogoMap;
import com.mogo.map.identity.IMogoIdentifyManager;
import java.util.HashMap;
@@ -32,7 +33,10 @@ public class MogoIdentifyManager implements IMogoIdentifyManager {
@Override
public void removeMarker(String uuidString) {
try {
MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT).removeMarker(uuidString);
IMogoMap iMogoMap = MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT);
if(iMogoMap != null){
iMogoMap.removeMarker(uuidString);
}
} catch (Exception e) {
e.printStackTrace();
}
@@ -44,7 +48,10 @@ public class MogoIdentifyManager implements IMogoIdentifyManager {
@Override
public void updateBatchMarkerPosition(HashMap<String, MessagePad.TrackedObject> optionsArrayList) {
try {
MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT).updateBatchMarkerPosition(optionsArrayList);
IMogoMap iMogoMap = MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT);
if(iMogoMap != null){
iMogoMap.updateBatchMarkerPosition(optionsArrayList);
}
} catch (Exception e) {
e.printStackTrace();
}
@@ -53,7 +60,10 @@ public class MogoIdentifyManager implements IMogoIdentifyManager {
@Override
public void updateBatchAiMarkerPosition(HashMap<String, SocketDownData.CloudRoadDataProto> optionsArrayList) {
try {
MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT).updateBatchAiMarkerPosition(optionsArrayList);
IMogoMap iMogoMap = MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT);
if(iMogoMap != null){
iMogoMap.updateBatchAiMarkerPosition(optionsArrayList);
}
} catch (Exception e) {
e.printStackTrace();
}

View File

@@ -28,7 +28,7 @@ internal class MoGoOverlayManagerImpl: IMoGoOverlayManager {
point.setOptions(options)
return key
} else {
val p = mapInstance.getMogoMap(mapTag).addPoint(options)
val p = mapInstance.getMogoMap(mapTag)?.addPoint(options)
if (p != null) {
p.onRemove { removed ->
val keys = points.filterKeys { it.id == removed }
@@ -232,7 +232,7 @@ internal class MoGoOverlayManagerImpl: IMoGoOverlayManager {
line.setOptions(options)
return key
} else {
val newLine = mapInstance.getMogoMap(mapTag).addLine(options)
val newLine = mapInstance.getMogoMap(mapTag)?.addLine(options)
if (newLine != null) {
newLine.onRemove { removed ->
val keys = lines.filterKeys { it.id == removed }
@@ -259,7 +259,7 @@ internal class MoGoOverlayManagerImpl: IMoGoOverlayManager {
private fun moveToCenter(mapTag:String, id: String, eventLon: Double, eventLat: Double, carLon: Double, carLat: Double) {
try {
mapInstance.getMogoMap(mapTag).uiController?.showBounds(
mapInstance.getMogoMap(mapTag)?.uiController?.showBounds(
id,
MogoLatLng(carLat, carLon),
listOf(MogoLatLng(eventLat, eventLon)),