From f0381c297aca5101e827e64afdcce39ac9113a0c Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Mon, 22 Feb 2021 14:03:08 +0800 Subject: [PATCH 1/5] opt package dep --- .../com/mogo/commons/debug/DebugConfig.java | 2 +- .../module/common/map/MyLocationUtil.java | 13 +++++ .../com/mogo/module/common/utils/SPConst.java | 4 +- .../extensions/userinfo/CarModelListInfo.java | 47 ------------------- .../userinfo/CarModelListResponse.java | 32 ------------- services/mogo-service-api/build.gradle | 2 + .../adas/entity}/CarModelListInfo.java | 4 +- .../adas/entity}/CarModelListResponse.java | 2 +- .../adas}/entity/OwnCarModelEntity.java | 2 +- services/mogo-service/build.gradle | 3 -- .../impl/adas/CarModelInfoNetApiServices.java | 3 +- .../service/impl/adas/MogoADASController.java | 27 +++++------ .../impl/singleton/SingletonsHolder.java | 2 + 13 files changed, 39 insertions(+), 104 deletions(-) delete mode 100644 modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/userinfo/CarModelListInfo.java delete mode 100644 modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/userinfo/CarModelListResponse.java rename services/{mogo-service/src/main/java/com/mogo/service/impl/adas => mogo-service-api/src/main/java/com/mogo/service/adas/entity}/CarModelListInfo.java (91%) rename services/{mogo-service/src/main/java/com/mogo/service/impl/adas => mogo-service-api/src/main/java/com/mogo/service/adas/entity}/CarModelListResponse.java (94%) rename {modules/mogo-module-common/src/main/java/com/mogo/module/common => services/mogo-service-api/src/main/java/com/mogo/service/adas}/entity/OwnCarModelEntity.java (96%) diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java index e4d32ec638..12d823c3e1 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java @@ -267,7 +267,7 @@ public class DebugConfig { return sLoadGuideModule; } - private static String SP_GUIDE = "SP_GUIDE_2020_09_09"; + public static String SP_GUIDE = "SP_GUIDE_2020_09_09"; public static String getSpGuide() { return SP_GUIDE; diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MyLocationUtil.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MyLocationUtil.java index 6f766975cd..2070c445f7 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MyLocationUtil.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MyLocationUtil.java @@ -16,9 +16,11 @@ import androidx.annotation.Nullable; import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.target.SimpleTarget; import com.bumptech.glide.request.transition.Transition; +import com.mogo.commons.context.ContextHolderUtil; import com.mogo.map.uicontroller.CarCursorOption; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.R; +import com.mogo.service.datamanager.IMogoDataChangedListener; import com.mogo.utils.UiThreadHandler; import com.mogo.utils.ViewUtils; import com.mogo.utils.glide.GlideApp; @@ -34,6 +36,17 @@ public class MyLocationUtil { private static boolean isLoadingIcon = false; private static boolean needEmphasizeMyLocation = false; + static { + MogoApisHandler.getInstance().getApis().getDataManagerApi() + .registerDataListener( "ADAS", data ->{ + if ( data == null ) { + emphasizeMyLocation(); + } else if( data instanceof String ){ + setMyLocationIconUrl( ContextHolderUtil.getContext(), ( ( String ) data )); + } + } ); + } + public static void emphasizeMyLocation(){ if (!isLoadingIcon) { MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().emphasizeMyLocation(); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/SPConst.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/SPConst.java index 36ed5551d0..f20e587a51 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/SPConst.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/SPConst.java @@ -1,11 +1,13 @@ package com.mogo.module.common.utils; +import com.mogo.commons.debug.DebugConfig; + /** * 多模块之间SP状态公共类 */ public class SPConst { - private static String SP_GUIDE = "SP_GUIDE_2020_09_09"; + private static String SP_GUIDE = DebugConfig.SP_GUIDE; //用于多模块之间引导状态判断 public static String getSpGuide() { diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/userinfo/CarModelListInfo.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/userinfo/CarModelListInfo.java deleted file mode 100644 index 109850fae3..0000000000 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/userinfo/CarModelListInfo.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.mogo.module.extensions.userinfo; - -import com.mogo.module.common.entity.OwnCarModelEntity; - -import java.util.List; - -public class CarModelListInfo { - private String sn; - /** - * 热心指数 eg: 1 1.5 2 2.5 - */ - private float enthusiasmIndex; - private List imageData; - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public float getEnthusiasmIndex() { - return enthusiasmIndex; - } - - public void setEnthusiasmIndex(float enthusiasmIndex) { - this.enthusiasmIndex = enthusiasmIndex; - } - - public List getImageData() { - return imageData; - } - - public void setImageData(List imageData) { - this.imageData = imageData; - } - - @Override - public String toString() { - return "CarModelListInfo{" + - "sn='" + sn + '\'' + - ", enthusiasmIndex=" + enthusiasmIndex + - ", imageData=" + imageData + - '}'; - } -} diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/userinfo/CarModelListResponse.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/userinfo/CarModelListResponse.java deleted file mode 100644 index ef5e78f3d6..0000000000 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/userinfo/CarModelListResponse.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.mogo.module.extensions.userinfo; - -import com.mogo.commons.data.BaseData; -import com.mogo.module.common.entity.OwnCarModelEntity; - -import java.util.List; - -/** - * 请求根据热心指数获取自车图标列表的响应类 - * - * @author tongchenfei - */ -public class CarModelListResponse extends BaseData { - private CarModelListInfo result; - - public CarModelListInfo getResult() { - return result; - } - - public void setResult(CarModelListInfo result) { - this.result = result; - } - - @Override - public String toString() { - return "CarModelListResponse{" + - "result=" + result + - ", code=" + code + - ", msg='" + msg + '\'' + - '}'; - } -} diff --git a/services/mogo-service-api/build.gradle b/services/mogo-service-api/build.gradle index 5b85a74290..074c7bcd16 100644 --- a/services/mogo-service-api/build.gradle +++ b/services/mogo-service-api/build.gradle @@ -45,9 +45,11 @@ dependencies { if (Boolean.valueOf(RELEASE)) { api rootProject.ext.dependencies.mogomapapi api rootProject.ext.dependencies.skinsupport + api rootProject.ext.dependencies.mogocommons } else { api project(":libraries:mogo-map-api") api project(":skin:mogo-skin-support") + api project(":foudations:mogo-commons") } } diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/CarModelListInfo.java b/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/CarModelListInfo.java similarity index 91% rename from services/mogo-service/src/main/java/com/mogo/service/impl/adas/CarModelListInfo.java rename to services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/CarModelListInfo.java index bfd3601652..850bd0b741 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/CarModelListInfo.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/CarModelListInfo.java @@ -1,6 +1,4 @@ -package com.mogo.service.impl.adas; - -import com.mogo.module.common.entity.OwnCarModelEntity; +package com.mogo.service.adas.entity; import java.util.List; diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/CarModelListResponse.java b/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/CarModelListResponse.java similarity index 94% rename from services/mogo-service/src/main/java/com/mogo/service/impl/adas/CarModelListResponse.java rename to services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/CarModelListResponse.java index 8775e4bbd5..f912e13050 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/CarModelListResponse.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/CarModelListResponse.java @@ -1,4 +1,4 @@ -package com.mogo.service.impl.adas; +package com.mogo.service.adas.entity; import com.mogo.commons.data.BaseData; diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/OwnCarModelEntity.java b/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/OwnCarModelEntity.java similarity index 96% rename from modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/OwnCarModelEntity.java rename to services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/OwnCarModelEntity.java index 91cc8a7f46..fa04bb961d 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/OwnCarModelEntity.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/OwnCarModelEntity.java @@ -1,4 +1,4 @@ -package com.mogo.module.common.entity; +package com.mogo.service.adas.entity; /** * 自车模型实体,用于从服务端获取不同等级的自车模型信息以及将此信息传递给adas diff --git a/services/mogo-service/build.gradle b/services/mogo-service/build.gradle index ceb7918bc7..22268036f0 100644 --- a/services/mogo-service/build.gradle +++ b/services/mogo-service/build.gradle @@ -49,15 +49,12 @@ dependencies { implementation rootProject.ext.dependencies.mogoutils implementation rootProject.ext.dependencies.mogocommons implementation rootProject.ext.dependencies.mogoserviceapi - implementation rootProject.ext.dependencies.modulecommon - implementation rootProject.ext.dependencies.modulecommon } else { api project(":libraries:mogo-map") implementation project(":libraries:mogo-map-api") implementation project(":foudations:mogo-utils") implementation project(":foudations:mogo-commons") implementation project(":services:mogo-service-api") - implementation project(":modules:mogo-module-common") } } diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/CarModelInfoNetApiServices.java b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/CarModelInfoNetApiServices.java index a23e8553bc..17f345bd21 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/CarModelInfoNetApiServices.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/CarModelInfoNetApiServices.java @@ -1,6 +1,7 @@ package com.mogo.service.impl.adas; import com.mogo.commons.debug.DebugConfig; +import com.mogo.service.adas.entity.CarModelListResponse; import java.util.Map; @@ -28,7 +29,7 @@ interface CarModelInfoNetApiServices { } @GET("yycp-userDataService/app/enthusiasm/getEnthusiasmInfo/v1") - Observable requestCarModelList(@QueryMap Map params); + Observable< CarModelListResponse > requestCarModelList( @QueryMap Map params); } diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java index 091487d27e..bb1357df3d 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java @@ -13,9 +13,6 @@ import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.network.SubscribeImpl; import com.mogo.commons.network.Utils; import com.mogo.map.uicontroller.EnumMapUI; -import com.mogo.module.common.MogoApisHandler; -import com.mogo.module.common.map.MyLocationUtil; -import com.mogo.module.common.utils.CarSeries; import com.mogo.service.MogoServicePaths; import com.mogo.service.adas.IMogoADASController; import com.mogo.service.adas.IMogoAdasCarDataCallback; @@ -28,7 +25,10 @@ import com.mogo.service.adas.entity.ADASCarStateInfo; import com.mogo.service.adas.entity.ADASRecognizedResult; import com.mogo.service.adas.entity.ADASWarnMessage; import com.mogo.service.adas.entity.AdasOCHData; +import com.mogo.service.adas.entity.CarModelListResponse; +import com.mogo.service.datamanager.IMogoDataManager; import com.mogo.service.impl.singleton.SingletonsHolder; +import com.mogo.service.network.IMogoNetwork; import com.mogo.service.statusmanager.IMogoStatusManager; import com.mogo.utils.TipToast; import com.mogo.utils.UiThreadHandler; @@ -64,8 +64,6 @@ import java.util.concurrent.CopyOnWriteArrayList; import io.reactivex.schedulers.Schedulers; -import static com.mogo.module.common.utils.SPConst.getSpGuide; - /** * @author congtaowang * @since 2020-03-10 @@ -196,11 +194,11 @@ public class MogoADASController implements IMogoADASController { public void showADAS() { if ( DebugConfig.isNeedLoadGuideModule() ) { - if ( !SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).getBoolean( getSpGuide(), false ) ) { + if ( !SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).getBoolean( DebugConfig.getSpGuide(), false ) ) { return; } } - if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { + if ( SingletonsHolder.get( IMogoStatusManager.class ).isVrMode() ) { return; } Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); @@ -252,7 +250,7 @@ public class MogoADASController implements IMogoADASController { needEmphasizeMyLocation = true; // 修改自车图标展示 SharedPrefsMgr.getInstance( context ).putString( "MY_LOCATION_CONFIG", carStyleUrl ); - MyLocationUtil.setMyLocationIconUrl( context, carStyleUrl ); + SingletonsHolder.get( IMogoDataManager.class ).syncData( "ADAS", carStyleUrl ); } @Override @@ -273,7 +271,7 @@ public class MogoADASController implements IMogoADASController { @Override public void clickSettingBack() { if ( needEmphasizeMyLocation ) { - MyLocationUtil.emphasizeMyLocation(); + SingletonsHolder.get( IMogoDataManager.class ).syncData( "ADAS", null ); } needEmphasizeMyLocation = false; @@ -348,10 +346,10 @@ public class MogoADASController implements IMogoADASController { } // 仅在 vr 模式下显示 adas 识别车辆 - if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { + if ( !SingletonsHolder.get( IMogoStatusManager.class ).isVrMode() ) { return; } - if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageLaunched() ) { + if ( !SingletonsHolder.get( IMogoStatusManager.class ).isMainPageLaunched() ) { return; } handleAdasRecognizedData( ownerCarStateRectList ); @@ -375,7 +373,7 @@ public class MogoADASController implements IMogoADASController { private boolean useTestSn = false; private void invokeShowADASOperation() { - int delay = CarSeries.isF8xxSeries() ? 0 : 100; + int delay = 0; UiThreadHandler.postDelayed( () -> { @@ -386,7 +384,7 @@ public class MogoADASController implements IMogoADASController { return; } - if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { + if ( SingletonsHolder.get( IMogoStatusManager.class ).isVrMode() ) { return; } @@ -541,7 +539,8 @@ public class MogoADASController implements IMogoADASController { params.put( "sn", Utils.getSn() ); // currentSn = useTestSn ? TEST_SN : Utils.getSn(); // params.put("sn", currentSn); - MogoApisHandler.getInstance().getApis().getNetworkApi().create( CarModelInfoNetApiServices.class, CarModelInfoNetApiServices.getBaseUrl() ). + + SingletonsHolder.get( IMogoNetwork.class ).create( CarModelInfoNetApiServices.class, CarModelInfoNetApiServices.getBaseUrl() ). requestCarModelList( params ). subscribeOn( Schedulers.io() ). observeOn( Schedulers.io() ). diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/singleton/SingletonsHolder.java b/services/mogo-service/src/main/java/com/mogo/service/impl/singleton/SingletonsHolder.java index 9356ba3b4a..eb14cc7f9b 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/singleton/SingletonsHolder.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/singleton/SingletonsHolder.java @@ -2,6 +2,7 @@ package com.mogo.service.impl.singleton; import com.alibaba.android.arouter.facade.template.IProvider; import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.service.datamanager.IMogoDataManager; import com.mogo.service.fragmentmanager.IMogoFragmentManager; import com.mogo.service.impl.fragmentmanager.MogoFragmentManager; import com.mogo.service.impl.map.MogoMapService; @@ -35,6 +36,7 @@ public class SingletonsHolder { sSingletons.put( IMogoNetwork.class, new MogoNetWorkService() ); sSingletons.put( IMogoMsgCenter.class, new MogoMsgCenter() ); sSingletons.put( IMogoStatusManager.class, new MogoStatusManager() ); + sSingletons.put( IMogoDataManager.class, ARouter.getInstance().navigation( IMogoDataManager.class ) ); sSingletons.put( IMogoRefreshStrategyController.class, ARouter.getInstance().navigation( IMogoRefreshStrategyController.class ) ); } From 81b759d3c96318a73c8bc4204572a4d735996e3f Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Tue, 23 Feb 2021 14:25:28 +0800 Subject: [PATCH 2/5] opt --- .../com/mogo/module/extensions/net/UserInfoNetApiServices.java | 1 - .../src/main/java/com/mogo/service/adas/IMogoADASController.java | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/net/UserInfoNetApiServices.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/net/UserInfoNetApiServices.java index e8afa9f17b..024f358f4e 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/net/UserInfoNetApiServices.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/net/UserInfoNetApiServices.java @@ -1,6 +1,5 @@ package com.mogo.module.extensions.net; -import com.mogo.module.extensions.userinfo.CarModelListResponse; import com.mogo.module.extensions.userinfo.UserInfoResponse; import java.util.Map; diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoADASController.java b/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoADASController.java index 533643e747..681c561fd7 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoADASController.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoADASController.java @@ -118,6 +118,7 @@ public interface IMogoADASController extends IProvider { /** * 添加adas识别物体回调 * + * * @param callback */ void addAdasRecognizedDataCallback( IMogoAdasRecognizedDataCallback callback ); From 4de208026af2cb475849189e77ce6216402512b3 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Tue, 23 Feb 2021 15:21:31 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9B=B4=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/mogo/och/taxi/MogoOCHTaxiModel.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/MogoOCHTaxiModel.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/MogoOCHTaxiModel.java index 491b8ad8fd..ddb089d00c 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/MogoOCHTaxiModel.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/MogoOCHTaxiModel.java @@ -300,7 +300,12 @@ class MogoOCHTaxiModel { @Override public void onCarLocationChanged2( Location location ) { - Logger.d( TAG, "定位已判断是否达到上车站点" ); + Logger.d( TAG, "定位已判断是否达到上车站点: 起点(%s, %s), 当前位置(%s, %s)", + mCurrentOCHOrder.drivingRoutes.get( 0 ).lon, + mCurrentOCHOrder.drivingRoutes.get( 0 ).lat, + location.getLongitude(), + location.getLatitude() + ); onLocationChanged( location ); } @@ -323,11 +328,9 @@ class MogoOCHTaxiModel { return; } if ( mIsArriveAtStartStation ) { - unregisterCarLocationListener(); return; } if ( mIsUserArriveAtStartStation ) { - unregisterCarLocationListener(); return; } judgeStartStation( location ); @@ -349,7 +352,6 @@ class MogoOCHTaxiModel { } if ( distance <= ARRIVE_AT_START_STATION_DISTANCE ) { mIsArriveAtStartStation = true; - unregisterCarLocationListener(); OCHTaxiUiController.getInstance().onArriveAtStartStation(); updateOCHOrderStatus( OCHOrderStatus.ArriveAtStartStation, new OCHOrderStatusCallback() { @Override @@ -685,6 +687,7 @@ class MogoOCHTaxiModel { .getAdasControllerApi() .cancelAutopilot(); Logger.d( TAG, "结束自动驾驶" ); + unregisterCarLocationListener(); } catch ( Exception e ) { e.printStackTrace(); } From 3d01e0ef59b73039b14f3f8919f8ea7c7f24de76 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Tue, 23 Feb 2021 16:10:17 +0800 Subject: [PATCH 4/5] fixed conflict --- .../service/CarCorderController.kt | 23 +++- .../roadcondition/service/MainService.kt | 15 ++- .../com/mogo/module/share/TanluManager.java | 107 ++++++++++-------- .../module/share/callback/RoadInfoCallback.kt | 2 + 4 files changed, 96 insertions(+), 51 deletions(-) diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt index 717902edcf..159f420e5c 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt @@ -77,6 +77,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { zdCarCoderController.init() } + fun takePhoto( photoType: Int, cameraId: Int, @@ -87,7 +88,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { fromType: String, longitude: Double, latitude: Double, - speed: Float + speed: Float, + address: String, + direction: Float, + areaCode: String, + cityCode: String ) { Log.d(TAG, "takePhoto ---------- type = $type --- mType = $mType ---fromType = $fromType") this.mType = type @@ -96,6 +101,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { this.mLongitude = longitude this.mLatitude = latitude this.mSpeed = speed + this.mAddress = address + this.mDirection = direction + this.mAreaCode = areaCode + this.mCityCode = cityCode + CustomStatusHandler.offerPhotoStatus(isCustom) zdCarCoderController.takePhoto(photoType, cameraId, haveVoice) trackGetPhoto(1) @@ -115,7 +125,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { fromType: String, longitude: Double, latitude: Double, - speed: Float + speed: Float, + address: String, + direction: Float, + areaCode: String, + cityCode: String ) { Log.d(TAG, "takeVideo -------- isCustom = $isCustom ---mFromType = $mFromType ---type = $type ---speed = $speed") this.mType = type @@ -124,6 +138,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { this.mLongitude = longitude this.mLatitude = latitude this.mSpeed = speed + this.mAddress = address + this.mDirection = direction + this.mAreaCode = areaCode + this.mCityCode = cityCode + if (DebugConfig.getCarMachineType() == 0) { //自研车机 outputVideoPath = getCompressVideoPath() CustomStatusHandler.offerVideoStatus(TakeEntity(isCustom, id, fromType)) diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/MainService.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/MainService.kt index 7ebddece68..46bc7c564d 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/MainService.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/MainService.kt @@ -76,6 +76,12 @@ class MainService : Service() { private var mLatitude: Double = 0.0 private lateinit var serviceApis: IMogoServiceApis + private var mAddress: String = "" + private var mDirection: Float = 0f + private var mAreaCode: String = "" + private var mCityCode: String = "" + + override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { //清理多媒体资源和sp策略数据 clearStrategyType(this) @@ -95,6 +101,11 @@ class MainService : Service() { mainInfoId = it.parentId mLongitude = it.lon mLatitude = it.lat + mAddress = it.addr + mDirection = it.direction + mAreaCode = it.areaCode + mCityCode = it.cityCode + Log.d(TAG, "onStartCommand shareType = $shareType --fromType = $fromType --mainInfoId = $mainInfoId -- mLongitude = $mLongitude --mLatitude = $mLatitude --it.duration = ${it.duration} ") if (fromType == UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO || fromType == UPLOAD_FROM_STRATEGY_BLOCK_AUTO) { // 如果是策略上报,isCustom = false @@ -274,7 +285,7 @@ class MainService : Service() { Observable.intervalRange(0, 1, 0, 2_000, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribe { - CarCorderController.takePhoto(1, 1, false, isCustom, TANLU_ROAD_CURRENT, mainInfoId, fromType, mLongitude, mLatitude, speed) + CarCorderController.takePhoto(1, 1, false, isCustom, TANLU_ROAD_CURRENT, mainInfoId, fromType, mLongitude, mLatitude, speed, mAddress, mDirection, mAreaCode, mCityCode) } // } @@ -292,7 +303,7 @@ class MainService : Service() { ) { Log.d("MainService", "takeVideo --------1----> fromType = $fromType --isCustom = $isCustom") // if (isAuthorization(BaseApplication.getAppContext())) { - CarCorderController.takeVideo(1, duration, isCustom, id, shareType, mainInfoId, fromType, mLongitude, mLatitude, speed) + CarCorderController.takeVideo(1, duration, isCustom, id, shareType, mainInfoId, fromType, mLongitude, mLatitude, speed, mAddress, mDirection, mAreaCode, mCityCode) // } postVideoAlarmTask(isInterval) diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java index e1d222d0a1..ada9bed5b4 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java @@ -12,6 +12,8 @@ import android.view.animation.AccelerateInterpolator; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; +import com.mogo.cloud.tanlu.bean.MarkerExploreWay; +import com.mogo.cloud.tanlu.bean.location.MarkerLocation; import com.mogo.commons.voice.AIAssist; import com.mogo.map.MogoLatLng; import com.mogo.map.location.MogoLocation; @@ -31,8 +33,7 @@ import com.mogo.map.search.poisearch.IMogoPoiSearchListener; import com.mogo.map.search.poisearch.MogoPoiResult; import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery; import com.mogo.map.uicontroller.IMogoMapUIController; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerLocation; +//import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.share.bean.VoiceCmdData; import com.mogo.module.share.bean.event.MarkerInfo; @@ -287,45 +288,45 @@ public class TanluManager implements IMogoMarkerClickListener, } if (voiceData != null) { -// mTanluModelData.queryRodeInfo(mContext, mKeywords, voiceData, new RoadInfoCallback() { -// @Override -// public void onQueryRoadInfoSuccess(@NotNull List roadInfoList) { -// if (roadInfoList == null || (roadInfoList != null && roadInfoList.size() <= 0)) { -// if ( TextUtils.equals(mKeywords,"附近")) { -// speakFailVoice("未发现附近的特殊路况"); -// } else { -// speakFailVoice("未发现" + mKeywords + "附近的特殊路况"); -// } -// moveToMarcker(currentLat, currentLon); -// return; -// } -// Logger.d(TAG, "onQueryRoadInfoSuccess roadInfoList.size() = " + roadInfoList.size() -// + " >>currentLat = " + currentLat + " -->currentLon = " + currentLon); -// MogoLocation location = TanluServiceManager.getLocationClient().getLastKnowLocation(); -// if (location != null) { -// mCity = location.getCityName(); -// } -// addMarkersAction((List) roadInfoList, currentLat, currentLon); -// } -// -// @Override -// public void onQueryRoadInfoFail(@NotNull String msg, int code) { -// Logger.e(TAG, "onQueryRoadInfoFail ----- msg = " + msg); -//// speakFailVoice(searchfaileVoiceStrings[1]); -// if (TextUtils.equals(mKeywords,"附近")) { -// speakFailVoice("未发现附近的特殊路况"); -// } else { -// speakFailVoice("未发现" + mKeywords + "附近的特殊路况"); -// } -// moveToMarcker(currentLat, currentLon); -// } -// -// @Override -// public void onLocatSuccess(double lat, double lon) { -// currentLat = lat; -// currentLon = lon; -// } -// }); + mTanluModelData.queryRodeInfo(mContext, mKeywords, voiceData, new RoadInfoCallback() { + @Override + public void onQueryRoadInfoSuccess(@NotNull List roadInfoList) { + if (roadInfoList == null || (roadInfoList != null && roadInfoList.size() <= 0)) { + if (TextUtils.equals(mKeywords, "附近")) { + speakFailVoice("未发现附近的特殊路况"); + } else { + speakFailVoice("未发现" + mKeywords + "附近的特殊路况"); + } + moveToMarcker(currentLat, currentLon); + return; + } + Logger.d(TAG, "onQueryRoadInfoSuccess roadInfoList.size() = " + roadInfoList.size() + + " >>currentLat = " + currentLat + " -->currentLon = " + currentLon); + MogoLocation location = TanluServiceManager.getLocationClient().getLastKnowLocation(); + if (location != null) { + mCity = location.getCityName(); + } + addMarkersAction((List) roadInfoList, currentLat, currentLon); + } + + @Override + public void onQueryRoadInfoFail(@NotNull String msg, int code) { + Logger.e(TAG, "onQueryRoadInfoFail ----- msg = " + msg); +// speakFailVoice(searchfaileVoiceStrings[1]); + if (TextUtils.equals(mKeywords, "附近")) { + speakFailVoice("未发现附近的特殊路况"); + } else { + speakFailVoice("未发现" + mKeywords + "附近的特殊路况"); + } + moveToMarcker(currentLat, currentLon); + } + + @Override + public void onLocatSuccess(double lat, double lon) { + currentLat = lat; + currentLon = lon; + } + }); } } @@ -362,7 +363,8 @@ public class TanluManager implements IMogoMarkerClickListener, MarkerShowEntity markerShowEntity = new MarkerShowEntity(); markerShowEntity.setBindObj(markerExploreWayList.get(i)); markerShowEntity.setTextContent(list.get(i).getAddr()); - markerShowEntity.setMarkerLocation(markerExploreWayList.get(i).getLocation()); + + markerShowEntity.setMarkerLocation(getLocation(markerExploreWayList.get(i).getLocation())); markerShowEntity.setMarkerType(ShareConstants.MODEL_NAME); TanluServiceManager.getServiceApis().getMarkerService().drawMarker(markerShowEntity); @@ -381,6 +383,16 @@ public class TanluManager implements IMogoMarkerClickListener, //直接使用当前数据list,作为切换的数据源,切换左侧列表到最新的数据 } + private com.mogo.module.common.entity.MarkerLocation getLocation(MarkerLocation location) { + com.mogo.module.common.entity.MarkerLocation markerLocation = new com.mogo.module.common.entity.MarkerLocation(); + markerLocation.setLat(location.getLat()); + markerLocation.setLon(location.getLon()); + markerLocation.setAddress(location.getAddress()); + markerLocation.setAngle(location.getAngle()); + + return markerLocation; + + } /** * marker动画 @@ -458,7 +470,7 @@ public class TanluManager implements IMogoMarkerClickListener, MogoLatLng latLon = poi.getPoint(); Double longit; //经度 Double lat; //维度 - if (TextUtils.equals(mKeywords,"附近")) { + if (TextUtils.equals(mKeywords, "附近")) { Logger.d(TAG, "附近 -onPoiSearched---1---"); longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude(); lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude(); @@ -473,7 +485,7 @@ public class TanluManager implements IMogoMarkerClickListener, Logger.e(TAG, "poi == null"); Double longit; //经度 Double lat; //维度 - if (TextUtils.equals(mKeywords,"附近")) { + if (TextUtils.equals(mKeywords, "附近")) { Logger.d(TAG, "附近 -onPoiSearched---2---"); longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude(); lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude(); @@ -533,7 +545,7 @@ public class TanluManager implements IMogoMarkerClickListener, markerExploreWay.setCityName(cityName); markerExploreWay.setPoiType(poiType); - MarkerLocation markerLocation = new MarkerLocation(); + com.mogo.module.common.entity.MarkerLocation markerLocation = new com.mogo.module.common.entity.MarkerLocation(); markerLocation.setLat(lat); markerLocation.setLon(lon); markerLocation.setAddress(address); @@ -542,6 +554,7 @@ public class TanluManager implements IMogoMarkerClickListener, markerShowEntity.setBindObj(markerExploreWay); markerShowEntity.setTextContent(address); markerShowEntity.setMarkerType(ShareConstants.MODEL_NAME); + markerShowEntity.setMarkerLocation(markerLocation); IMogoMarker mogoMarker = TanluServiceManager.getServiceApis().getMarkerService().drawMarker(markerShowEntity); @@ -572,11 +585,11 @@ public class TanluManager implements IMogoMarkerClickListener, @Override public void onAnimEnd() { - UiThreadHandler.postDelayed( () -> { + UiThreadHandler.postDelayed(() -> { if (mogoAnimationMarker != null) { mogoAnimationMarker.destroy(); } - }, 1_200L ); + }, 1_200L); } }); } diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt index 8a1486b276..5c56223851 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt @@ -1,5 +1,7 @@ package com.mogo.module.share.callback +//import com.mogo.module.common.entity.MarkerExploreWay + import com.mogo.cloud.tanlu.bean.MarkerExploreWay From 3f6400b0bc975a5d8cdc38bec75f6c83468b2a49 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Tue, 23 Feb 2021 16:24:56 +0800 Subject: [PATCH 5/5] bugfix --- app/build.gradle | 4 ++-- .../src/main/java/com/mogo/commons/debug/DebugConfig.java | 6 ++++++ .../java/com/mogo/map/impl/custom/MapStyleController.java | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index fe07695ae3..665155a4d3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -123,7 +123,7 @@ android { // 是否基于地图 buildConfigField 'boolean', 'IS_MAP_BASED', 'true' // 是否加载引导模块 - buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'true' + buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'false' // 分享时是否隐藏 adas buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false' // 是否需要实时上报坐标 @@ -151,7 +151,7 @@ android { // 是否基于地图 buildConfigField 'boolean', 'IS_MAP_BASED', 'true' // 是否加载引导模块 - buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'true' + buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'false' // 分享时是否隐藏 adas buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false' // 是否需要实时上报坐标 diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java index 12d823c3e1..f3df396ed5 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java @@ -1,5 +1,7 @@ package com.mogo.commons.debug; +import android.text.TextUtils; + /** * @author congtaowang * @since 2019-12-23 @@ -413,4 +415,8 @@ public class DebugConfig { public static void setNotSmooth( boolean sIsNotSmooth ) { DebugConfig.sIsNotSmooth = sIsNotSmooth; } + + public static boolean isOCHModule(){ + return sProductFlavor != null && sProductFlavor.startsWith( "foch" ); + } } diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/MapStyleController.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/MapStyleController.java index 43d2cc140b..ca3077c901 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/MapStyleController.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/MapStyleController.java @@ -1,6 +1,7 @@ package com.mogo.map.impl.custom; +import com.mogo.commons.debug.DebugConfig; import com.zhidaoauto.map.sdk.open.location.MogoLocation; import java.util.ArrayList; @@ -52,6 +53,11 @@ class MapStyleController { return; } + // 网约车不自动切换vr、2d模式 + if ( DebugConfig.isOCHModule() ) { + return; + } + boolean isInVrMode = false; for ( VrAreaFilter vrAreaFilter : mVrAreaFilters ) { if ( vrAreaFilter == null ) {