From 24e81b73c8013377559ca1b1ed4be92a4406a1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Fri, 23 Apr 2021 21:11:58 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/res/raw/scenario_warning_event_data.json | 6 +++--- .../src/main/res/raw/scenario_warning_event_data_left.json | 6 +++--- .../res/raw/scenario_warning_event_data_pedestrians.json | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json index bdaf21afd3..bc2c961e68 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json @@ -1,13 +1,13 @@ { "type": 10013, - "lat": 26.88008302, + "lat": 26.88008312, "lon": 112.57147295, "distance": 2, - "collisionLat": 26.88008302, + "collisionLat": 26.88008312, "collisionLon": 112.57147295, "stopLines": [ { - "lat": 26.88008302, + "lat": 26.88008312, "lon": 112.57147295 }, { diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json index 633b87ed95..9d01a58e2e 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json @@ -1,13 +1,13 @@ { "type": 10013, - "lat": 26.88008302, + "lat": 26.88008312, "lon": 112.57147295, "distance": 2, - "collisionLat": 26.88008302, + "collisionLat": 26.88008312, "collisionLon": 112.57147295, "stopLines": [ { - "lat": 26.88008302, + "lat": 26.88008312, "lon": 112.57147295 }, { diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json index 10578a75f1..3b79c922c0 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json @@ -1,13 +1,13 @@ { "type": 10013, - "lat": 26.88008302, + "lat": 26.88008312, "lon": 112.57147295, "distance": 2, - "collisionLat": 26.88008302, + "collisionLat": 26.88008312, "collisionLon": 112.57147295, "stopLines": [ { - "lat": 26.88008302, + "lat": 26.88008312, "lon": 112.57147295 }, { From 3a252c0a754bfae166976fd8ca50973b55fad7ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95=E6=95=B0=E6=8D=AE?= <> Date: Sun, 25 Apr 2021 13:18:57 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/drawer/V2XWarnDataDrawer.java | 23 ++++++++++++++++--- .../scene/warning/V2XWarningWindow.java | 2 +- .../res/raw/scenario_warning_event_data.json | 4 ++-- .../raw/scenario_warning_event_data_left.json | 4 ++-- ...enario_warning_event_data_pedestrians.json | 2 +- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java index 1cca2829bc..9067c85ad2 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java @@ -94,7 +94,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL MogoLatLng stopLineNew = Trigonometric.getNewLocation(data.getStopLines().get(1), 5, 180); MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 5, 180); - IMogoMarker marker = drawMarker(markerShowEntity); + IMogoMarker marker = drawMarker(markerShowEntity, modeResType(data.getType())); Log.d("liyz", "renderWarnData marker != null direction = " + data.getDirection()); //识别物 marker.addDynamicAnchorPosition(new MogoLatLng( @@ -112,14 +112,31 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL } + //根据识别物类型 (行人0/自行车1/摩托车2/小汽车3/公交车4)获取3D模型(对应查看getModelRes) + private int modeResType(int dataType) { + switch (dataType) { + case 0: + return 1; + case 1: + return 2; + case 2: + return 4; + case 3: + return 3; + case 4: + return 6; + } + return 1; + } - public IMogoMarker drawMarker(MarkerShowEntity markerShowEntity) { + + public IMogoMarker drawMarker(MarkerShowEntity markerShowEntity, int modeResType) { MogoMarkerOptions options = new MogoMarkerOptions() .object(markerShowEntity) .latitude(markerShowEntity.getMarkerLocation().getLat()) .longitude(markerShowEntity.getMarkerLocation().getLon()); IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); - options.icon3DRes(getModelRes(1)); //TODO + options.icon3DRes(getModelRes(modeResType)); //TODO options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java index c03fae1521..47e28593b2 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java @@ -59,6 +59,7 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow { private void initView(Context context) { LayoutInflater.from(context).inflate(R.layout.v2x_road_front_warning_vr, this); typeImage = findViewById(R.id.warning_type_image); + warningTextView = findViewById(R.id.warning_content_text); distance = findViewById(R.id.warning_distance); } @@ -81,7 +82,6 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow { } distance.setText(String.valueOf(mV2XWarningEntity.getDistance()) + "米"); warningTextView.setText(mV2XWarningEntity.getWarningContent()); - mV2XWarningEntity.setTts(0); AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(mV2XWarningEntity.getTts()); } //3秒后移除提示弹框 diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json index bc2c961e68..b0c0b5a1c3 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json @@ -1,5 +1,5 @@ { - "type": 10013, + "type": 2, "lat": 26.88008312, "lon": 112.57147295, "distance": 2, @@ -21,7 +21,7 @@ "speed": 11.108121, "targetColor": "#FF4040", "stopLineDistance": 60, - "warningContent": "小心行人", + "warningContent": "注意摩托车", "heading": 0, "showTime": 8000, "roadwidth": 4.0 diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json index 9d01a58e2e..7c5d730ae0 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json @@ -1,5 +1,5 @@ { - "type": 10013, + "type": 1, "lat": 26.88008312, "lon": 112.57147295, "distance": 2, @@ -21,7 +21,7 @@ "speed": 11.108121, "targetColor": "#FF4040", "stopLineDistance": 60, - "warningContent": "小心行人", + "warningContent": "注意自行车", "heading": 0, "showTime": 8000, "roadwidth": 4.0 diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json index 3b79c922c0..a591cb18ce 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json @@ -1,5 +1,5 @@ { - "type": 10013, + "type": 0, "lat": 26.88008312, "lon": 112.57147295, "distance": 2, From d5bdd2c0f893b8f5a2d686deba59ea49a24c6c18 Mon Sep 17 00:00:00 2001 From: wujifei Date: Mon, 26 Apr 2021 14:49:45 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix#=E3=80=90#594=E3=80=91=20=E3=80=90?= =?UTF-8?q?=E5=BF=85=E7=8E=B0=E3=80=91=E7=99=BD=E5=A4=A9=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E5=8F=91=E5=B8=83=E6=95=85=E9=9A=9C=E6=B1=82?= =?UTF-8?q?=E5=8A=A9=EF=BC=8C=E8=BF=9B=E5=85=A5=E9=B9=B0=E7=9C=BC=E7=9C=8B?= =?UTF-8?q?=E4=B8=8D=E6=B8=85=E5=AD=97=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/res/layout/window_carforhelp_detail.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_carforhelp_detail.xml b/modules/mogo-module-v2x/src/main/res/layout/window_carforhelp_detail.xml index 270f3d8d66..5207ad83c3 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_carforhelp_detail.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_carforhelp_detail.xml @@ -33,7 +33,7 @@ android:paddingLeft="@dimen/dp_40" android:paddingRight="@dimen/dp_40" android:text="正在为您发起求助" - android:textColor="@color/v2x_white" + android:textColor="@color/v2x_white_color" android:textSize="@dimen/dp_32" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@+id/iv_event" From 2b3a7c2928353c4466ca8136facc6fcbc1e8f589 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Mon, 26 Apr 2021 15:07:56 +0800 Subject: [PATCH 4/4] add lat lon in test panel --- .../com/mogo/commons/debug/DebugConfig.java | 90 +- .../SnapshotLocationController.java | 102 +-- .../service/intent/MockIntentHandler.java | 799 +++++++++--------- .../service/status/EnvStatusManager.java | 82 +- 4 files changed, 543 insertions(+), 530 deletions(-) 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 1713f11156..0868458787 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,7 +1,5 @@ package com.mogo.commons.debug; -import android.text.TextUtils; - /** * @author congtaowang * @since 2019-12-23 @@ -28,7 +26,7 @@ public class DebugConfig { * * @param sDebug true - 调试模式 false - 非调试模式 */ - public static void setDebug( boolean sDebug ) { + public static void setDebug(boolean sDebug) { DebugConfig.sDebug = sDebug; } @@ -69,7 +67,7 @@ public class DebugConfig { */ public static final int AI_TYPE_SPEECH = 2; - private static int sAIType = AI_TYPE_TXZ; + private static final int sAIType = AI_TYPE_TXZ; /** * 自研车机 @@ -116,7 +114,7 @@ public class DebugConfig { * {@link #NET_MODE_DEMO} * {@link #NET_MODE_RELEASE} */ - public static void setNetMode( int netMode ) { + public static void setNetMode(int netMode) { DebugConfig.sNetMode = netMode; } @@ -129,7 +127,7 @@ public class DebugConfig { return sLaunchLocationService; } - public static void setLaunchLocationService( boolean launchLocationService ) { + public static void setLaunchLocationService(boolean launchLocationService) { DebugConfig.sLaunchLocationService = launchLocationService; } @@ -142,7 +140,7 @@ public class DebugConfig { return sUseCustomNavi; } - public static void setUseCustomNavi( boolean sUseCustomNavi ) { + public static void setUseCustomNavi(boolean sUseCustomNavi) { DebugConfig.sUseCustomNavi = sUseCustomNavi; } @@ -151,7 +149,7 @@ public class DebugConfig { * * @param type {@link #CAR_MACHINE_TYPE_SELF_INNOVATE} {@link #CAR_MACHINE_TYPE_BYD} */ - public static void setCarMachineType( int type ) { + public static void setCarMachineType(int type) { sCarMachineType = type; } @@ -173,7 +171,7 @@ public class DebugConfig { return sIsLauncher; } - public static void setLauncher( boolean isLauncher ) { + public static void setLauncher(boolean isLauncher) { DebugConfig.sIsLauncher = isLauncher; } @@ -183,7 +181,7 @@ public class DebugConfig { return sRequestOnlineCarData; } - public static void setRequestOnlineCarData( boolean sRequestOnlineCarData ) { + public static void setRequestOnlineCarData(boolean sRequestOnlineCarData) { DebugConfig.sRequestOnlineCarData = sRequestOnlineCarData; } @@ -193,7 +191,7 @@ public class DebugConfig { return sUseCustomMap; } - public static void setUseCustomMap( boolean sUseCustomMap ) { + public static void setUseCustomMap(boolean sUseCustomMap) { DebugConfig.sUseCustomMap = sUseCustomMap; } @@ -206,13 +204,13 @@ public class DebugConfig { return sActiveAIAssistFlag; } - public static void setActiveAIAssistFlag( boolean sActiveAIAssistFlag ) { + public static void setActiveAIAssistFlag(boolean sActiveAIAssistFlag) { DebugConfig.sActiveAIAssistFlag = sActiveAIAssistFlag; } private static boolean useMockObuData; - public static void setUseMockObuData( boolean use ) { + public static void setUseMockObuData(boolean use) { useMockObuData = use; } @@ -231,13 +229,13 @@ public class DebugConfig { * * @param sProductFlavor */ - public static void setProductFlavor( String sProductFlavor ) { + public static void setProductFlavor(String sProductFlavor) { DebugConfig.sProductFlavor = sProductFlavor; } private static String sSocketAppId; - public static void setSocketAppId( String sSocketAppId ) { + public static void setSocketAppId(String sSocketAppId) { DebugConfig.sSocketAppId = sSocketAppId; } @@ -254,14 +252,14 @@ public class DebugConfig { return sRoadEventAnimated; } - public static void setRoadEventAnimated( boolean sRoadEventAnimated ) { + public static void setRoadEventAnimated(boolean sRoadEventAnimated) { DebugConfig.sRoadEventAnimated = sRoadEventAnimated; } private static boolean sLoadGuideModule = false; - public static void setLoadGuideModule( boolean sLoadGuideModule ) { + public static void setLoadGuideModule(boolean sLoadGuideModule) { DebugConfig.sLoadGuideModule = sLoadGuideModule; } @@ -277,7 +275,7 @@ public class DebugConfig { private static boolean isSkinSupported = false; - public static void setSkinSupported( boolean isSkinSupported ) { + public static void setSkinSupported(boolean isSkinSupported) { DebugConfig.isSkinSupported = isSkinSupported; } @@ -290,7 +288,7 @@ public class DebugConfig { */ private static boolean isSupportedSearchDestinationOnlineCarList = false; - public static void setSupportedSearchDestinationOnlineCarList( boolean isSupportedSearchDestinationOnlineCarList ) { + public static void setSupportedSearchDestinationOnlineCarList(boolean isSupportedSearchDestinationOnlineCarList) { DebugConfig.isSupportedSearchDestinationOnlineCarList = isSupportedSearchDestinationOnlineCarList; } @@ -303,7 +301,7 @@ public class DebugConfig { */ private static boolean isScheduleCalculateNotHomeCompanyDistanceForPush = false; - public static void setScheduleCalculateNotHomeCompanyDistanceForPush( boolean isScheduleCalculateNotHomeCompanyDistanceForPush ) { + public static void setScheduleCalculateNotHomeCompanyDistanceForPush(boolean isScheduleCalculateNotHomeCompanyDistanceForPush) { DebugConfig.isScheduleCalculateNotHomeCompanyDistanceForPush = isScheduleCalculateNotHomeCompanyDistanceForPush; } @@ -316,7 +314,7 @@ public class DebugConfig { */ private static boolean isSupportLauncherCardRefreshStrategy = false; - public static void setSupportLauncherCardRefreshStrategy( boolean isSupportLauncherCardRefreshStrategy ) { + public static void setSupportLauncherCardRefreshStrategy(boolean isSupportLauncherCardRefreshStrategy) { DebugConfig.isSupportLauncherCardRefreshStrategy = isSupportLauncherCardRefreshStrategy; } @@ -330,7 +328,7 @@ public class DebugConfig { return obuType; } - public static void setObuType( int type ) { + public static void setObuType(int type) { obuType = type; } @@ -339,7 +337,7 @@ public class DebugConfig { */ private static boolean needRequestUserInfo = false; - public static void setNeedRequestUserInfo( boolean needRequestUserInfo ) { + public static void setNeedRequestUserInfo(boolean needRequestUserInfo) { DebugConfig.needRequestUserInfo = needRequestUserInfo; } @@ -356,13 +354,13 @@ public class DebugConfig { return isMapBased; } - public static void setMapBased( boolean isMapBased ) { + public static void setMapBased(boolean isMapBased) { DebugConfig.isMapBased = isMapBased; } private static boolean isNeedLoadGuideModule = true; - public static void setNeedLoadGuideModule( boolean isNeedLoadGuideModule ) { + public static void setNeedLoadGuideModule(boolean isNeedLoadGuideModule) { DebugConfig.isNeedLoadGuideModule = isNeedLoadGuideModule; } @@ -376,7 +374,7 @@ public class DebugConfig { return isNeedHideAdasWhenShare; } - public static void setNeedHideAdasWhenShare( boolean isNeedHideAdas ) { + public static void setNeedHideAdasWhenShare(boolean isNeedHideAdas) { DebugConfig.isNeedHideAdasWhenShare = isNeedHideAdas; } @@ -389,7 +387,7 @@ public class DebugConfig { return sIsNeedUploadCoordinatesInTime; } - public static void setNeedUploadCoordinatesInTime( boolean sIsNeedUploadCoordinatesInTime ) { + public static void setNeedUploadCoordinatesInTime(boolean sIsNeedUploadCoordinatesInTime) { DebugConfig.sIsNeedUploadCoordinatesInTime = sIsNeedUploadCoordinatesInTime; } @@ -402,7 +400,7 @@ public class DebugConfig { return sIsUseAdasRtkLocationInfo; } - public static void setUseAdasRtkLocationInfo( boolean sIsUseAdasRtkLocationInfo ) { + public static void setUseAdasRtkLocationInfo(boolean sIsUseAdasRtkLocationInfo) { DebugConfig.sIsUseAdasRtkLocationInfo = sIsUseAdasRtkLocationInfo; } @@ -412,17 +410,17 @@ public class DebugConfig { return sIsNotSmooth; } - public static void setNotSmooth( boolean sIsNotSmooth ) { + public static void setNotSmooth(boolean sIsNotSmooth) { DebugConfig.sIsNotSmooth = sIsNotSmooth; } public static boolean isOCHModule() { - return sProductFlavor != null && sProductFlavor.startsWith( "foch" ); + return sProductFlavor != null && sProductFlavor.startsWith("foch"); } public static int sSelfCarSpeedYOffset = 20; - public static void setSelfCarSpeedYOffset( int sSelfCarSpeedYOffset ) { + public static void setSelfCarSpeedYOffset(int sSelfCarSpeedYOffset) { DebugConfig.sSelfCarSpeedYOffset = sSelfCarSpeedYOffset; } @@ -436,20 +434,28 @@ public class DebugConfig { public static final int sDownloadSnapshot = 2; public static final int sAutoPilotStatus = 3; public static final int sDownloadLink = 4; + public static final int sLon = 5; + public static final int sLat = 6; public static String[] sStatus = new String[]{ "false", "false", "false", "0", - "false" + "false", + "0", + "0" }; - public synchronized static void setStatus( int type, boolean status ) { - sStatus[type] = String.valueOf( status ); + public synchronized static void setStatus(int type, boolean status) { + sStatus[type] = String.valueOf(status); } - public synchronized static void setAutoPilotStatus( String status ) { + public synchronized static void setStatusData(int type, double data) { + sStatus[type] = String.valueOf(data); + } + + public synchronized static void setAutoPilotStatus(String status) { sStatus[sAutoPilotStatus] = status; } @@ -457,21 +463,29 @@ public class DebugConfig { return sStatus[sAutoPilotStatus]; } - public synchronized static String getStatus( int type, boolean set2False ) { + public synchronized static String getStatus(int type, boolean set2False) { String result = sStatus[type]; - if ( set2False ) { + if (set2False) { sStatus[type] = "false"; } return result; } + public synchronized static String getStatusData(int type){ + if(type > 4){ + return sStatus[type].toString(); + }else{ + return "0"; + } + } + private static boolean isUseAdasRecognize = true; public static void setUseAdasRecognize(boolean status) { isUseAdasRecognize = status; } - public static boolean isUseAdasRecognize(){ + public static boolean isUseAdasRecognize() { return isUseAdasRecognize; } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/uploadintime/SnapshotLocationController.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/uploadintime/SnapshotLocationController.java index 8ff04c3c59..c3e01a13b4 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/uploadintime/SnapshotLocationController.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/uploadintime/SnapshotLocationController.java @@ -11,12 +11,12 @@ import java.util.ArrayList; import java.util.List; public -/* - * @author congtaowang - * @since 2020/12/14 - * - * 实时坐标数据处理中心 - */ + /* + * @author congtaowang + * @since 2020/12/14 + * + * 实时坐标数据处理中心 + */ class SnapshotLocationController { private static final String TAG = "SnapshotLocationController"; @@ -27,9 +27,9 @@ class SnapshotLocationController { } public static SnapshotLocationController getInstance() { - if ( sInstance == null ) { - synchronized ( SnapshotLocationController.class ) { - if ( sInstance == null ) { + if (sInstance == null) { + synchronized (SnapshotLocationController.class) { + if (sInstance == null) { sInstance = new SnapshotLocationController(); } } @@ -44,10 +44,10 @@ class SnapshotLocationController { private CloudLocationInfo mLastLocationInfo = null; // GPS(1s1次) RTK(OS侧)缓存数据, - private final List< CloudLocationInfo > mLocationList = new ArrayList<>(); + private final List mLocationList = new ArrayList<>(); // adda 工控机数据缓存 - private final List< CloudLocationInfo > mMachineCacheList = new ArrayList<>(); + private final List mMachineCacheList = new ArrayList<>(); private int mDataAccuracy = 0; private double mCurSpeed; @@ -59,15 +59,15 @@ class SnapshotLocationController { * * @param cli {@link CloudLocationInfo} */ - public void syncLocationInfo( CloudLocationInfo cli ) { - if ( cli == null ) { + public void syncLocationInfo(CloudLocationInfo cli) { + if (cli == null) { return; } mLastLocationInfo = cli; mCurSpeed = cli.getSpeed(); mCurLon = cli.getLon(); mCurLat = cli.getLat(); - mLocationList.add( cli ); + mLocationList.add(cli); } /** @@ -75,33 +75,39 @@ class SnapshotLocationController { * * @param data JSON结构化数据 */ - public void syncAdasLocationInfo( JSONObject data ) { - if ( data == null ) { + public void syncAdasLocationInfo(JSONObject data) { + if (data == null) { return; } - DebugConfig.setStatus( DebugConfig.sLocation, true ); - Logger.d( TAG, "同步到rtk数据" ); - double lon = data.optDouble( "lon", -1 ); - double lat = data.optDouble( "lat", -1 ); - double alt = data.optDouble( "alt", -1 ); - double heading = data.optDouble( "heading", -1 ); - double acceleration = data.optDouble( "acceleration", -1 ); - double yawRate = data.optDouble( "yawRate", -1 ); - double speed = data.optDouble( "speed", -1 ); - long satelliteTime = data.optLong( "satelliteTime" ); - long systemTime = data.optLong( "systemTime" ); + //测试面板状态同步 + DebugConfig.setStatus(DebugConfig.sLocation, true); + + Logger.d(TAG, "同步到rtk数据"); + double lon = data.optDouble("lon", -1); + double lat = data.optDouble("lat", -1); + double alt = data.optDouble("alt", -1); + double heading = data.optDouble("heading", -1); + double acceleration = data.optDouble("acceleration", -1); + double yawRate = data.optDouble("yawRate", -1); + double speed = data.optDouble("speed", -1); + long satelliteTime = data.optLong("satelliteTime"); + long systemTime = data.optLong("systemTime"); + + //测试面板状态同步 + DebugConfig.setStatusData(DebugConfig.sLon, lon); + DebugConfig.setStatusData(DebugConfig.sLat, lat); CloudLocationInfo cloudLocationInfo = new CloudLocationInfo(); - cloudLocationInfo.setAlt( alt ); - cloudLocationInfo.setHeading( heading ); - cloudLocationInfo.setLat( lat ); - cloudLocationInfo.setLon( lon ); - cloudLocationInfo.setSpeed( speed ); - cloudLocationInfo.setSatelliteTime( satelliteTime ); - cloudLocationInfo.setSystemTime( systemTime ); - cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon,lat))); + cloudLocationInfo.setAlt(alt); + cloudLocationInfo.setHeading(heading); + cloudLocationInfo.setLat(lat); + cloudLocationInfo.setLon(lon); + cloudLocationInfo.setSpeed(speed); + cloudLocationInfo.setSatelliteTime(satelliteTime); + cloudLocationInfo.setSystemTime(systemTime); + cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon, lat))); mLastLocationInfo = cloudLocationInfo; - mMachineCacheList.add( cloudLocationInfo ); + mMachineCacheList.add(cloudLocationInfo); mCurSpeed = cloudLocationInfo.getSpeed(); mCurLon = cloudLocationInfo.getLon(); @@ -113,29 +119,29 @@ class SnapshotLocationController { * * @return 坐标合集 */ - public List< CloudLocationInfo > getSendLocationData() { + public List getSendLocationData() { - List< CloudLocationInfo > list = null; - if ( mMachineCacheList != null ) { + List list = null; + if (mMachineCacheList != null) { mDataAccuracy = 1; - list = new ArrayList<>( mMachineCacheList ); + list = new ArrayList<>(mMachineCacheList); mMachineCacheList.clear(); } - if ( list == null || list.isEmpty() ) { + if (list == null || list.isEmpty()) { mDataAccuracy = 0; - if ( mLocationList != null ) { - list = new ArrayList<>( mLocationList ); + if (mLocationList != null) { + list = new ArrayList<>(mLocationList); mLocationList.clear(); } } - if ( list == null || list.isEmpty() ) { - if ( mLastLocationInfo != null ) { + if (list == null || list.isEmpty()) { + if (mLastLocationInfo != null) { list = new ArrayList(); - list.add( mLastLocationInfo ); + list.add(mLastLocationInfo); mLastLocationInfo = null; } } - Logger.d( TAG, "upload loc size = %s", list == null ? 0 : list.size() ); + Logger.d(TAG, "upload loc size = %s", list == null ? 0 : list.size()); return list; } @@ -145,7 +151,7 @@ class SnapshotLocationController { * @return 精度 */ public int getDataAccuracy() { - Logger.d( TAG, "upload loc accuracy = %s", mDataAccuracy ); + Logger.d(TAG, "upload loc accuracy = %s", mDataAccuracy); return mDataAccuracy; } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java index 8c02e0b6f2..aee1f07bf2 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java @@ -30,7 +30,6 @@ import com.mogo.map.search.geo.query.MogoRegeocodeQuery; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.constants.DataTypes; import com.mogo.module.common.dialog.WMDialog; -import com.mogo.module.common.drawer.AdasRecognizedResultDrawer; import com.mogo.module.common.drawer.SnapshotSetDataDrawer; import com.mogo.module.common.uploadintime.SnapshotLocationController; import com.mogo.module.service.MarkerServiceHandler; @@ -48,7 +47,6 @@ import com.mogo.utils.logger.Logger; import com.mogo.utils.network.utils.GsonUtil; import com.mogo.utils.storage.SharedPrefsMgr; -import org.json.JSONArray; import org.json.JSONObject; import java.io.BufferedReader; @@ -70,107 +68,103 @@ public class MockIntentHandler implements IntentHandler { private IMogoMarker centerMarker; @Override - public void handle( Context context, Intent intent ) { - if ( !DebugConfig.isDebug() ) { + public void handle(Context context, Intent intent) { + if (!DebugConfig.isDebug()) { return; } - final int oper = intent.getIntExtra( "oper", -1 ); - switch ( oper ) { + final int oper = intent.getIntExtra("oper", -1); + switch (oper) { case 1: - MarkerServiceHandler.getMapUIController().showMyLocation( intent.getBooleanExtra( "status", true ) ); + MarkerServiceHandler.getMapUIController().showMyLocation(intent.getBooleanExtra("status", true)); break; case 2: - boolean status = intent.getBooleanExtra( "status", false ); - MarkerServiceHandler.getMogoStatusManager().setSeekHelping( TAG, status ); + boolean status = intent.getBooleanExtra("status", false); + MarkerServiceHandler.getMogoStatusManager().setSeekHelping(TAG, status); break; case 3: - String msg = intent.getStringExtra( "msg" ); - if ( !TextUtils.isEmpty( msg ) ) { - TipToast.shortTip( msg ); + String msg = intent.getStringExtra("msg"); + if (!TextUtils.isEmpty(msg)) { + TipToast.shortTip(msg); } break; case 4:// 测试左侧按钮1 - TextView button1 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton( ButtonIndex.BUTTON1 ); - if ( button1 != null ) { - button1.setVisibility( View.VISIBLE ); - button1.setBackgroundColor( Color.RED ); - button1.setOnClickListener( view -> { - } ); + TextView button1 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton(ButtonIndex.BUTTON1); + if (button1 != null) { + button1.setVisibility(View.VISIBLE); + button1.setBackgroundColor(Color.RED); + button1.setOnClickListener(view -> { + }); } break; case 5:// 测试左侧按钮2 - TextView button2 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton( ButtonIndex.BUTTON2 ); - if ( button2 != null ) { - button2.setOnClickListener( null ); - button2.setVisibility( View.GONE ); + TextView button2 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton(ButtonIndex.BUTTON2); + if (button2 != null) { + button2.setOnClickListener(null); + button2.setVisibility(View.GONE); } break; case 6:// - boolean status1 = intent.getBooleanExtra( "status", false ); - MarkerServiceHandler.getMogoStatusManager().setUploadingStatus( TAG, status1 ); + boolean status1 = intent.getBooleanExtra("status", false); + MarkerServiceHandler.getMogoStatusManager().setUploadingStatus(TAG, status1); break; case 7:// 打开微信 - TextView button11 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton( ButtonIndex.BUTTON1 ); - if ( button11 != null ) { - button11.setVisibility( View.VISIBLE ); - button11.setBackgroundColor( Color.RED ); - button11.setOnClickListener( view -> { + TextView button11 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton(ButtonIndex.BUTTON1); + if (button11 != null) { + button11.setVisibility(View.VISIBLE); + button11.setBackgroundColor(Color.RED); + button11.setOnClickListener(view -> { Intent intent1 = new Intent(); - intent1.setAction( Intent.ACTION_VIEW ); - intent1.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK ); - intent1.setData( Uri.parse( "wechathelper://com.zhidao.wechathelper/main/transform?type=navi&lon=116.327007&lat=39.977639&from=os2.0" ) ); + intent1.setAction(Intent.ACTION_VIEW); + intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent1.setData(Uri.parse("wechathelper://com.zhidao.wechathelper/main/transform?type=navi&lon=116.327007&lat=39.977639&from=os2.0")); try { - view.setOnClickListener( null ); - view.getContext().startActivity( intent1 ); - } catch ( Exception e ) { + view.setOnClickListener(null); + view.getContext().startActivity(intent1); + } catch (Exception e) { e.printStackTrace(); } - view.setVisibility( View.GONE ); - } ); + view.setVisibility(View.GONE); + }); } break; case 8:// 测试修改车头角度 - float bearing = intent.getFloatExtra( "bearing", 0 ); - MarkerServiceHandler.getMapUIController().changeBearing( bearing ); + float bearing = intent.getFloatExtra("bearing", 0); + MarkerServiceHandler.getMapUIController().changeBearing(bearing); break; case 9:// 测试弹窗 - new WMDialog.Builder( context ) - .setOkButton( "确认", ( dlg, which ) -> { - dlg.dismiss(); - } ) - .setCancelButton( "取消", ( dlg, which ) -> { - dlg.dismiss(); - } ) - .setContent( "内容内容内容内容内容内容内容内容" ) + new WMDialog.Builder(context) + .setOkButton("确认", (dlg, which) -> dlg.dismiss()) + .setCancelButton("取消", (dlg, which) -> dlg.dismiss()) + .setContent("内容内容内容内容内容内容内容内容") .build() .show(); break; case 10://测试GEO查询 - IMogoGeoSearch geoSearch = MarkerServiceHandler.getMapService().getGeoSearch( context ); - geoSearch.setGeoSearchListener( new IMogoGeoSearchListener() { + IMogoGeoSearch geoSearch = MarkerServiceHandler.getMapService().getGeoSearch(context); + geoSearch.setGeoSearchListener(new IMogoGeoSearchListener() { @Override - public void onRegeocodeSearched( MogoRegeocodeResult regeocodeResult ) { - Logger.d( TAG, GsonUtil.jsonFromObject( regeocodeResult ) ); + public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) { + Logger.d(TAG, GsonUtil.jsonFromObject(regeocodeResult)); } @Override - public void onGeocodeSearched( MogoGeocodeResult geocodeResult ) { + public void onGeocodeSearched(MogoGeocodeResult geocodeResult) { } - } ); + }); MogoRegeocodeQuery query = new MogoRegeocodeQuery(); - query.setLatlngType( "autonavi" ); - query.setPoint( new MogoLatLng( intent.getFloatExtra( "lat", 39.917366f ), intent.getFloatExtra( "lon", 116.39962f ) ) ); - query.setRadius( 1000 ); - geoSearch.getFromLocationAsyn( query ); + query.setLatlngType("autonavi"); + query.setPoint(new MogoLatLng(intent.getFloatExtra("lat", 39.917366f), intent.getFloatExtra("lon", 116.39962f))); + query.setRadius(1000); + geoSearch.getFromLocationAsyn(query); break; case 11:// 控制ADAS中的设置页面 - MarkerServiceHandler.getADASController().setSettingStatus( intent.getBooleanExtra( "status", false ) ); + MarkerServiceHandler.getADASController().setSettingStatus(intent.getBooleanExtra("status", false)); break; case 12: {// 控制ADAS显示隐藏 - boolean status2 = intent.getBooleanExtra( "status", false ); - if ( status2 ) { + boolean status2 = intent.getBooleanExtra("status", false); + if (status2) { MarkerServiceHandler.getADASController().showADAS(); } else { MarkerServiceHandler.getADASController().closeADAS(); @@ -178,10 +172,10 @@ public class MockIntentHandler implements IntentHandler { } break; case 13: {// 唤起高德地图 - double lat = intent.getFloatExtra( "lat", 0.0f ); - double lon = intent.getFloatExtra( "lon", 0.0f ); - boolean real = intent.getBooleanExtra( "real", false ); - MarkerServiceHandler.getRegisterCenter().registerMogoNaviListener( TAG, new IMogoNaviListener() { + double lat = intent.getFloatExtra("lat", 0.0f); + double lon = intent.getFloatExtra("lon", 0.0f); + boolean real = intent.getBooleanExtra("real", false); + MarkerServiceHandler.getRegisterCenter().registerMogoNaviListener(TAG, new IMogoNaviListener() { @Override public void onInitNaviFailure() { @@ -193,7 +187,7 @@ public class MockIntentHandler implements IntentHandler { } @Override - public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) { + public void onNaviInfoUpdate(MogoNaviInfo naviinfo) { } @@ -209,8 +203,8 @@ public class MockIntentHandler implements IntentHandler { @Override public void onCalculateSuccess() { - MarkerServiceHandler.getRegisterCenter().unregisterMogoNaviListener( TAG ); - MarkerServiceHandler.getNavi().startNavi( real ); + MarkerServiceHandler.getRegisterCenter().unregisterMogoNaviListener(TAG); + MarkerServiceHandler.getNavi().startNavi(real); } @Override @@ -219,134 +213,132 @@ public class MockIntentHandler implements IntentHandler { } @Override - public void onUpdateTraffic( MogoTraffic traffic ) { + public void onUpdateTraffic(MogoTraffic traffic) { } - } ); - MarkerServiceHandler.getNavi().naviTo( new MogoLatLng( lat, lon ) ); + }); + MarkerServiceHandler.getNavi().naviTo(new MogoLatLng(lat, lon)); } case 14: {//测试点的动画移动,模拟周边车辆移动 - List< MogoLatLng > mogoLatLngs = new ArrayList<>(); - mogoLatLngs.add( new MogoLatLng( 39.615986, 116.396716 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616007, 116.396995 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616012, 116.397169 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616017, 116.397343 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616022, 116.397517 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616029, 116.397693 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616039, 116.397896 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616051, 116.3981 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616058, 116.39827 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616066, 116.398441 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616074, 116.398612 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616083, 116.398787 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616093, 116.39899 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616105, 116.399195 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616112, 116.399334 ) ); - mogoLatLngs.add( new MogoLatLng( 39.61612, 116.399473 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616128, 116.399612 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616136, 116.399751 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616148, 116.399893 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616153, 116.40008 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616159, 116.400301 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616167, 116.400471 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616175, 116.400642 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616183, 116.400813 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616192, 116.400988 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616201, 116.401191 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616213, 116.401396 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616235, 116.401728 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616246, 116.401986 ) ); - mogoLatLngs.add( new MogoLatLng( 39.61625, 116.402146 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616255, 116.402307 ) ); - mogoLatLngs.add( new MogoLatLng( 39.61626, 116.402468 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616267, 116.40263 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616272, 116.402762 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616277, 116.402894 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616282, 116.403026 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616287, 116.403158 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616292, 116.40329 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616297, 116.403422 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616302, 116.403554 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616307, 116.403686 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616321, 116.403821 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616331, 116.404045 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616343, 116.404272 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616353, 116.404551 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616363, 116.404753 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616375, 116.404958 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616375, 116.405055 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616379, 116.405184 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616384, 116.405313 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616389, 116.405442 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616394, 116.405571 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616399, 116.4057 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616404, 116.405829 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616409, 116.405958 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616414, 116.406087 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616419, 116.406216 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616424, 116.406345 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616429, 116.406474 ) ); - mogoLatLngs.add( new MogoLatLng( 39.61644, 116.406611 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616461, 116.406879 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616465, 116.407033 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616469, 116.407187 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616473, 116.407341 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616477, 116.407495 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616483, 116.407694 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616493, 116.407876 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616504, 116.408059 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616515, 116.408327 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616526, 116.408596 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616536, 116.408757 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616547, 116.409025 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616556, 116.409227 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616568, 116.409432 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616579, 116.409711 ) ); - mogoLatLngs.add( new MogoLatLng( 39.61659, 116.409914 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616601, 116.410119 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616601, 116.410387 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616601, 116.410602 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616622, 116.410816 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616633, 116.411084 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616643, 116.411395 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616654, 116.411492 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616665, 116.411771 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616674, 116.411974 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616686, 116.412178 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616697, 116.412447 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616697, 116.412586 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616718, 116.412876 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616729, 116.413144 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616738, 116.413347 ) ); - mogoLatLngs.add( new MogoLatLng( 39.61675, 116.413551 ) ); - mogoLatLngs.add( new MogoLatLng( 39.61675, 116.41383 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616761, 116.414002 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616761, 116.414098 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616767, 116.414279 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616774, 116.414461 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616782, 116.414645 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616792, 116.41483 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616802, 116.415016 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616814, 116.415203 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616824, 116.415395 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616836, 116.415589 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616842, 116.415745 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616849, 116.415902 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616857, 116.416061 ) ); - mogoLatLngs.add( new MogoLatLng( 39.616868, 116.416307 ) ); + List mogoLatLngs = new ArrayList<>(); + mogoLatLngs.add(new MogoLatLng(39.615986, 116.396716)); + mogoLatLngs.add(new MogoLatLng(39.616007, 116.396995)); + mogoLatLngs.add(new MogoLatLng(39.616012, 116.397169)); + mogoLatLngs.add(new MogoLatLng(39.616017, 116.397343)); + mogoLatLngs.add(new MogoLatLng(39.616022, 116.397517)); + mogoLatLngs.add(new MogoLatLng(39.616029, 116.397693)); + mogoLatLngs.add(new MogoLatLng(39.616039, 116.397896)); + mogoLatLngs.add(new MogoLatLng(39.616051, 116.3981)); + mogoLatLngs.add(new MogoLatLng(39.616058, 116.39827)); + mogoLatLngs.add(new MogoLatLng(39.616066, 116.398441)); + mogoLatLngs.add(new MogoLatLng(39.616074, 116.398612)); + mogoLatLngs.add(new MogoLatLng(39.616083, 116.398787)); + mogoLatLngs.add(new MogoLatLng(39.616093, 116.39899)); + mogoLatLngs.add(new MogoLatLng(39.616105, 116.399195)); + mogoLatLngs.add(new MogoLatLng(39.616112, 116.399334)); + mogoLatLngs.add(new MogoLatLng(39.61612, 116.399473)); + mogoLatLngs.add(new MogoLatLng(39.616128, 116.399612)); + mogoLatLngs.add(new MogoLatLng(39.616136, 116.399751)); + mogoLatLngs.add(new MogoLatLng(39.616148, 116.399893)); + mogoLatLngs.add(new MogoLatLng(39.616153, 116.40008)); + mogoLatLngs.add(new MogoLatLng(39.616159, 116.400301)); + mogoLatLngs.add(new MogoLatLng(39.616167, 116.400471)); + mogoLatLngs.add(new MogoLatLng(39.616175, 116.400642)); + mogoLatLngs.add(new MogoLatLng(39.616183, 116.400813)); + mogoLatLngs.add(new MogoLatLng(39.616192, 116.400988)); + mogoLatLngs.add(new MogoLatLng(39.616201, 116.401191)); + mogoLatLngs.add(new MogoLatLng(39.616213, 116.401396)); + mogoLatLngs.add(new MogoLatLng(39.616235, 116.401728)); + mogoLatLngs.add(new MogoLatLng(39.616246, 116.401986)); + mogoLatLngs.add(new MogoLatLng(39.61625, 116.402146)); + mogoLatLngs.add(new MogoLatLng(39.616255, 116.402307)); + mogoLatLngs.add(new MogoLatLng(39.61626, 116.402468)); + mogoLatLngs.add(new MogoLatLng(39.616267, 116.40263)); + mogoLatLngs.add(new MogoLatLng(39.616272, 116.402762)); + mogoLatLngs.add(new MogoLatLng(39.616277, 116.402894)); + mogoLatLngs.add(new MogoLatLng(39.616282, 116.403026)); + mogoLatLngs.add(new MogoLatLng(39.616287, 116.403158)); + mogoLatLngs.add(new MogoLatLng(39.616292, 116.40329)); + mogoLatLngs.add(new MogoLatLng(39.616297, 116.403422)); + mogoLatLngs.add(new MogoLatLng(39.616302, 116.403554)); + mogoLatLngs.add(new MogoLatLng(39.616307, 116.403686)); + mogoLatLngs.add(new MogoLatLng(39.616321, 116.403821)); + mogoLatLngs.add(new MogoLatLng(39.616331, 116.404045)); + mogoLatLngs.add(new MogoLatLng(39.616343, 116.404272)); + mogoLatLngs.add(new MogoLatLng(39.616353, 116.404551)); + mogoLatLngs.add(new MogoLatLng(39.616363, 116.404753)); + mogoLatLngs.add(new MogoLatLng(39.616375, 116.404958)); + mogoLatLngs.add(new MogoLatLng(39.616375, 116.405055)); + mogoLatLngs.add(new MogoLatLng(39.616379, 116.405184)); + mogoLatLngs.add(new MogoLatLng(39.616384, 116.405313)); + mogoLatLngs.add(new MogoLatLng(39.616389, 116.405442)); + mogoLatLngs.add(new MogoLatLng(39.616394, 116.405571)); + mogoLatLngs.add(new MogoLatLng(39.616399, 116.4057)); + mogoLatLngs.add(new MogoLatLng(39.616404, 116.405829)); + mogoLatLngs.add(new MogoLatLng(39.616409, 116.405958)); + mogoLatLngs.add(new MogoLatLng(39.616414, 116.406087)); + mogoLatLngs.add(new MogoLatLng(39.616419, 116.406216)); + mogoLatLngs.add(new MogoLatLng(39.616424, 116.406345)); + mogoLatLngs.add(new MogoLatLng(39.616429, 116.406474)); + mogoLatLngs.add(new MogoLatLng(39.61644, 116.406611)); + mogoLatLngs.add(new MogoLatLng(39.616461, 116.406879)); + mogoLatLngs.add(new MogoLatLng(39.616465, 116.407033)); + mogoLatLngs.add(new MogoLatLng(39.616469, 116.407187)); + mogoLatLngs.add(new MogoLatLng(39.616473, 116.407341)); + mogoLatLngs.add(new MogoLatLng(39.616477, 116.407495)); + mogoLatLngs.add(new MogoLatLng(39.616483, 116.407694)); + mogoLatLngs.add(new MogoLatLng(39.616493, 116.407876)); + mogoLatLngs.add(new MogoLatLng(39.616504, 116.408059)); + mogoLatLngs.add(new MogoLatLng(39.616515, 116.408327)); + mogoLatLngs.add(new MogoLatLng(39.616526, 116.408596)); + mogoLatLngs.add(new MogoLatLng(39.616536, 116.408757)); + mogoLatLngs.add(new MogoLatLng(39.616547, 116.409025)); + mogoLatLngs.add(new MogoLatLng(39.616556, 116.409227)); + mogoLatLngs.add(new MogoLatLng(39.616568, 116.409432)); + mogoLatLngs.add(new MogoLatLng(39.616579, 116.409711)); + mogoLatLngs.add(new MogoLatLng(39.61659, 116.409914)); + mogoLatLngs.add(new MogoLatLng(39.616601, 116.410119)); + mogoLatLngs.add(new MogoLatLng(39.616601, 116.410387)); + mogoLatLngs.add(new MogoLatLng(39.616601, 116.410602)); + mogoLatLngs.add(new MogoLatLng(39.616622, 116.410816)); + mogoLatLngs.add(new MogoLatLng(39.616633, 116.411084)); + mogoLatLngs.add(new MogoLatLng(39.616643, 116.411395)); + mogoLatLngs.add(new MogoLatLng(39.616654, 116.411492)); + mogoLatLngs.add(new MogoLatLng(39.616665, 116.411771)); + mogoLatLngs.add(new MogoLatLng(39.616674, 116.411974)); + mogoLatLngs.add(new MogoLatLng(39.616686, 116.412178)); + mogoLatLngs.add(new MogoLatLng(39.616697, 116.412447)); + mogoLatLngs.add(new MogoLatLng(39.616697, 116.412586)); + mogoLatLngs.add(new MogoLatLng(39.616718, 116.412876)); + mogoLatLngs.add(new MogoLatLng(39.616729, 116.413144)); + mogoLatLngs.add(new MogoLatLng(39.616738, 116.413347)); + mogoLatLngs.add(new MogoLatLng(39.61675, 116.413551)); + mogoLatLngs.add(new MogoLatLng(39.61675, 116.41383)); + mogoLatLngs.add(new MogoLatLng(39.616761, 116.414002)); + mogoLatLngs.add(new MogoLatLng(39.616761, 116.414098)); + mogoLatLngs.add(new MogoLatLng(39.616767, 116.414279)); + mogoLatLngs.add(new MogoLatLng(39.616774, 116.414461)); + mogoLatLngs.add(new MogoLatLng(39.616782, 116.414645)); + mogoLatLngs.add(new MogoLatLng(39.616792, 116.41483)); + mogoLatLngs.add(new MogoLatLng(39.616802, 116.415016)); + mogoLatLngs.add(new MogoLatLng(39.616814, 116.415203)); + mogoLatLngs.add(new MogoLatLng(39.616824, 116.415395)); + mogoLatLngs.add(new MogoLatLng(39.616836, 116.415589)); + mogoLatLngs.add(new MogoLatLng(39.616842, 116.415745)); + mogoLatLngs.add(new MogoLatLng(39.616849, 116.415902)); + mogoLatLngs.add(new MogoLatLng(39.616857, 116.416061)); + mogoLatLngs.add(new MogoLatLng(39.616868, 116.416307)); MogoMarkerOptions options = new MogoMarkerOptions(); - options.icon( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_gray ) ) - .position( mogoLatLngs.get( 0 ) ) - .owner( TAG ) - .autoManager( false ); - int duration = intent.getIntExtra( "duration", 30 ); - MarkerServiceHandler.getApis().getRefreshStrategyControllerApi().restartAutoRefreshAtTime( duration ); - IMogoMarker marker = MarkerServiceHandler.getMarkerManager().addMarker( TAG, options ); - MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false ); - MarkerServiceHandler.getMapUIController().moveToCenter( mogoLatLngs.get( 0 ) ); - WorkThreadHandler.getInstance().post( () -> { - marker.startSmooth( mogoLatLngs, duration ); - } ); + options.icon(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_gray)) + .position(mogoLatLngs.get(0)) + .owner(TAG) + .autoManager(false); + int duration = intent.getIntExtra("duration", 30); + MarkerServiceHandler.getApis().getRefreshStrategyControllerApi().restartAutoRefreshAtTime(duration); + IMogoMarker marker = MarkerServiceHandler.getMarkerManager().addMarker(TAG, options); + MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus(TAG, true, false); + MarkerServiceHandler.getMapUIController().moveToCenter(mogoLatLngs.get(0)); + WorkThreadHandler.getInstance().post(() -> marker.startSmooth(mogoLatLngs, duration)); } break; // case 15: @@ -356,31 +348,31 @@ public class MockIntentHandler implements IntentHandler { // MarkerServiceHandler.getGpsSimulatorManager().close(); // break; case 17:// 查询在线车辆数据 - DebugConfig.setRequestOnlineCarData( intent.getBooleanExtra( "status", true ) ); + DebugConfig.setRequestOnlineCarData(intent.getBooleanExtra("status", true)); break; case 18:// 设置是否使用自研地图 - TipToast.shortTip( "设置完成,下次启动生效" ); - SharedPrefsMgr.getInstance( context ).putBoolean( "useCustomMap", intent.getBooleanExtra( "useCustomMap", false ) ); + TipToast.shortTip("设置完成,下次启动生效"); + SharedPrefsMgr.getInstance(context).putBoolean("useCustomMap", intent.getBooleanExtra("useCustomMap", false)); break; case 30:// 强制刷新地图 MarkerServiceHandler.getMapService().getMapUIController().forceRender(); break; case 31:// Intent intent3 = new Intent(); - intent3.setAction( "AUTONAVI_STANDARD_BROADCAST_RECV" ); - intent3.putExtra( "KEY_TYPE", 12404 ); - intent3.putExtra( "EXTRA_REQUEST_AUTO_STATE", 0 ); - context.sendBroadcast( intent3 ); + intent3.setAction("AUTONAVI_STANDARD_BROADCAST_RECV"); + intent3.putExtra("KEY_TYPE", 12404); + intent3.putExtra("EXTRA_REQUEST_AUTO_STATE", 0); + context.sendBroadcast(intent3); break; case 32:// 控制实时路况 - MarkerServiceHandler.getMapService().getMapUIController().setTrafficEnabled( true ); + MarkerServiceHandler.getMapService().getMapUIController().setTrafficEnabled(true); break; case 33:// 测试小智语音 - AIAssist.getInstance( context ).speakTTSVoice( "庞帆说这个是一个 hard coding." ); + AIAssist.getInstance(context).speakTTSVoice("庞帆说这个是一个 hard coding."); break; case 34:// 修改地图模式VR OR 2D - int type = intent.getIntExtra( "type", 0 ); - if ( type != 0 ) { + int type = intent.getIntExtra("type", 0); + if (type != 0) { MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().changeToVRMode(); } else { MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().changeTo2dMode(); @@ -394,23 +386,23 @@ public class MockIntentHandler implements IntentHandler { .getMapServiceApi().getMapUIController() .getWindowCenterLocation(); centerMarker = MogoApisHandler.getInstance().getApis() - .getMapServiceApi().getMarkerManager( context ) - .addMarker( TAG, new MogoMarkerOptions() - .position( center ) - .icon( BitmapFactory.decodeResource( context.getResources(), R.drawable.bg_map_marker_red ) ) ); + .getMapServiceApi().getMarkerManager(context) + .addMarker(TAG, new MogoMarkerOptions() + .position(center) + .icon(BitmapFactory.decodeResource(context.getResources(), R.drawable.bg_map_marker_red))); break; case 37:// 销毁测试打点 - if ( centerMarker != null ) { + if (centerMarker != null) { centerMarker.destroy(); } break; case 38:// 控制RTK MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController() - .rtkEnable( false ); + .rtkEnable(false); break; case 39:// 使用自动驾驶车的定位数据 MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController() - .syncLocation2Map( null ); + .syncLocation2Map(null); break; case 40: @@ -486,147 +478,147 @@ public class MockIntentHandler implements IntentHandler { {40.202545166015625, 116.7392807006836}, {40.20254898071289, 116.73928833007812}, {40.20254135131836, 116.7392807006836}}; - for ( double[] coor : coors ) { + for (double[] coor : coors) { double lat = coor[0], lon = coor[1]; - double[] translateCoor = CoordinateUtils.transformWgsToGcj( lat, lon ); - double[] originCoor = CoordinateUtils.transformGcj02toWgs84( translateCoor[1], translateCoor[0] ); - double delta = CoordinateUtils.calculateLineDistance( lon, lat, originCoor[0], originCoor[1] ); - Logger.d( TAG, "偏差值:%s", delta ); + double[] translateCoor = CoordinateUtils.transformWgsToGcj(lat, lon); + double[] originCoor = CoordinateUtils.transformGcj02toWgs84(translateCoor[1], translateCoor[0]); + double delta = CoordinateUtils.calculateLineDistance(lon, lat, originCoor[0], originCoor[1]); + Logger.d(TAG, "偏差值:%s", delta); } break; case 41:// // adb shell am broadcast -a com.mogo.mock --ei oper 41 --ei type 0 平滑移动 // adb shell am broadcast -a com.mogo.mock --ei oper 41 --ei type 1 直接打点 - DebugConfig.setNotSmooth( intent.getIntExtra( "type", 0 ) == 1 ); + DebugConfig.setNotSmooth(intent.getIntExtra("type", 0) == 1); break; case 42:// - WorkThreadHandler.getInstance().post( () -> { + WorkThreadHandler.getInstance().post(() -> { try { - InputStream is = context.getAssets().open( "coors.json" ); - BufferedReader br = new BufferedReader( new InputStreamReader( is ) ); + InputStream is = context.getAssets().open("coors.json"); + BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line = ""; - List< ADASCarStateInfo > vals = new ArrayList<>(); - while ( ( line = br.readLine() ) != null ) { - String[] json = line.split( " - " ); - long time = Long.valueOf( json[0] ); - ADASCarStateInfo si = GsonUtil.objectFromJson( json[1], ADASCarStateInfo.class ); + List vals = new ArrayList<>(); + while ((line = br.readLine()) != null) { + String[] json = line.split(" - "); + long time = Long.parseLong(json[0]); + ADASCarStateInfo si = GsonUtil.objectFromJson(json[1], ADASCarStateInfo.class); // si.getValues().setSatelliteTime( time + "" ); - vals.add( si ); + vals.add(si); } long interval = -1; ADASCarStateInfo last = null; - for ( ADASCarStateInfo val : vals ) { - if ( last == null ) { + for (ADASCarStateInfo val : vals) { + if (last == null) { interval = 0; } else { - interval = Long.valueOf( val.getValues().getSatelliteTime() ) - Long.valueOf( last.getValues().getSatelliteTime() ); + interval = Long.parseLong(val.getValues().getSatelliteTime()) - Long.parseLong(last.getValues().getSatelliteTime()); } last = val; - WorkThreadHandler.getInstance().postDelayed( () -> { - onAdasCarDataCallback( val ); - }, interval ); + WorkThreadHandler.getInstance().postDelayed(() -> onAdasCarDataCallback(val), interval); } - } catch ( Exception e ) { + } catch (Exception e) { e.printStackTrace(); } - } ); + }); break; case 43:// MogoApisHandler.getInstance() .getApis() .getAdasControllerApi() - .onAutopilotArriveLike( intent.getIntExtra( "type", 8 ) ); + .onAutopilotArriveLike(intent.getIntExtra("type", 8)); break; case 44:// 控制自动驾驶 RemoteControlAutoPilotParameters parameters = new RemoteControlAutoPilotParameters(); parameters.vehicleType = 9; - parameters.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( 40.1690522746, 116.567374558 ); - parameters.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( 40.1651999405, 116.567217441 ); + parameters.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat(40.1690522746, 116.567374558); + parameters.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat(40.1651999405, 116.567217441); MogoApisHandler.getInstance() .getApis() .getAdasControllerApi() - .aiCloudToAdasData( parameters ); + .aiCloudToAdasData(parameters); break; case 45:// 测试开启鹰眼模式 MogoApisHandler.getInstance() .getApis() .getMapServiceApi() .getMapUIController() - .openVrMode( false ); + .openVrMode(false); break; case 46:// 模拟 自车周边数据 String json = "{\"allList\":[{\"type\":3,\"uuid\":\"10009-5152\",\"lat\":40.1990809296,\"lon\":116.7393252195,\"speed\":0.0,\"heading\":0.0,\"systemTime\":1614329151909,\"vehicleType\":0,\"distance\":576.0,\"fromType\":3,\"isOnline\":0},{\"type\":3,\"uuid\":\"10009-5161\",\"lat\":40.1990827227,\"lon\":116.739325826,\"speed\":0.0,\"heading\":0.0,\"systemTime\":1614329151909,\"vehicleType\":0,\"distance\":576.0,\"fromType\":3,\"isOnline\":0}],\"nearList\":[],\"time\":1614329152238}"; - SnapshotSetDataDrawer.getInstance().renderSnapshotData( GsonUtil.objectFromJson( json, MogoSnapshotSetData.class ) ); + SnapshotSetDataDrawer.getInstance().renderSnapshotData(GsonUtil.objectFromJson(json, MogoSnapshotSetData.class)); break; case 47:// 模拟鹰眼模式下绘制车辆周边的数据 - mTimeTickHandler.sendEmptyMessageDelayed( 1, 0L ); + mTimeTickHandler.sendEmptyMessageDelayed(1, 0L); break; case 48:// 模拟3D模型绘制 MogoMarkerOptions options = new MogoMarkerOptions() - .owner( DataTypes.TYPE_MARKER_ADAS ) - .anchor( 0.5f, 0.5f ) - .set3DMode( true ) - .position( new MogoLatLng( 39.981971055705, 116.41150648393 ) ) - .gps( true ) - .controlAngle( true ) - .icon3DRes( R.raw.othercar ) - .rotate( ( float ) 358.526123 ); - IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( context ).addMarker( DataTypes.TYPE_MARKER_ADAS, options ); - List< MogoLatLng > latLngs = new ArrayList<>(); - latLngs.add( new MogoLatLng( 39.981971055705, 116.41150648393 ) ); - latLngs.add( new MogoLatLng( 39.981990561932, 116.412893641626 ) ); - marker.startSmoothInMs( latLngs, 20_000L ); + .owner(DataTypes.TYPE_MARKER_ADAS) + .anchor(0.5f, 0.5f) + .set3DMode(true) + .position(new MogoLatLng(39.981971055705, 116.41150648393)) + .gps(true) + .controlAngle(true) + .icon3DRes(R.raw.othercar) + .rotate((float) 358.526123); + IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(context).addMarker(DataTypes.TYPE_MARKER_ADAS, options); + List latLngs = new ArrayList<>(); + latLngs.add(new MogoLatLng(39.981971055705, 116.41150648393)); + latLngs.add(new MogoLatLng(39.981990561932, 116.412893641626)); + marker.startSmoothInMs(latLngs, 20_000L); break; case 49:// 绘制marker // 39.96741320378243, 116.41045709250723 // 39.98232698552779,116.41879656379113; MogoMarkerOptions options1 = new MogoMarkerOptions() - .owner( DataTypes.TYPE_MARKER_ADAS ) - .anchor( 0.5f, 0.5f ) - .set3DMode( false ) - .position( new MogoLatLng( 39.96741320378243, 116.41045709250723 ) ) - .gps( true ) - .controlAngle( false ) - .icon( BitmapFactory.decodeResource( context.getResources(), R.drawable.sy ) ) - .rotate( ( float ) 358.526123 ); - IMogoMarker marker1 = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( context ).addMarker( DataTypes.TYPE_MARKER_ADAS, options1 ); + .owner(DataTypes.TYPE_MARKER_ADAS) + .anchor(0.5f, 0.5f) + .set3DMode(false) + .position(new MogoLatLng(39.96741320378243, 116.41045709250723)) + .gps(true) + .controlAngle(false) + .icon(BitmapFactory.decodeResource(context.getResources(), R.drawable.sy)) + .rotate((float) 358.526123); + IMogoMarker marker1 = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(context).addMarker(DataTypes.TYPE_MARKER_ADAS, options1); MogoMarkerOptions options2 = new MogoMarkerOptions() - .owner( DataTypes.TYPE_MARKER_ADAS ) - .anchor( 0.5f, 0.5f ) - .set3DMode( false ) - .position( new MogoLatLng( 39.98232698552779, 116.41879656379113 ) ) - .gps( true ) - .controlAngle( false ) - .icon( BitmapFactory.decodeResource( context.getResources(), R.drawable.sr ) ) - .rotate( ( float ) 358.526123 ); - IMogoMarker marker2 = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( context ).addMarker( DataTypes.TYPE_MARKER_ADAS, options2 ); + .owner(DataTypes.TYPE_MARKER_ADAS) + .anchor(0.5f, 0.5f) + .set3DMode(false) + .position(new MogoLatLng(39.98232698552779, 116.41879656379113)) + .gps(true) + .controlAngle(false) + .icon(BitmapFactory.decodeResource(context.getResources(), R.drawable.sr)) + .rotate((float) 358.526123); + IMogoMarker marker2 = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(context).addMarker(DataTypes.TYPE_MARKER_ADAS, options2); MogoMarkerOptions options3 = new MogoMarkerOptions() - .owner( DataTypes.TYPE_MARKER_ADAS ) - .anchor( 0.5f, 0.5f ) - .set3DMode( false ) - .position( new MogoLatLng( 39.97631642243, 116.418249382739 ) ) - .gps( true ) - .controlAngle( false ) - .icon( BitmapFactory.decodeResource( context.getResources(), R.drawable.bg_map_marker_red ) ) - .rotate( ( float ) 358.526123 ); - IMogoMarker marker3 = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( context ).addMarker( DataTypes.TYPE_MARKER_ADAS, options3 ); + .owner(DataTypes.TYPE_MARKER_ADAS) + .anchor(0.5f, 0.5f) + .set3DMode(false) + .position(new MogoLatLng(39.97631642243, 116.418249382739)) + .gps(true) + .controlAngle(false) + .icon(BitmapFactory.decodeResource(context.getResources(), R.drawable.bg_map_marker_red)) + .rotate((float) 358.526123); + IMogoMarker marker3 = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(context).addMarker(DataTypes.TYPE_MARKER_ADAS, options3); break; case 50:// - DebugConfig.setSelfCarSpeedYOffset( intent.getIntExtra( "yOffset", 20 ) ); + DebugConfig.setSelfCarSpeedYOffset(intent.getIntExtra("yOffset", 20)); break; case 51:// 模拟路口车辆移动 - mLocationMockHandler.sendEmptyMessageDelayed( 100, 0L ); - mLocationMockHandler.sendEmptyMessageDelayed( 101, 1000L ); + mLocationMockHandler.sendEmptyMessageDelayed(100, 0L); + mLocationMockHandler.sendEmptyMessageDelayed(101, 1000L); break; - case 52:// 打开连调工控机、ADAS的控制面板 - EnvStatusManager.getInstance().showPanel( context ); + case 52: + // 打开连调工控机、ADAS的控制面板 + //adb shell am broadcast -a com.mogo.mock --ei oper 52 + EnvStatusManager.getInstance().showPanel(context); break; case 53:// 控制 Adas识别 是否可用 - boolean isUseAdasRecognize = intent.getBooleanExtra( "status", false ); - DebugConfig.setUseAdasRecognize( isUseAdasRecognize ); + boolean isUseAdasRecognize = intent.getBooleanExtra("status", false); + DebugConfig.setUseAdasRecognize(isUseAdasRecognize); break; case 54: - mTimeTickCarHandler.sendEmptyMessageDelayed( 1, 0L ); + mTimeTickCarHandler.sendEmptyMessageDelayed(1, 0L); break; } } @@ -635,111 +627,112 @@ public class MockIntentHandler implements IntentHandler { private JSONObject locJo = null; private void handleMockSingleLocDataIntent() throws Exception { - if ( locJo == null ) { + if (locJo == null) { String locLine = "{\"systemTime\":1615529718585,\"satelliteTime\":1615529718585,\"lon\":116.73573385415098,\"lat\":40.19907712731953,\"alt\":34.4018669128417,\"heading\":0.342695406938048,\"speed\":0.003303937}"; - locJo = new JSONObject( locLine ); - locJo.put( "satelliteTime", System.currentTimeMillis() ); - locJo.put( "systemTime", System.currentTimeMillis() ); + locJo = new JSONObject(locLine); + locJo.put("satelliteTime", System.currentTimeMillis()); + locJo.put("systemTime", System.currentTimeMillis()); } - MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( locJo ); - mLocationMockHandler.sendEmptyMessageDelayed( 100, 50L ); + MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(locJo); + mLocationMockHandler.sendEmptyMessageDelayed(100, 50L); } private void handleRoadSideMockDataIntent() throws Exception { - if ( roadSizeBr == null ) { - roadSizeBr = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "roadSide.txt" ) ) ); + if (roadSizeBr == null) { + roadSizeBr = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("roadSide.txt"))); } String carsLine = roadSizeBr.readLine(); MogoSnapshotSetData data = new MogoSnapshotSetData(); - List< CloudRoadData > allList = GsonUtil.arrayFromJson( carsLine, CloudRoadData.class ); - for ( CloudRoadData cloudRoadData : allList ) { - cloudRoadData.setWgslat( cloudRoadData.getLat() ); - cloudRoadData.setWgslon( cloudRoadData.getLon() ); - cloudRoadData.setFromType( CloudRoadData.FROM_ROAD_UNIT ); + List allList = GsonUtil.arrayFromJson(carsLine, CloudRoadData.class); + for (CloudRoadData cloudRoadData : allList) { + cloudRoadData.setWgslat(cloudRoadData.getLat()); + cloudRoadData.setWgslon(cloudRoadData.getLon()); + cloudRoadData.setFromType(CloudRoadData.FROM_ROAD_UNIT); } - data.setAllList( allList ); - SnapshotSetDataDrawer.getInstance().renderSnapshotData( data ); - mLocationMockHandler.sendEmptyMessageDelayed( 101, 100L ); + data.setAllList(allList); + SnapshotSetDataDrawer.getInstance().renderSnapshotData(data); + mLocationMockHandler.sendEmptyMessageDelayed(101, 100L); } - public void onAdasCarDataCallback( ADASCarStateInfo stateInfo ) { - if ( stateInfo != null && stateInfo.getValues() != null ) { + + public void onAdasCarDataCallback(ADASCarStateInfo stateInfo) { + if (stateInfo != null && stateInfo.getValues() != null) { JSONObject data = new JSONObject(); try { - data.putOpt( "lon", stateInfo.getValues().getLon() ); - data.putOpt( "lat", stateInfo.getValues().getLat() ); - data.putOpt( "alt", stateInfo.getValues().getAlt() ); - data.putOpt( "speed", stateInfo.getValues().getGnss_speed() ); - data.putOpt( "satelliteTime", stateInfo.getValues().getSatelliteTime() ); - data.putOpt( "heading", stateInfo.getValues().getHeading() ); - data.putOpt( "acceleration", stateInfo.getValues().getAcceleration() ); - data.putOpt( "yawRate", stateInfo.getValues().getYaw_rate() ); - MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( data ); + data.putOpt("lon", stateInfo.getValues().getLon()); + data.putOpt("lat", stateInfo.getValues().getLat()); + data.putOpt("alt", stateInfo.getValues().getAlt()); + data.putOpt("speed", stateInfo.getValues().getGnss_speed()); + data.putOpt("satelliteTime", stateInfo.getValues().getSatelliteTime()); + data.putOpt("heading", stateInfo.getValues().getHeading()); + data.putOpt("acceleration", stateInfo.getValues().getAcceleration()); + data.putOpt("yawRate", stateInfo.getValues().getYaw_rate()); + MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(data); // SnapshotUploadInTime.getInstance().syncAdasLocationInfo( data ); - } catch ( Exception e ) { + } catch (Exception e) { e.printStackTrace(); } } } - private Handler mLocationMockHandler = new Handler( WorkThreadHandler.newInstance( "loc-mock-thread" ).getLooper() ) { + private final Handler mLocationMockHandler = new Handler(WorkThreadHandler.newInstance("loc-mock-thread").getLooper()) { @Override - public void handleMessage( Message msg ) { - super.handleMessage( msg ); - if ( msg.what == 1 ) { + public void handleMessage(Message msg) { + super.handleMessage(msg); + if (msg.what == 1) { try { - if ( !handleMockLocationIntent() ) { + if (!handleMockLocationIntent()) { br.close(); br = null; } - } catch ( Exception e ) { + } catch (Exception e) { try { br.close(); - } catch ( IOException ex ) { + } catch (IOException ex) { ex.printStackTrace(); } br = null; } - } else if ( msg.what == 21 ) { + } else if (msg.what == 21) { try { handleMockSnapshotIntent2(); - } catch ( Exception e ) { + } catch (Exception e) { try { br4.close(); - } catch ( IOException ex ) { + } catch (IOException ex) { ex.printStackTrace(); } } - } else if ( msg.what == 3 ) { + } else if (msg.what == 3) { try { handleMockAdasIntent(); - } catch ( Exception e ) { + } catch (Exception e) { try { - if ( readers != null ) { - for ( BufferedReader reader : readers ) { + if (readers != null) { + for (BufferedReader reader : readers) { reader.close(); } } - } catch ( IOException ex ) { + } catch (IOException ex) { ex.printStackTrace(); } readers = null; } - } else if ( msg.what == 100 ) { + } else if (msg.what == 100) { try { handleMockSingleLocDataIntent(); - } catch ( Exception e ) { + } catch (Exception e) { e.printStackTrace(); } - } else if ( msg.what == 101 ) { + } else if (msg.what == 101) { try { handleRoadSideMockDataIntent(); - } catch ( Exception e ) { + } catch (Exception e) { try { roadSizeBr.close(); - } catch ( IOException ex ) { + } catch (IOException ex) { ex.printStackTrace(); } roadSizeBr = null; @@ -747,16 +740,16 @@ public class MockIntentHandler implements IntentHandler { } else if (msg.what == 8) { try { handleMockAdasCarIntent(); - } catch ( Exception e ) { + } catch (Exception e) { try { - if ( readers2 != null ) { - for ( BufferedReader reader : readers2 ) { + if (readers2 != null) { + for (BufferedReader reader : readers2) { if (reader != null) { reader.close(); } } } - } catch ( IOException ex ) { + } catch (IOException ex) { ex.printStackTrace(); } readers2 = null; @@ -766,20 +759,20 @@ public class MockIntentHandler implements IntentHandler { }; - private Handler mLocationMockHandler1 = new Handler( WorkThreadHandler.newInstance( "loc-mock-thread1" ).getLooper() ) { + private final Handler mLocationMockHandler1 = new Handler(WorkThreadHandler.newInstance("loc-mock-thread1").getLooper()) { @Override - public void handleMessage( Message msg ) { - super.handleMessage( msg ); - if ( msg.what == 1 ) { + public void handleMessage(Message msg) { + super.handleMessage(msg); + if (msg.what == 1) { try { - if ( !handleMockLocationIntent() ) { + if (!handleMockLocationIntent()) { br.close(); br = null; } - } catch ( Exception e ) { + } catch (Exception e) { try { br.close(); - } catch ( IOException ex ) { + } catch (IOException ex) { ex.printStackTrace(); } br = null; @@ -790,49 +783,49 @@ public class MockIntentHandler implements IntentHandler { private long mLocDelay = 0; - private Handler mTimeTickHandler = new Handler( WorkThreadHandler.newInstance( "loc-mock-thread2" ).getLooper() ) { + private final Handler mTimeTickHandler = new Handler(WorkThreadHandler.newInstance("loc-mock-thread2").getLooper()) { @Override - public void handleMessage( Message msg ) { - super.handleMessage( msg ); + public void handleMessage(Message msg) { + super.handleMessage(msg); mLocDelay += 50; - if ( mLocDelay > 4_000L ) { - mLocationMockHandler1.sendEmptyMessageDelayed( 1, 0L ); + if (mLocDelay > 4_000L) { + mLocationMockHandler1.sendEmptyMessageDelayed(1, 0L); } - mLocationMockHandler.sendEmptyMessageDelayed( 3, 0L ); - mTimeTickHandler.sendEmptyMessageDelayed( 0, 50L ); + mLocationMockHandler.sendEmptyMessageDelayed(3, 0L); + mTimeTickHandler.sendEmptyMessageDelayed(0, 50L); } }; - private Handler mTimeTickCarHandler = new Handler( WorkThreadHandler.newInstance( "loc-time-mock-thread" ).getLooper() ) { + private final Handler mTimeTickCarHandler = new Handler(WorkThreadHandler.newInstance("loc-time-mock-thread").getLooper()) { @Override - public void handleMessage( Message msg ) { - super.handleMessage( msg ); + public void handleMessage(Message msg) { + super.handleMessage(msg); mLocDelay += 50; - if ( mLocDelay > 4_000L ) { - mLocationMockHandler1.sendEmptyMessageDelayed( 1, 0L ); + if (mLocDelay > 4_000L) { + mLocationMockHandler1.sendEmptyMessageDelayed(1, 0L); } - mLocationMockHandler.sendEmptyMessageDelayed( 8, 0L ); - mTimeTickCarHandler.sendEmptyMessageDelayed( 0, 50L ); + mLocationMockHandler.sendEmptyMessageDelayed(8, 0L); + mTimeTickCarHandler.sendEmptyMessageDelayed(0, 50L); } }; private BufferedReader br; private boolean handleMockLocationIntent() throws Exception { - if ( br == null ) { - br = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "loc.txt" ) ) ); + if (br == null) { + br = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("loc.txt"))); } final long start = System.currentTimeMillis(); String line = br.readLine(); - if ( line == null ) { - throw new Exception( "end of file." ); + if (line == null) { + throw new Exception("end of file."); } - JSONObject jo = new JSONObject( line ); + JSONObject jo = new JSONObject(line); //改变rtk定位数据,触发自车移动 - MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( jo ); - Log.i( "mock-timer-loc-map", "cost " + ( System.currentTimeMillis() - start ) + "ms" ); - SnapshotLocationController.getInstance().syncAdasLocationInfo( jo ); - Log.i( "mock-timer-loc", "cost " + ( System.currentTimeMillis() - start ) + "ms" ); + MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(jo); + Log.i("mock-timer-loc-map", "cost " + (System.currentTimeMillis() - start) + "ms"); + SnapshotLocationController.getInstance().syncAdasLocationInfo(jo); + Log.i("mock-timer-loc", "cost " + (System.currentTimeMillis() - start) + "ms"); return true; } @@ -840,28 +833,28 @@ public class MockIntentHandler implements IntentHandler { private BufferedReader br4; private boolean handleMockSnapshotIntent2() throws Exception { - if ( br4 == null ) { - br4 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "snapshot.txt" ) ) ); + if (br4 == null) { + br4 = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("snapshot.txt"))); } String line = br4.readLine(); - if ( line == null ) { - throw new Exception( "end of file 2." ); + if (line == null) { + throw new Exception("end of file 2."); } MogoSnapshotSetData data = new MogoSnapshotSetData(); - List< CloudRoadData > allList = new ArrayList<>(); - CloudRoadData cloudRoadData = GsonUtil.objectFromJson( line, CloudRoadData.class ); - if ( cloudRoadData == null ) { + List allList = new ArrayList<>(); + CloudRoadData cloudRoadData = GsonUtil.objectFromJson(line, CloudRoadData.class); + if (cloudRoadData == null) { return false; } - cloudRoadData.setWgslon( cloudRoadData.getLon() ); - cloudRoadData.setWgslat( cloudRoadData.getLat() ); - cloudRoadData.setUuid( "1_21" ); - allList.add( cloudRoadData ); - data.setAllList( allList ); + cloudRoadData.setWgslon(cloudRoadData.getLon()); + cloudRoadData.setWgslat(cloudRoadData.getLat()); + cloudRoadData.setUuid("1_21"); + allList.add(cloudRoadData); + data.setAllList(allList); final long start = System.currentTimeMillis(); - SnapshotSetDataDrawer.getInstance().renderSnapshotData( data ); - Log.i( "mock-timer-snapshot", "cost " + ( System.currentTimeMillis() - start ) + "ms" ); + SnapshotSetDataDrawer.getInstance().renderSnapshotData(data); + Log.i("mock-timer-snapshot", "cost " + (System.currentTimeMillis() - start) + "ms"); // mLocationMockHandler.sendEmptyMessageDelayed( 21, 100L ); return true; } @@ -872,58 +865,58 @@ public class MockIntentHandler implements IntentHandler { private boolean handleMockAdasIntent() throws Exception { final long start = System.currentTimeMillis(); - if ( readers == null ) { + if (readers == null) { readers = new BufferedReader[10]; - for ( int i = 0; i < 10; i++ ) { - readers[i] = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas" + i + ".txt" ) ) ); + for (int i = 0; i < 10; i++) { + readers[i] = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("adas" + i + ".txt"))); } } - List< ADASRecognizedResult > allList = new ArrayList<>(); - for ( BufferedReader reader : readers ) { + List allList = new ArrayList<>(); + for (BufferedReader reader : readers) { String line = reader.readLine(); - ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class ); - if ( adasRecognizedResult != null ) { - allList.add( adasRecognizedResult ); + ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson(line, ADASRecognizedResult.class); + if (adasRecognizedResult != null) { + allList.add(adasRecognizedResult); } } AdasRec adasRec = new AdasRec(); adasRec.models = allList; - MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockAdasRecognized( GsonUtil.jsonFromObject( adasRec ) ); - Log.i( "mock-timer-adas", "cost " + ( System.currentTimeMillis() - start ) + "ms" ); + MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockAdasRecognized(GsonUtil.jsonFromObject(adasRec)); + Log.i("mock-timer-adas", "cost " + (System.currentTimeMillis() - start) + "ms"); return true; } private boolean handleMockAdasCarIntent() throws Exception { final long start = System.currentTimeMillis(); - if ( readers2 == null ) { + if (readers2 == null) { readers2 = new BufferedReader[3]; - for ( int i = 0; i < 3; i++ ) { - readers2[i] = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adascar" + i + ".txt" ) ) ); + for (int i = 0; i < 3; i++) { + readers2[i] = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("adascar" + i + ".txt"))); } } - List< ADASRecognizedResult > allList = new ArrayList<>(); - for ( BufferedReader reader : readers2 ) { + List allList = new ArrayList<>(); + for (BufferedReader reader : readers2) { String line = reader.readLine(); - ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class ); - if ( adasRecognizedResult != null ) { - allList.add( adasRecognizedResult ); + ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson(line, ADASRecognizedResult.class); + if (adasRecognizedResult != null) { + allList.add(adasRecognizedResult); } } AdasRec adasRec = new AdasRec(); adasRec.models = allList; - MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockAdasRecognized( GsonUtil.jsonFromObject( adasRec ) ); - Log.i( "mock-timer-adas", "cost " + ( System.currentTimeMillis() - start ) + "ms" ); + MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockAdasRecognized(GsonUtil.jsonFromObject(adasRec)); + Log.i("mock-timer-adas", "cost " + (System.currentTimeMillis() - start) + "ms"); return true; } - public static class AdasRec{ + public static class AdasRec { public String action = "view"; public List models; } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/status/EnvStatusManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/status/EnvStatusManager.java index bc3cdc3824..75f0f85f6c 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/status/EnvStatusManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/status/EnvStatusManager.java @@ -15,14 +15,14 @@ import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.wm.WindowManagerView; import com.mogo.module.service.R; -public -/** + +/* * @author congtaowang * @since 2021/3/17 * * 环境状态 */ -class EnvStatusManager { +public class EnvStatusManager { private static volatile EnvStatusManager sInstance; @@ -30,9 +30,9 @@ class EnvStatusManager { } public static EnvStatusManager getInstance() { - if ( sInstance == null ) { - synchronized ( EnvStatusManager.class ) { - if ( sInstance == null ) { + if (sInstance == null) { + synchronized (EnvStatusManager.class) { + if (sInstance == null) { sInstance = new EnvStatusManager(); } } @@ -51,13 +51,13 @@ class EnvStatusManager { private WindowManagerView mPanelView; private TextView mStatusTv; - private Handler mMainHandler = new Handler( Looper.getMainLooper() ) { + private final Handler mMainHandler = new Handler(Looper.getMainLooper()) { @Override - public void handleMessage( Message msg ) { - super.handleMessage( msg ); - if ( mPanelView.isShowing() ) { + public void handleMessage(Message msg) { + super.handleMessage(msg); + if (mPanelView.isShowing()) { renderStatus(); - mMainHandler.sendEmptyMessageDelayed( MSG, 5_000L ); + mMainHandler.sendEmptyMessageDelayed(MSG, 5_000L); } } }; @@ -69,54 +69,54 @@ class EnvStatusManager { "近景", "下发", "AUTO", - "长链" + "长链", + "经度", + "纬度" }; StringBuilder stringBuilder = new StringBuilder(); - for ( int i = 0; i < sStatusName.length; i++ ) { - stringBuilder.append( sStatusName[i] ).append( ":" ); - if ( i != 3 ) { - stringBuilder.append( "true".equals( DebugConfig.getStatus( i, true ) ) ? "正常" : "异常" ).append( "\n" ); + for (int i = 0; i < sStatusName.length; i++) { + stringBuilder.append(sStatusName[i]).append(":"); + if (i == 3) { + stringBuilder.append(DebugConfig.getAutoPilotStatus()).append("\n"); + } else if (i == 5 || i == 6) { + stringBuilder.append(DebugConfig.getStatusData(i)).append("\n"); } else { - stringBuilder.append( DebugConfig.getAutoPilotStatus() ).append( "\n" ); + stringBuilder.append("true".equals(DebugConfig.getStatus(i, true)) ? "正常" : "异常").append("\n"); } } - mStatusTv.setText( stringBuilder ); - if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { - mStatusTv.setTextColor( Color.WHITE ); + mStatusTv.setText(stringBuilder); + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + mStatusTv.setTextColor(Color.WHITE); } else { - if ( MogoApisHandler.getInstance().getApis().getAdasControllerApi() - .getCurrentSkinMode() == EnumMapUI.Type_Light ) { - mStatusTv.setTextColor( Color.BLACK ); + if (MogoApisHandler.getInstance().getApis().getAdasControllerApi() + .getCurrentSkinMode() == EnumMapUI.Type_Light) { + mStatusTv.setTextColor(Color.BLACK); } else { - mStatusTv.setTextColor( Color.WHITE ); + mStatusTv.setTextColor(Color.WHITE); } } } - public void showPanel( Context context ) { - if ( mPanelView == null ) { - mPanelView = new WindowManagerView.Builder( context ) - .contentView( R.layout.module_services_status_panel ) - .position( 0, 100 ) - .size( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT ) - .gravity( Gravity.TOP ) + public void showPanel(Context context) { + if (mPanelView == null) { + mPanelView = new WindowManagerView.Builder(context) + .contentView(R.layout.module_services_status_panel) + .position(0, 100) + .size(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) + .gravity(Gravity.TOP) .showInWindowManager(); - mPanelView.attachTouchEvent( ( ( view, xPos, yPos ) -> { - closePanel(); - } ) ); - mPanelView.findViewById( R.id.module_services_status_iv ).setOnClickListener( view -> { - closePanel(); - } ); - mStatusTv = mPanelView.findViewById( R.id.module_services_status_tv ); + mPanelView.attachTouchEvent(((view, xPos, yPos) -> closePanel())); + mPanelView.findViewById(R.id.module_services_status_iv).setOnClickListener(view -> closePanel()); + mStatusTv = mPanelView.findViewById(R.id.module_services_status_tv); } mPanelView.show(); - mMainHandler.sendEmptyMessageDelayed( MSG, 0L ); + mMainHandler.sendEmptyMessageDelayed(MSG, 0L); } public void closePanel() { - if ( mPanelView != null ) { + if (mPanelView != null) { mPanelView.dismiss(); - mMainHandler.removeMessages( MSG ); + mMainHandler.removeMessages(MSG); } } }