[2.13.0-arch-opt] merge
This commit is contained in:
@@ -46,7 +46,6 @@ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
@@ -330,9 +329,9 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, "map onDestroy");
|
||||
}
|
||||
|
||||
if (mLocationTask != null) {
|
||||
mainHandler.removeCallbacks(mLocationTask);
|
||||
}
|
||||
// if (mLocationTask != null) {
|
||||
// mainHandler.removeCallbacks(mLocationTask);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -706,40 +705,40 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
CallerMapDevaListenerManager.INSTANCE.invokeUploadLogFile(filePath);
|
||||
}
|
||||
|
||||
private static class LocationTask implements Runnable {
|
||||
// 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 MogoLocation location;
|
||||
// private volatile LocationTask mLocationTask;
|
||||
|
||||
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());
|
||||
// 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);
|
||||
}
|
||||
// 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);
|
||||
// }
|
||||
|
||||
// 将有效经纬度暂存本地,提供给下一次的Http-DNS使用,防止首次请求位置获取不到
|
||||
if (location.getLat() > 0 && location.getLon() > 0) {
|
||||
@@ -753,20 +752,20 @@ 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());
|
||||
// // 同步给各个模块
|
||||
// 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 (MogoCarLocationChangedListenerRegister.getInstance().getListener() != null) {
|
||||
// MogoCarLocationChangedListenerRegister.getInstance().getListener().onCarLocationChanged2(sysLocation);
|
||||
// }
|
||||
if (checkAMapView() && mMapLoaded) {
|
||||
// 地图初始化完成后,每隔5s自动判断当前地图的模式
|
||||
if (mIsFirstLocated) {
|
||||
|
||||
@@ -3,14 +3,12 @@ package com.mogo.map;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
@@ -40,6 +38,12 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
initDelegate();
|
||||
}
|
||||
|
||||
private void initDelegate() {
|
||||
if (mDelegate == null) {
|
||||
mDelegate = MogoMapDelegateFactory.getMapUIControllerDelegate();
|
||||
}
|
||||
}
|
||||
|
||||
public static MogoMapUIController getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (MogoMapUIController.class) {
|
||||
@@ -51,10 +55,6 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void setDelegate(IMogoMapUIController mDelegate) {
|
||||
this.mDelegate = mDelegate;
|
||||
}
|
||||
|
||||
public static synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
@@ -347,14 +347,6 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
mDelegate = null;
|
||||
}
|
||||
|
||||
private void initDelegate() {
|
||||
if (mDelegate == null) {
|
||||
mDelegate = MogoMapDelegateFactory.getMapUIControllerDelegate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void stepInVrMode(boolean isDayMode) {
|
||||
initDelegate();
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.constants.SharedPrefsConstants;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
|
||||
public class GDLocationClient implements AMapLocationListener {
|
||||
public class GDLocationClient implements AMapLocationListener,IMogoGDLocationClient {
|
||||
|
||||
private volatile static GDLocationClient gdLocationClient;
|
||||
private static final byte[] obj = new byte[0];
|
||||
@@ -52,12 +52,20 @@ public class GDLocationClient implements AMapLocationListener {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if (mLocationClient != null) {
|
||||
mLocationClient.startLocation();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if (mLocationClient != null) {
|
||||
mLocationClient.stopLocation();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(AMapLocation aMapLocation) {
|
||||
if (aMapLocation != null) {
|
||||
@@ -70,6 +78,7 @@ public class GDLocationClient implements AMapLocationListener {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLastCityCode() {
|
||||
return mCityCode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user