[2.15.0][Fix]解决首次安装App时无法获得高德定位导致的高精地图缓存问题

This commit is contained in:
chenfufeng
2023-02-22 21:30:42 +08:00
parent 3dd02556bf
commit 96e848bbb0
8 changed files with 132 additions and 5 deletions

View File

@@ -1086,6 +1086,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) {
@@ -1111,4 +1149,9 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.getMapAutoViewHelper().cancelCacheHDData();
}
}
@Override
public String getCityCode() {
return GDLocationClient.getInstance(getContext()).getLastCityCode();
}
}

View File

@@ -468,6 +468,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) {
@@ -482,4 +489,12 @@ public class MogoMapUIController implements IMogoMapUIController {
mDelegate.cancelDownloadCacheData();
}
}
@Override
public String getCityCode() {
if (mDelegate != null) {
return mDelegate.getCityCode();
}
return null;
}
}

View File

@@ -406,6 +406,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) {
@@ -420,4 +427,12 @@ public class AMapUIController implements IMogoMapUIController {
mClient.cancelDownloadCacheData();
}
}
@Override
public String getCityCode() {
if (mClient != null) {
return mClient.getCityCode();
}
return null;
}
}