[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();
}
}