new#优化代码

This commit is contained in:
wujifei
2021-01-11 19:59:55 +08:00
parent 45c0577c8d
commit dc699423f7
2 changed files with 6 additions and 2 deletions

View File

@@ -147,7 +147,6 @@ public class V2XModuleProvider implements
// obu数据转发初始化
V2XObuManager.getInstance().init(context);
V2XServiceManager.getV2XRefreshModel().queryRoadData(Utils.getSn());
}
private void initBiz(Context context) {
@@ -159,6 +158,7 @@ public class V2XModuleProvider implements
// 查询ACC状态
SharedPrefsMgr.getInstance(V2XUtils.getApp()).putBoolean("descriptor_ACC_STATUS", isAccOn());
if (isAccOn()) {
V2XServiceManager.getV2XRefreshModel().queryRoadData(Utils.getSn());
// 记录开机时间
FatigueDrivingUtils.refreshAccOnTime();
// 刷新配置文件
@@ -321,6 +321,7 @@ public class V2XModuleProvider implements
// 记录开机时间
FatigueDrivingUtils.refreshAccOnTime();
initCarForHelpStatus();
V2XServiceManager.getV2XRefreshModel().queryRoadData(Utils.getSn());
} else {
// 记录关机时间
SharedPrefsMgr.getInstance(V2XUtils.getApp())

View File

@@ -52,6 +52,7 @@ import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import okhttp3.RequestBody;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
import static com.mogo.module.v2x.V2XServiceManager.getContext;
@@ -700,15 +701,17 @@ public class V2XRefreshModel {
@Override
public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) {
if (regeocodeResult == null || regeocodeResult.getRegeocodeAddress() == null) {
Logger.d("V2XRefreshModel", "返回地址为空");
return;
}
Logger.d("V2XRefreshModel", regeocodeResult.getRegeocodeAddress().toString());
try {
String province = regeocodeResult.getRegeocodeAddress().getProvince();
String city = regeocodeResult.getRegeocodeAddress().getCity();
v2XRoadDataRes.getResult().setFormatAddress(regeocodeResult.getRegeocodeAddress().getFormatAddress().replaceAll(province, "").replaceAll(city, ""));
sendBroadcast(v2XRoadDataRes);
} catch (Exception e) {
e.printStackTrace();
Logger.d("V2XRefreshModel", "异常:" + e);
}
}