[dev_arch_opt_3.0][fix]修正因位置回调重构造成的v2x事件不显示问题

This commit is contained in:
renwj
2023-01-30 19:11:06 +08:00
parent 0b84b3855e
commit 2baf4aa785
9 changed files with 66 additions and 219 deletions

View File

@@ -121,10 +121,6 @@ public class AMapViewWrapper implements IMogoMapView,
private boolean mIsFirstLocated = true;
private boolean mIsDelayed = false;
// GPS 位置回调
private final LocationListener mGpsLocationListener =
location -> CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(ObjectUtils.fromLocation(location), 0, true);
public AMapViewWrapper(MapAutoView mMapView) {
CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--AMapViewWrapper: init");
this.mMapView = mMapView;
@@ -189,7 +185,6 @@ public class AMapViewWrapper implements IMogoMapView,
LocationClient client = mMapView.getLocationClient();
if (client != null) {
client.registerListener(this);
client.registerGpsListener(mGpsLocationListener);
}
mMapView.registerListener(this, MapAutoApi.LISTENER_TYPE_ZOOM);
mMapView.registerListener(this, MapAutoApi.LISTENER_TYPE_ROTATE);
@@ -704,45 +699,12 @@ public class AMapViewWrapper implements IMogoMapView,
CallerMapDevaListenerManager.INSTANCE.invokeUploadLogFile(filePath);
}
// TODO 这里需要数据中心代理
// private static class LocationTask implements Runnable {
//
// private MogoLocation location;
//
// public void setMoGoLocation(MogoLocation location) {
// this.location = location;
// }
//
// @Override
// public void run() {
// if (location != null) {
// CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(location, 1, false);
// location = null;
// }
// }
// }
// private volatile LocationTask mLocationTask;
// private final Handler mainHandler = new Handler(Looper.getMainLooper());
@Override
public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location) {
// MogoLocation currentLocation = ObjectUtils.fromLocation(location);
// if (Looper.myLooper() == Looper.getMainLooper()) {
// CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(currentLocation, 1, false);
// } else {
// if (mLocationTask == null) {
// mLocationTask = new LocationTask();
// }
// mLocationTask.setMoGoLocation(currentLocation);
// mainHandler.removeCallbacks(mLocationTask);
// mainHandler.post(mLocationTask);
// }
CallerMapLocationListenerManager.INSTANCE.setCurrentLocation(ObjectUtils.fromLocation(location));
// 将有效经纬度暂存本地提供给下一次的Http-DNS使用防止首次请求位置获取不到
if (location.getLat() > 0 && location.getLon() > 0) {
if (location.getCityCode() != null && !location.getCityCode().isEmpty()) {
if (location.getCityCode() != null && !location.getCityCode().isEmpty()) {
SharedPrefsMgr.getInstance(mMapView.getContext())
.putString(SharedPrefsConstants.LOCATION_CITY_CODE, location.getCityCode());
}
@@ -752,20 +714,6 @@ public class AMapViewWrapper implements IMogoMapView,
.putString(SharedPrefsConstants.LOCATION_LONGITUDE, String.valueOf(location.getLon()));
}
// // 同步给各个模块
// Location sysLocation = new Location(location.getProvider());
// sysLocation.setAltitude(location.getAltitude());
// sysLocation.setLatitude(location.getLat());
// sysLocation.setLongitude(location.getLon());
// sysLocation.setProvider(location.getProvider());
// sysLocation.setAccuracy(location.getAcceleration());
// sysLocation.setTime(location.duration);
// sysLocation.setBearing((float) location.getHeading());
// sysLocation.setSpeed(location.getSpeed());
// if (MogoCarLocationChangedListenerRegister.getInstance().getListener() != null) {
// MogoCarLocationChangedListenerRegister.getInstance().getListener().onCarLocationChanged2(sysLocation);
// }
if (checkAMapView() && mMapLoaded) {
// 地图初始化完成后每隔5s自动判断当前地图的模式
if (mIsFirstLocated) {