[2.14.0][Fix]解决首次安装App时无法获得高德定位的问题

This commit is contained in:
chenfufeng
2023-02-22 21:30:42 +08:00
parent 662b082e30
commit 58641d0f3d
8 changed files with 158 additions and 30 deletions

View File

@@ -10,6 +10,7 @@ import androidx.annotation.RawRes;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.map.hdcache.IHdCacheListener;
import org.json.JSONObject;
@@ -343,6 +344,8 @@ public interface IMogoMapUIController {
void cacheHDDataByCity(IHdCacheListener listener);
void cacheHDDataByCity(IHdCacheListener listener, MogoLocation location);
/**
* 当前城市离线数据是否已缓存
* @return
@@ -350,4 +353,6 @@ public interface IMogoMapUIController {
boolean isCityDataCached();
void cancelDownloadCacheData();
String getCityCode();
}

View File

@@ -395,7 +395,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void setRomaMode(int mode) {
mMapView.getMapAutoViewHelper().setRoamStyle(mode,1800, MapAutoApi.ROAM_SPEED_40);
mMapView.getMapAutoViewHelper().setRoamStyle(mode, 1800, MapAutoApi.ROAM_SPEED_40);
}
@Override
@@ -448,7 +448,6 @@ public class AMapViewWrapper implements IMogoMapView,
}
/**
*
* @return true-是false=不是
*/
private boolean isVrMold() {
@@ -1219,6 +1218,44 @@ public class AMapViewWrapper implements IMogoMapView,
}
}
@Override
public void cacheHDDataByCity(IHdCacheListener listener, MogoLocation location) {
if (mMapView.getMapAutoViewHelper() != null) {
hdCacheListener = listener;
mMapView.getMapAutoViewHelper().cacheHDDataByCityByLonLat(location.getLongitude(), location.getLatitude(), new OnHdDataDownByCityListener() {
@Override
public void onMapHDDataCacheProgressByCity(int cityId, double progress) {
if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
if (hdCacheListener != null) {
hdCacheListener.onMapHdCacheProgress(cityId, progress * 100);
}
} else {
UiThreadHandler.post(() -> {
if (hdCacheListener != null) {
hdCacheListener.onMapHdCacheProgress(cityId, progress * 100);
}
});
}
}
@Override
public void onMapHDDataCacheStateByCity(int i, int state) {// 0失败1成功
if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
if (hdCacheListener != null) {
hdCacheListener.onMapHdCacheResult(i, state);
}
} else {
UiThreadHandler.post(() -> {
if (hdCacheListener != null) {
hdCacheListener.onMapHdCacheResult(i, state);
}
});
}
}
});
}
}
@Override
public boolean isCityDataCached() {
if (mMapView.getMapAutoViewHelper() != null) {
@@ -1244,4 +1281,9 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.getMapAutoViewHelper().cancelCacheHDData();
}
}
@Override
public String getCityCode() {
return GDLocationClient.getInstance(getContext()).getLastCityCode();
}
}

View File

@@ -7,6 +7,7 @@ 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.data.map.MogoLocation;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.hdcache.IHdCacheListener;
import com.mogo.map.uicontroller.CarCursorOption;
@@ -451,6 +452,13 @@ public class MogoMapUIController implements IMogoMapUIController {
}
}
@Override
public void cacheHDDataByCity(IHdCacheListener listener, MogoLocation location) {
if (mDelegate != null) {
mDelegate.cacheHDDataByCity(listener, location);
}
}
@Override
public boolean isCityDataCached() {
if (mDelegate != null) {
@@ -465,4 +473,12 @@ public class MogoMapUIController implements IMogoMapUIController {
mDelegate.cancelDownloadCacheData();
}
}
@Override
public String getCityCode() {
if (mDelegate != null) {
return mDelegate.getCityCode();
}
return null;
}
}

View File

@@ -8,6 +8,7 @@ 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.data.map.MogoLocation;
import com.mogo.map.hdcache.IHdCacheListener;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
@@ -384,6 +385,13 @@ public class AMapUIController implements IMogoMapUIController {
}
}
@Override
public void cacheHDDataByCity(IHdCacheListener listener, MogoLocation location) {
if (mClient != null) {
mClient.cacheHDDataByCity(listener, location);
}
}
@Override
public boolean isCityDataCached() {
if (mClient != null) {
@@ -398,4 +406,12 @@ public class AMapUIController implements IMogoMapUIController {
mClient.cancelDownloadCacheData();
}
}
@Override
public String getCityCode() {
if (mClient != null) {
return mClient.getCityCode();
}
return null;
}
}