fix:
update:优化控制页面
This commit is contained in:
2022-11-17 09:37:42 +08:00
parent db3ee94ca2
commit 6f073ef28d
10 changed files with 468 additions and 354 deletions

View File

@@ -27,6 +27,7 @@ public class AmapManager {
private LocationClientOption mOption;
private BDLocation mLocation;
private CacheHelper mCacheHelper;
private MMKV mmkv = MMKV.defaultMMKV();
private static final String AMAPLOCATION_JSON_KEY = "MAPLOCATION_JSON_STRING";
public static final String LONGITUDE_KEY = "map_longitude_key";
@@ -74,7 +75,7 @@ public class AmapManager {
public BDLocation getNowMapLocation() {
if (mLocation == null) {
String aMapLocationjson = mCacheHelper.getAsString(AMAPLOCATION_JSON_KEY);
String aMapLocationjson = mmkv.decodeString(AMAPLOCATION_JSON_KEY);
if (TextUtils.isEmpty(aMapLocationjson)) {
return null;
}
@@ -147,7 +148,7 @@ public class AmapManager {
case BDLocation.TypeGpsLocation:// GPS定位结果
case BDLocation.TypeNetWorkLocation:// 网络定位结果
case BDLocation.TypeOffLineLocation:// 离线定位结果
mCacheHelper.put(AMAPLOCATION_JSON_KEY, GsonUtils.toJsonString(location));
mmkv.encode(AMAPLOCATION_JSON_KEY, GsonUtils.toJsonString(location));
Log.e(TAG, "onLocationChanged: " + "定位成功");
Log.e(TAG, "onLocationChanged: longitude = " + location.getLongitude());
Log.e(TAG, "onLocationChanged: latitude = " + location.getLatitude());