diff --git a/app/build.gradle b/app/build.gradle index a8694d3291..26c0a335f4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -455,6 +455,7 @@ dependencies { implementation rootProject.ext.dependencies.guideshow implementation rootProject.ext.dependencies.moduleextensions implementation rootProject.ext.dependencies.modulemap + implementation rootProject.ext.dependencies.moduleSmallMap } else { implementation project(':foudations:mogo-commons') implementation project(':foudations:mogo-base-websocket-sdk') @@ -471,6 +472,7 @@ dependencies { implementation project(':modules:mogo-module-monitor') implementation project(':modules:mogo-module-extensions') implementation project(':modules:mogo-module-map') + implementation project(':modules:mogo-module-smp') } apply from: "./functions/basedmap.gradle" diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index d4b61fb6b7..a8443faa26 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -22,6 +22,7 @@ import com.mogo.module.main.service.MogoMainService; import com.mogo.module.push.base.PushUIConstants; import com.mogo.module.service.ServiceConst; import com.mogo.module.share.constant.ShareConstants; +import com.mogo.module.small.map.IMogoSmallMapProvider; import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.utils.ObuConfig; import com.mogo.service.IMogoServiceApis; @@ -94,6 +95,9 @@ public class MogoApplication extends AbsMogoApplication { MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_CRASH_WARNING, "CrashWarning" ) ); // MogoModulePaths.addModule( new MogoModule( IMogoMachineVisionProvider.path, "IMogoMachineVisionProvider" ) ); + // 小地图模块 + MogoModulePaths.addModule( new MogoModule( IMogoSmallMapProvider.path, "IMogoSmallMapProvider" ) ); + MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_GLOBAL_UNWAKE, "GlobalUnwake" ) ); if ( !DebugConfig.isLauncher() ) { diff --git a/build.gradle b/build.gradle index 8859cdee59..704b9467e2 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:3.5.2' - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.71' + classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0' classpath "com.alibaba:arouter-register:1.0.2" classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.4' // classpath ("com.tencent.matrix:matrix-gradle-plugin:0.6.6") { changing = true } diff --git a/config.gradle b/config.gradle index 690687840b..95ed304dde 100644 --- a/config.gradle +++ b/config.gradle @@ -111,6 +111,7 @@ ext { guideshow : "com.mogo.module:module-guide:${MOGO_MODULE_GUIDESHOW_VERSION}", // V2X moduleV2x : "com.mogo.module:module-v2x:${MOGO_MODULE_V2X_VERSION}", + moduleSmallMap : "com.mogo.module:module-small-map:${MOGO_MODULES_SMALL_MAP}", modulemedia : "com.mogo.module:module-media:${MOGO_MODULE_MEDIA_VERSION}", modulesearch : "com.mogo.module:module-search:${MOGO_MODULE_SEARCH_VERSION}", // push @@ -144,8 +145,8 @@ ext { eventbus : "org.greenrobot:eventbus:3.1.1", videoprocessor : "com.zhidao.video:video-processor:1.0.2.1", - coroutinescore : "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1", - coroutinesandroid : "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1", + coroutinescore : "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3", + coroutinesandroid : "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3", aspectj : "org.aspectj:aspectjrt:1.8.9", diff --git a/gradle.properties b/gradle.properties index 6c9fa877a9..253d2e1546 100644 --- a/gradle.properties +++ b/gradle.properties @@ -52,88 +52,89 @@ PASSWORD=xintai2018 RELEASE=false # 模块版本 ## 工程内模块 -MOGO_COMMONS_VERSION=2.0.7 -MOGO_UTILS_VERSION=2.0.7 -MAP_AMAP_VERSION=2.0.7 -MAP_AUTONAVI_VERSION=2.0.7 -MOGO_MAP_VERSION=2.0.7 -MOGO_MAP_API_VERSION=2.0.7 -MOGO_SERVICE_VERSION=2.0.7 -MOGO_SERVICE_API_VERSION=2.0.7 -MOGO_CONNECTION_VERSION=2.0.7 -MOGO_MODULE_APPS_VERSION=2.0.7 -MOGO_MODULE_NAVI_VERSION=2.0.7 -MOGO_MODULE_SHARE_VERSION=2.0.7 -MOGO_MODULE_COMMON_VERSION=2.0.7 -MOGO_MODULE_MAIN_VERSION=2.0.7 -MOGO_MODULE_MAP_VERSION=2.0.7 -MOGO_MODULE_SERVICE_VERSION=2.0.7 -MOGO_MODULE_EXTENSIONS_VERSION=2.0.7 -MOGO_MODULE_SEARCH_VERSION=2.0.7 -MOGO_MODULE_BACK_VERSION=2.0.7 -MOGO_MODULE_GPS_SIMULATOR_VERSION=2.0.7 -MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=2.0.7 -MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=2.0.7 -MOGO_MODULE_AUTHORIZE_VERSION=2.0.7 -MOGO_MODULE_GUIDE_VERSION=2.0.7 -MOGO_MODULE_MEDIA_VERSION=2.0.7 -MOGO_MODULE_MAIN_LAUNCHER_VERSION=2.0.7 -MOGO_MODULE_MAIN_INDEPENDENT_VERSION=2.0.7 -MOGO_MODULE_V2X_VERSION=2.0.7 +MOGO_COMMONS_VERSION=2.0.12 +MOGO_UTILS_VERSION=2.0.12 +MAP_AMAP_VERSION=2.0.12 +MAP_AUTONAVI_VERSION=2.0.12 +MOGO_MAP_VERSION=2.0.12 +MOGO_MAP_API_VERSION=2.0.12 +MOGO_SERVICE_VERSION=2.0.12 +MOGO_SERVICE_API_VERSION=2.0.12 +MOGO_CONNECTION_VERSION=2.0.12 +MOGO_MODULE_APPS_VERSION=2.0.12 +MOGO_MODULE_NAVI_VERSION=2.0.12 +MOGO_MODULE_SHARE_VERSION=2.0.12 +MOGO_MODULE_COMMON_VERSION=2.0.12 +MOGO_MODULE_MAIN_VERSION=2.0.12 +MOGO_MODULE_MAP_VERSION=2.0.12 +MOGO_MODULE_SERVICE_VERSION=2.0.12 +MOGO_MODULE_EXTENSIONS_VERSION=2.0.12 +MOGO_MODULE_SEARCH_VERSION=2.0.12 +MOGO_MODULE_BACK_VERSION=2.0.12 +MOGO_MODULE_GPS_SIMULATOR_VERSION=2.0.12 +MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=2.0.12 +MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=2.0.12 +MOGO_MODULE_AUTHORIZE_VERSION=2.0.12 +MOGO_MODULE_GUIDE_VERSION=2.0.12 +MOGO_MODULE_MEDIA_VERSION=2.0.12 +MOGO_MODULE_MAIN_LAUNCHER_VERSION=2.0.12 +MOGO_MODULE_MAIN_INDEPENDENT_VERSION=2.0.12 +MOGO_MODULE_V2X_VERSION=2.0.12 # 基础服务实现:passport、socket、location -MOGO_BASE_WEBSOCKET_SDK_VERSION = 1.0.0 -MOGO_BASE_SERVICES_APK_VERSION=2.0.7 -MOGO_BASE_SERVICES_SDK_VERSION=2.0.7 +MOGO_BASE_WEBSOCKET_SDK_VERSION = 2.0.12 +MOGO_BASE_SERVICES_APK_VERSION=2.0.12 +MOGO_BASE_SERVICES_SDK_VERSION=2.0.12 ## 工程外部模块 # 探路 -MOGO_MODULE_TANLU_VERSION=2.0.7 +MOGO_MODULE_TANLU_VERSION=2.0.12 # 视频引导 -MOGO_MODULE_GUIDESHOW_VERSION=2.0.7 +MOGO_MODULE_GUIDESHOW_VERSION=2.0.12 # 推送 -MOGO_MODULE_PUSH_VERSION=2.0.7 -MOGO_MODULE_PUSH_BASE_VERSION=2.0.7 -MOGO_MODULE_PUSH_NOOP_VERSION=2.0.7 +MOGO_MODULE_PUSH_VERSION=2.0.12 +MOGO_MODULE_PUSH_BASE_VERSION=2.0.12 +MOGO_MODULE_PUSH_NOOP_VERSION=2.0.12 # 探路上报和分享模块 -TANLULIB_VERSION=2.0.7 -MOGO_TANLU_API_VERSION=2.0.7 +TANLULIB_VERSION=2.0.12 +MOGO_TANLU_API_VERSION=2.0.12 #左侧面板模块 -MOGO_MODULE_LEFT_PANEL_VERSION=2.0.7 -MOGO_MODULE_LEFT_PANEL_NOOP_VERSION=2.0.7 +MOGO_MODULE_LEFT_PANEL_VERSION=2.0.12 +MOGO_MODULE_LEFT_PANEL_NOOP_VERSION=2.0.12 # 小控件 -MOGO_MODULE_WIDGETS_VERSION=2.0.7 +MOGO_MODULE_WIDGETS_VERSION=2.0.12 # obu -MOGO_MODULE_OBU_VERSION=2.0.7 +MOGO_MODULE_OBU_VERSION=2.0.12 # 皮肤 -MOGO_SKIN_SUPPORT_VERSION=2.0.7 -MOGO_SKIN_LIGHT_VERSION=2.0.7 -MOGO_SKIN_SUPPORT_IMPL_VERSION=2.0.7 -MOGO_SKIN_SUPPORT_NOOP_VERSION=2.0.7 -SKIN_SUPPORT_VERSION=2.0.7 -SKIN_SUPPORT_APPCOMPAT_VERSION=2.0.7 -SKIN_SUPPORT_CARDVIEW_VERSION=2.0.7 -SKIN_SUPPORT_CONSTRAINT_LAYOUT_VERSION=2.0.7 -SKIN_SUPPORT_DESIGN_VERSION=2.0.7 +MOGO_SKIN_SUPPORT_VERSION=2.0.12 +MOGO_SKIN_LIGHT_VERSION=2.0.12 +MOGO_SKIN_SUPPORT_IMPL_VERSION=2.0.12 +MOGO_SKIN_SUPPORT_NOOP_VERSION=2.0.12 +SKIN_SUPPORT_VERSION=2.0.12 +SKIN_SUPPORT_APPCOMPAT_VERSION=2.0.12 +SKIN_SUPPORT_CARDVIEW_VERSION=2.0.12 +SKIN_SUPPORT_CONSTRAINT_LAYOUT_VERSION=2.0.12 +SKIN_SUPPORT_DESIGN_VERSION=2.0.12 # 闪屏页 -MOGO_MODULE_SPLASH_VERSION=2.0.7 -MOGO_MODULE_SPLASH_NOOP_VERSION=2.0.7 +MOGO_MODULE_SPLASH_VERSION=2.0.12 +MOGO_MODULE_SPLASH_NOOP_VERSION=2.0.12 # monitor -MOGO_MODULE_MONITOR_VERSION=2.0.7 +MOGO_MODULE_MONITOR_VERSION=2.0.12 # bugly -CRASHREPORT_VERSION=2.0.7 -CRASHREPORT_BUGLY_VERSION=2.0.7 -CRASHREPORT_NOOP_VERSION=2.0.7 +CRASHREPORT_VERSION=2.0.12 +CRASHREPORT_BUGLY_VERSION=2.0.12 +CRASHREPORT_NOOP_VERSION=2.0.12 ## tts -TTS_BASE_VERSION=2.0.7 -TTS_DI_VERSION=2.0.7 -TTS_ZHI_VERSION=2.0.7 -TTS_NOOP_VERSION=2.0.7 +TTS_BASE_VERSION=2.0.12 +TTS_DI_VERSION=2.0.12 +TTS_ZHI_VERSION=2.0.12 +TTS_NOOP_VERSION=2.0.12 # 自研地图 -MAP_CUSTOM_VERSION=1.2.1.9 -MOGO_MODULES_MVISION_VERSION=1.0.0 +MAP_CUSTOM_VERSION=2.0.12 +MOGO_MODULES_MVISION_VERSION=2.0.12 +MOGO_MODULES_SMALL_MAP=1.0.0 # httpdns -HTTPDNS_TENCENT_VERSION = 1.0.0 -HTTPDNS_BASE_VERSION = 1.0.0 -HTTPDNS_NOOP_VERSION = 1.0.0 +HTTPDNS_TENCENT_VERSION = 2.0.12 +HTTPDNS_BASE_VERSION = 2.0.12 +HTTPDNS_NOOP_VERSION = 2.0.12 ######## 外部依赖引用 # 车聊聊 diff --git a/libraries/tanlulib/build.gradle b/libraries/tanlulib/build.gradle index dba6a1d3df..a23d2e6cb8 100644 --- a/libraries/tanlulib/build.gradle +++ b/libraries/tanlulib/build.gradle @@ -72,9 +72,9 @@ dependencies { kapt rootProject.ext.dependencies.aroutercompiler if (Boolean.valueOf(RELEASE)) { - compileOnly rootProject.ext.dependencies.mogocommons - compileOnly rootProject.ext.dependencies.mogomap - compileOnly rootProject.ext.dependencies.mogoserviceapi + implementation rootProject.ext.dependencies.mogocommons + implementation rootProject.ext.dependencies.mogomap + implementation rootProject.ext.dependencies.mogoserviceapi } else { implementation project(':modules:mogo-module-common') implementation project(':libraries:mogo-map') diff --git a/main-extensions/mogo-module-main-launcher/src/main/java/com/zhidao/mogo/module/main/launcher/MainLauncherActivity.java b/main-extensions/mogo-module-main-launcher/src/main/java/com/zhidao/mogo/module/main/launcher/MainLauncherActivity.java index 1cc07beaa2..5582493834 100644 --- a/main-extensions/mogo-module-main-launcher/src/main/java/com/zhidao/mogo/module/main/launcher/MainLauncherActivity.java +++ b/main-extensions/mogo-module-main-launcher/src/main/java/com/zhidao/mogo/module/main/launcher/MainLauncherActivity.java @@ -11,6 +11,7 @@ import androidx.annotation.Nullable; import com.mogo.commons.debug.DebugConfig; import com.mogo.map.uicontroller.EnumMapUI; +import com.mogo.module.common.MogoApisHandler; import com.mogo.module.main.MainActivity; import com.mogo.module.main.cards.MogoModulesManager; import com.mogo.service.intent.IMogoIntentListener; @@ -38,7 +39,11 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis protected void loadContainerModules() { super.loadContainerModules(); // 显示左边遮罩 - mLeftShadowFrame.setVisibility( View.VISIBLE ); + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + mLeftShadowFrame.setVisibility(View.GONE); + }else { + mLeftShadowFrame.setVisibility(View.VISIBLE); + } MogoModulesManager.getInstance().loadAppsListModule( com.mogo.module.main.R.id.module_main_id_apps_fragment_container ); } @@ -120,14 +125,16 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis @Override public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { + FrameLayout.LayoutParams entranceParams = ( ( FrameLayout.LayoutParams ) mEntrance.getLayoutParams() ); if (isTrue) { - FrameLayout.LayoutParams entranceParams = ( ( FrameLayout.LayoutParams ) mEntrance.getLayoutParams() ); entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft_in_vr_mode ); - mEntrance.setLayoutParams( entranceParams ); + mLeftShadowFrame.setVisibility(View.GONE); + mApps.setVisibility(View.GONE); }else{ - FrameLayout.LayoutParams entranceParams = ( ( FrameLayout.LayoutParams ) mEntrance.getLayoutParams() ); entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft_out_vr_mode ); - mEntrance.setLayoutParams( entranceParams ); + mLeftShadowFrame.setVisibility(View.VISIBLE); + mApps.setVisibility(View.VISIBLE); } + mEntrance.setLayoutParams( entranceParams ); } } diff --git a/main-extensions/mogo-module-main-launcher/src/main/res/values/dimens.xml b/main-extensions/mogo-module-main-launcher/src/main/res/values/dimens.xml index 79e190ca2d..25247f638b 100644 --- a/main-extensions/mogo-module-main-launcher/src/main/res/values/dimens.xml +++ b/main-extensions/mogo-module-main-launcher/src/main/res/values/dimens.xml @@ -1,5 +1,5 @@ - 204px + 0px 800px \ No newline at end of file diff --git a/modules.txt b/modules.txt index 59dbcdef06..c15cf56b13 100644 --- a/modules.txt +++ b/modules.txt @@ -2,12 +2,11 @@ :skin:mogo-skin-support :tts:tts-base :tts:tts-zhi -:tts:tts-di -:tts:tts-noop -:foudations:mogo-commons :foudations:httpdns-base :foudations:httpdns-noop -:foudations:httpdns-tencent +:foudations:mogo-commons +:tts:tts-di +:tts:tts-noop :libraries:mogo-map-api :skin:skin-support :skin:skin-support-appcompat @@ -17,8 +16,10 @@ :services:mogo-service-api :libraries:map-amap :libraries:map-autonavi +:libraries:map-custom :libraries:mogo-map :modules:mogo-module-common +:foudations:httpdns-tencent :skin:mogo-skin-support-impl :skin:mogo-skin-support-noop :test:crashreport @@ -29,9 +30,6 @@ :modules:mogo-module-obu :modules:mogo-module-map :modules:mogo-module-apps -:modules:mogo-module-gps-simulator -:modules:mogo-module-gps-simulator-debug -:modules:mogo-module-gps-simulator-noop :modules:mogo-module-service :modules:mogo-module-authorize :modules:mogo-module-share diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/RoomConstants.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/RoomConstants.java new file mode 100644 index 0000000000..406e9d4840 --- /dev/null +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/RoomConstants.java @@ -0,0 +1,9 @@ +package com.mogo.module.common.constants; + +/** + * 数据库常量 + */ +public class RoomConstants { + public static final String DB_NAME_V2X = "MoGoScenario.db"; + public static final String TB_NAME_SCENARIO = "tb_travel_scenario"; +} diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MogoSnapshotSetData.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MogoSnapshotSetData.java index 225b38d90c..e0c65c2ff9 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MogoSnapshotSetData.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MogoSnapshotSetData.java @@ -30,6 +30,9 @@ class MogoSnapshotSetData implements Parcelable { //红绿灯 private CloudRoadData trafficLight; + //路边摄像头 + private CloudRoadData camera; + // 自车速度 本地添加 public double curSpeed = 0.0; diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XHistoryScenarioData.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XHistoryScenarioData.java index 53f5250437..23a176a04d 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XHistoryScenarioData.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XHistoryScenarioData.java @@ -1,6 +1,6 @@ package com.mogo.module.common.entity; -import com.mogo.map.location.MogoLocation; +import com.mogo.module.common.constants.RoomConstants; import com.mogo.utils.sqlite.annotation.DbDatabase; import com.mogo.utils.sqlite.annotation.DbField; import com.mogo.utils.sqlite.annotation.DbTable; @@ -10,8 +10,8 @@ import com.mogo.utils.sqlite.annotation.DbTable; * * @author donghongyu */ -@DbDatabase(dbName = "MoGoScenario.db") -@DbTable(tableName = "tb_history_scenario") +@DbDatabase(dbName = RoomConstants.DB_NAME_V2X) +@DbTable(tableName = RoomConstants.TB_NAME_SCENARIO) public class V2XHistoryScenarioData { /** @@ -32,6 +32,13 @@ public class V2XHistoryScenarioData { @DbField(fieldName = "eventJsonData") public String eventJsonData; + /** + * 事件json HashCode + * 只取json中的几个代表性字段,表示唯一性,因为图片地址会经常被改变 + */ + @DbField(fieldName = "eventJsonDataHashCode") + public Integer eventJsonDataHashCode; + /** * 事件是否被处理过了,true-处理过了。false-未处理过 */ @@ -70,8 +77,16 @@ public class V2XHistoryScenarioData { isDispose = dispose; } + public Integer getEventJsonDataHashCode() { + return eventJsonDataHashCode; + } + + public void setEventJsonDataHashCode(Integer eventJsonDataHashCode) { + this.eventJsonDataHashCode = eventJsonDataHashCode; + } + @Override - public V2XHistoryScenarioData clone() throws CloneNotSupportedException { + public V2XHistoryScenarioData clone() { try { return (V2XHistoryScenarioData) super.clone(); } catch (CloneNotSupportedException e) { diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_icon_like_selected_vr.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_icon_like_selected_vr.png new file mode 100644 index 0000000000..3e6239c56c Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_icon_like_selected_vr.png differ diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_icon_like_vr.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_icon_like_vr.png new file mode 100644 index 0000000000..66173b2e02 Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_icon_like_vr.png differ diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_icon_unlike_selected_vr.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_icon_unlike_selected_vr.png new file mode 100644 index 0000000000..e14ea98afb Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_icon_unlike_selected_vr.png differ diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_icon_unlike_vr.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_icon_unlike_vr.png new file mode 100644 index 0000000000..ada6ebb074 Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_icon_unlike_vr.png differ diff --git a/modules/mogo-module-common/src/main/res/drawable/module_common_like_vr.xml b/modules/mogo-module-common/src/main/res/drawable/module_common_like_vr.xml new file mode 100644 index 0000000000..d99914f6c5 --- /dev/null +++ b/modules/mogo-module-common/src/main/res/drawable/module_common_like_vr.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-common/src/main/res/drawable/module_common_unlike_vr.xml b/modules/mogo-module-common/src/main/res/drawable/module_common_unlike_vr.xml new file mode 100644 index 0000000000..e86241216c --- /dev/null +++ b/modules/mogo-module-common/src/main/res/drawable/module_common_unlike_vr.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index d9b038ca59..8df19ce8d4 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -48,13 +48,16 @@ import com.mogo.module.common.map.Scene; import com.mogo.module.common.view.OnPreventFastClickListener; import com.mogo.module.extensions.ExtensionsModuleConst; import com.mogo.module.extensions.R; +import com.mogo.module.extensions.navi.BaseNaviInfoView; import com.mogo.module.extensions.navi.NaviInfoView; +import com.mogo.module.extensions.navi.VrModeNavInfoView; import com.mogo.module.extensions.userinfo.UserInfo; import com.mogo.module.extensions.utils.AdasNoticeHelper; import com.mogo.module.extensions.utils.EntranceViewHolder; import com.mogo.module.extensions.utils.NoMapTopViewShaderHelper; import com.mogo.module.extensions.utils.TopViewAnimHelper; import com.mogo.module.extensions.utils.TopViewNoLinkageAnimHelper; +import com.mogo.module.extensions.utils.TrafficLightPanelManager; import com.mogo.module.share.manager.ServiceApisManager; import com.mogo.service.IMogoServiceApis; import com.mogo.service.analytics.IMogoAnalytics; @@ -120,7 +123,7 @@ public class EntranceFragment extends MvpFragment{ // 进入vr模式 enterVrMode(); - mApis.getMapFrameControllerApi().changeToVRMode(); + mApis.getStatusManagerApi().setVrMode(TAG, true); +// mApis.getMapFrameControllerApi().changeToVRMode(); }); tvExitVrMode = findViewById(R.id.module_ext_exit_vr_mode); tvExitVrMode.setOnClickListener((v)->{ // 退出vr模式 exitVrMode(); - mApis.getMapFrameControllerApi().changeTo2dMode(); + mApis.getStatusManagerApi().setVrMode(TAG, false); +// mApis.getMapFrameControllerApi().changeTo2dMode(); }); dealWeatherContainer(); @@ -480,6 +484,8 @@ public class EntranceFragment extends MvpFragment 0 ) { target.setImageResource( iconId ); @@ -143,4 +146,6 @@ public abstract class BaseNaviInfoView { } builder.append( "到达" ); } + + public abstract boolean isVisible(); } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java index 6264550e08..67110d0ba7 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java @@ -26,7 +26,8 @@ public class NaviInfoView extends BaseNaviInfoView { private TextView remainingTimeUnit; private TextView arriveTime; - public void inflate( View view ) { + public NaviInfoView(View view) { + super(view); turnIcon = view.findViewById( R.id.module_map_id_navi_next_info_road_turn_icon ); distance = view.findViewById( R.id.module_map_id_navi_next_info_distance ); distanceUnit = view.findViewById( R.id.module_map_id_navi_next_info_distance_unit ); @@ -39,6 +40,7 @@ public class NaviInfoView extends BaseNaviInfoView { arriveTime = view.findViewById( R.id.module_map_id_arrive_time ); } + @Override public boolean isVisible() { return turnIcon != null && turnIcon.getVisibility() == View.VISIBLE; } @@ -46,7 +48,6 @@ public class NaviInfoView extends BaseNaviInfoView { @Override public void notifyChanged( MogoNaviInfo naviInfo ) { - super.notifyChanged( naviInfo ); if ( naviInfo == null ) { return; } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/VrModeNavInfoView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/VrModeNavInfoView.java new file mode 100644 index 0000000000..428d98494a --- /dev/null +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/VrModeNavInfoView.java @@ -0,0 +1,25 @@ +package com.mogo.module.extensions.navi; + +import android.view.View; + +import com.mogo.map.navi.MogoNaviInfo; + +/** + * vr模式下导航信息封装 + * + * @author tongchenfei + */ +public class VrModeNavInfoView extends BaseNaviInfoView { + public VrModeNavInfoView(View view) { + super(view); + } + + @Override + public boolean isVisible() { + return true; + } + + @Override + public void notifyChanged(MogoNaviInfo naviInfo) { + } +} diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java index d5ec491f0e..a04b37eeab 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java @@ -6,23 +6,18 @@ import android.content.Intent; import android.content.IntentFilter; import android.os.Handler; import android.os.Message; -import android.view.LayoutInflater; import android.view.View; -import android.widget.TextView; import com.mogo.map.location.IMogoLocationListener; import com.mogo.map.location.MogoLocation; -import com.mogo.map.navi.MogoTraffic; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.entity.CloudRoadData; import com.mogo.module.common.entity.MogoSnapshotSetData; -import com.mogo.module.extensions.R; import com.mogo.service.adas.IMogoAdasWarnMessageCallback; import com.mogo.service.adas.MogoADASWarnType; import com.mogo.service.adas.entity.ADASWarnMessage; import com.mogo.service.connection.IMogoOnWebSocketMessageListener; import com.mogo.service.connection.WebSocketMsgType; -import com.mogo.service.entrance.IMogoEntranceButtonController; import com.mogo.utils.logger.Logger; import org.json.JSONObject; @@ -50,8 +45,6 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca private volatile boolean isVrMode = false; - private TextView tvSelfSpeed, tvTrafficLight, tvLimitSpeed; - private int limitSpeed = -1; private int currentSpeed = 0; private String lightStatus = "G"; @@ -61,26 +54,18 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca private boolean isObuLightData = false; - private View selfCar; private boolean lightCenter = true; public void init(Context context) { this.context = context; - if(!lightCenter) { - selfCar = LayoutInflater.from(context).inflate(R.layout.module_ext_item_self_car, null); - tvSelfSpeed = selfCar.findViewById(R.id.tvSelfSpeed); - tvTrafficLight = selfCar.findViewById(R.id.tvTrafficLight); - tvLimitSpeed = selfCar.findViewById(R.id.tvLimitSpeed); + if (!lightCenter) { } Logger.d(TAG, "init===="); } public void initView(View root) { - if(lightCenter) { - tvSelfSpeed = root.findViewById(R.id.tvSelfSpeed); - tvTrafficLight = root.findViewById(R.id.tvTrafficLight); - tvLimitSpeed = root.findViewById(R.id.tvLimitSpeed); + if (lightCenter) { } } @@ -88,13 +73,15 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca Logger.d(TAG, "enterVrMode===" + isVrMode); if (!isVrMode) { isVrMode = true; + MogoApisHandler.getInstance().getApis().getAdasControllerApi().closeADAS(); + IntentFilter filter = new IntentFilter("com.mogo.launcher.adas.app.biz"); filter.addAction("com.mogo.launcher.adas"); context.registerReceiver(adasReceiver, filter); MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasWarnMessageCallback(this); MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoLocationListener(TAG, this); MogoApisHandler.getInstance().getApis().getWebSocketManagerApi(context).registerOnWebSocketMessageListener(this); - if(!lightCenter) { + if (!lightCenter) { handler.sendEmptyMessageDelayed(MSG_REFRESH_CAR_STRATEGY, STRATEGY_DELAY); } } @@ -104,10 +91,8 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca Logger.d(TAG, "退出vr模式===" + isVrMode); if (isVrMode) { isVrMode = false; + MogoApisHandler.getInstance().getApis().getAdasControllerApi().showADAS(); handler.removeMessages(MSG_REFRESH_CAR_STRATEGY); - tvSelfSpeed.setVisibility(View.GONE); - tvTrafficLight.setVisibility(View.GONE); - tvLimitSpeed.setVisibility(View.GONE); MogoApisHandler.getInstance().getApis().getAdasControllerApi().removeAdasWarnMessageCallback(this); MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoLocationListener(TAG); MogoApisHandler.getInstance().getApis().getWebSocketManagerApi(context).unregisterOnWebSocketMessageListener(this); @@ -130,18 +115,7 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca } } - private void drawLimitSpeed(){ - if (tvLimitSpeed != null) { - tvLimitSpeed.post(() -> { - handler.removeMessages(MSG_HIDE_LIMIT_SPEED); - - if (tvLimitSpeed.getVisibility() == View.GONE) { - tvLimitSpeed.setVisibility(View.VISIBLE); - } - tvLimitSpeed.setText(limitSpeed+""); - handler.sendEmptyMessageDelayed(MSG_HIDE_LIMIT_SPEED, HIDE_LIMIT_SPEED_DELAY); - }); - } + private void drawLimitSpeed() { } @Override @@ -150,25 +124,7 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca return; } currentSpeed = (int) (location.getSpeed() * 3.6F); - if(lightCenter) { - if (tvSelfSpeed != null) { - tvSelfSpeed.post(() -> { - if (tvSelfSpeed.getVisibility() == View.GONE) { - tvSelfSpeed.setVisibility(View.VISIBLE); - } - if (limitSpeed != -1 && currentSpeed > limitSpeed) { - // 显示红色 - tvSelfSpeed.setTextColor(context.getResources().getColor(R.color.module_ext_vr_mode_left_traffic_light_red)); - tvSelfSpeed.setBackgroundResource(R.drawable.module_ext_vr_mode_speed_red_bg); - }else{ - // 显示白 - tvSelfSpeed.setTextColor(context.getResources().getColor(R.color.module_ext_vr_mode_left_traffic_light_white)); - tvSelfSpeed.setBackgroundResource(R.drawable.module_ext_vr_mode_speed_white_bg); - } - tvSelfSpeed.setText("" + currentSpeed); - Logger.d(TAG, "onLocationChange: " + currentSpeed); - }); - } + if (lightCenter) { } } @@ -178,11 +134,6 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca case MSG_REFRESH_CAR_STRATEGY: // todo 暂时不采用此种渲染方式 // 自车速度 - tvSelfSpeed.setText("" + currentSpeed); - // 红绿灯 - if (tvTrafficLight.getVisibility() == View.GONE) { - tvTrafficLight.setVisibility(View.VISIBLE); - } // todo 设置字体颜色、背景颜色、leftDrawable switch (lightStatus) { case "Y": @@ -195,26 +146,21 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca // 默认绿灯 break; } - tvTrafficLight.setText(surplusTime + "S"); - MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().showMyLocation(inflateRoadInfo()); if (isVrMode) { handler.sendEmptyMessageDelayed(MSG_REFRESH_CAR_STRATEGY, STRATEGY_DELAY); } return true; case MSG_HIDE_LIMIT_SPEED: limitSpeed = -1; - tvLimitSpeed.setVisibility(View.GONE); return true; case MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD: if (!isObuLightData && !handler.hasMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU)) { - tvTrafficLight.setVisibility(View.GONE); } return true; case MSG_HIDE_TRAFFIC_LIGHT_BY_OBU: isObuLightData = false; if (!handler.hasMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD)) { - tvTrafficLight.setVisibility(View.GONE); } return true; default: @@ -234,22 +180,22 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca return; } String action = intent.getAction(); - if("com.mogo.launcher.adas".equals(action)){ + if ("com.mogo.launcher.adas".equals(action)) { // 收到限速信息 int limit = intent.getIntExtra("adas_speed_limit", -1); - if(limit>0) { + if (limit > 0) { limitSpeed = limit; drawLimitSpeed(); } - }else { + } else { int type = intent.getIntExtra("type", -1); if (type == 2) { String obuLightAction = intent.getStringExtra("action"); - if("1".equals(obuLightAction)){ + if ("1".equals(obuLightAction)) { // 隐藏红绿灯 handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU); handler.sendEmptyMessage(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU); - }else { + } else { // 红绿灯处理 String data = intent.getStringExtra("data"); if (data != null && !data.isEmpty()) { @@ -275,13 +221,6 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca private void handleObuTrafficLightInfo(String lightStatus, String surplusTime) { isObuLightData = true; - if (tvTrafficLight != null) { - handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU); - handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD); - drawTrafficLight(lightStatus, surplusTime); - handler.sendEmptyMessageDelayed(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU, - HIDE_TRAFFIC_LIGHT_DELAY); - } } private void handleCloudTrafficLight(CloudRoadData roadData) { @@ -289,75 +228,12 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD); return; } - if (tvTrafficLight != null && !handler.hasMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU)) { - handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD); - // todo drawTrafficLight - String lightStatus = null; - switch (roadData.getLightStatus()) { - case 1: - // 红灯 - lightStatus = "R"; - break; - case 2: - // 绿灯 - lightStatus = "G"; - break; - case 3: - // 黄灯 - lightStatus = "Y"; - break; - default: - break; - } - if(lightStatus == null){ - handler.sendEmptyMessage(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD); - }else { - int diff = (int) ((System.currentTimeMillis() - roadData.getSystemTime()) / 1000); - int leftTime = roadData.getLightLeftTime() - diff; - if (leftTime < 0) { - leftTime = 0; - } - Logger.d("CloudTrafficLight", - "lightStatus: " + lightStatus + " current: " + System.currentTimeMillis() + " cloudType: " + roadData.getSystemTime() + " diff: " + diff + " cloudLeftTime: " + roadData.getLightLeftTime() + " leftTime: " + leftTime); - drawTrafficLight(lightStatus, "" + leftTime); - handler.sendEmptyMessageDelayed(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD, - HIDE_TRAFFIC_LIGHT_DELAY); - } - } } private void drawTrafficLight(String lightStatus, String surplusTime) { this.lightStatus = lightStatus; this.surplusTime = surplusTime; - if(lightCenter) { - tvTrafficLight.post(() -> { - if (tvTrafficLight.getVisibility() == View.GONE) { - tvTrafficLight.setVisibility(View.VISIBLE); - } - // todo 设置字体颜色、背景颜色、leftDrawable - switch (lightStatus) { - case "Y": - // 黄灯 - tvTrafficLight.setTextColor(context.getResources().getColor(R.color.module_ext_vr_mode_left_traffic_light_yellow)); - tvTrafficLight.setBackgroundResource(R.drawable.module_ext_vr_mode_traffic_light_yellow_bg); - tvTrafficLight.setCompoundDrawablesWithIntrinsicBounds(R.drawable.module_ext_traffic_light_yellow, 0, 0, 0); - break; - case "R": - // 红灯 - tvTrafficLight.setTextColor(context.getResources().getColor(R.color.module_ext_vr_mode_left_traffic_light_red)); - tvTrafficLight.setBackgroundResource(R.drawable.module_ext_vr_mode_traffic_light_red_bg); - tvTrafficLight.setCompoundDrawablesWithIntrinsicBounds(R.drawable.module_ext_traffic_light_red, 0, 0, 0); - break; - default: - // 默认绿灯 - tvTrafficLight.setTextColor(context.getResources().getColor(R.color.module_ext_vr_mode_left_traffic_light_green)); - tvTrafficLight.setBackgroundResource(R.drawable.module_ext_vr_mode_traffic_light_green_bg); - tvTrafficLight.setCompoundDrawablesWithIntrinsicBounds(R.drawable.module_ext_traffic_light_green, 0, 0, 0); - break; - } - tvTrafficLight.setText(surplusTime + "S"); - Logger.d(TAG, "展示红绿灯信息: " + lightStatus + " time: " + surplusTime); - }); + if (lightCenter) { } } @@ -383,12 +259,4 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca } } - private View inflateRoadInfo(){ - View view = View.inflate(context, R.layout.module_ext_item_self_car, null); - TextView _speed = view.findViewById(R.id.tvSelfSpeed); - _speed.setText("" + currentSpeed); - Logger.d(TAG, "showCurrentSpeed: " + currentSpeed); - return view; - } - } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java index 98c10fe03c..ce4008e550 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java @@ -782,4 +782,18 @@ public class TopViewAnimHelper { cameraMode = null; transition = null; } + + public void enterVrMode(){ + removeAllView(); + topContainer.getLayoutParams().width = (int) getDimen(R.dimen.module_ext_top_view_width_in_vr_mode); +// topContainer.requestLayout(); +// topMotionLayout.requestLayout(); + } + + public void exitVrMode(){ + removeAllView(); + topContainer.getLayoutParams().width = (int) getDimen(R.dimen.module_ext_top_view_width); +// topContainer.requestLayout(); +// topMotionLayout.requestLayout(); + } } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewNoLinkageAnimHelper.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewNoLinkageAnimHelper.java index 8ab39f0e00..74f6808116 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewNoLinkageAnimHelper.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewNoLinkageAnimHelper.java @@ -384,6 +384,11 @@ public class TopViewNoLinkageAnimHelper { } MogoApisHandler.getInstance().getApis().getStatusManagerApi().setTopViewShow(ExtensionsModuleConst.TYPE_ENTRANCE, true); + + // vr模式下与TopView互斥 + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + TopViewAnimHelper.getInstance().removeAllView(); + } } /** @@ -536,4 +541,14 @@ public class TopViewNoLinkageAnimHelper { cameraMode = null; transition = null; } + + public void enterVrMode(){ + removeAllView(); + topContainerNoLinkage.getLayoutParams().width = (int) getDimen(R.dimen.module_ext_top_view_no_link_width_in_vr_mode); + } + + public void exitVrMode(){ + removeAllView(); + topContainerNoLinkage.getLayoutParams().width = LayoutParams.MATCH_PARENT; + } } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TrafficLightPanelManager.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TrafficLightPanelManager.java new file mode 100644 index 0000000000..1087cafce2 --- /dev/null +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TrafficLightPanelManager.java @@ -0,0 +1,175 @@ +package com.mogo.module.extensions.utils; + +import android.os.Handler; +import android.os.Message; +import android.view.View; +import android.widget.TextView; + +import androidx.constraintlayout.widget.Group; + +import com.mogo.module.extensions.R; +import com.mogo.module.extensions.view.VerticalTrafficLightView; +import com.mogo.utils.logger.Logger; + +import java.util.Random; + +/** + * 红绿灯面板管理类,控制各部分显示隐藏,同时控制限速、车速、红绿灯信息展示 + *

+ * 导航信息内容通过{@link com.mogo.module.extensions.navi.VrModeNavInfoView} 在{@link com.mogo.module.extensions.entrance.EntranceFragment}进行控制 + * 此处仅控制导航信息的显示与隐藏 + * + * @author tongchenfei + */ +public class TrafficLightPanelManager implements Handler.Callback, View.OnClickListener { + private static final String TAG = "TrafficLightPanelManager"; + + private TrafficLightPanelManager() { + } + + private final static TrafficLightPanelManager INSTANCE = new TrafficLightPanelManager(); + + public static TrafficLightPanelManager getInstance() { + return INSTANCE; + } + + private Group speedGroup, navGroup, extraGroup; + private TextView tvLimitSpeed; + private VerticalTrafficLightView turnAroundLight, turnLeftLight, straightLight, turnRightLight; + + private Handler handler = new Handler(this); + + private boolean isInit = false; + + public void initPanel(View root) { + speedGroup = root.findViewById(R.id.module_ext_id_group_navi_in_vr_speed); + navGroup = root.findViewById(R.id.module_ext_id_group_navi_in_vr_nav_info); + extraGroup = root.findViewById(R.id.module_ext_id_group_traffic_light_panel_extra); + tvLimitSpeed = root.findViewById(R.id.module_ext_id_tv_limit_speed); + turnAroundLight = root.findViewById(R.id.module_ext_id_traffic_light_turn_around); + turnLeftLight = root.findViewById(R.id.module_ext_id_traffic_light_turn_left); + straightLight = root.findViewById(R.id.module_ext_id_traffic_light_straight); + turnRightLight = root.findViewById(R.id.module_ext_id_traffic_light_turn_right); + isInit = true; + + // debug + root.findViewById(R.id.module_ext_id_navi_in_vr_speed_bg).setOnClickListener(this); + root.findViewById(R.id.module_ext_id_navi_in_vr_traffic_bg).setOnClickListener(this); + } + + public void showNavPanel() { + if (!isInit) { + Logger.e(TAG, "nav panel 未初始化"); + return; + } + extraGroup.setVisibility(View.VISIBLE); + if (isNav) { + navGroup.setVisibility(View.VISIBLE); + speedGroup.setVisibility(View.GONE); + } else { + speedGroup.setVisibility(View.VISIBLE); + navGroup.setVisibility(View.GONE); + } + tvLimitSpeed.setVisibility(View.VISIBLE); + } + + public void hideNavPanel() { + if (!isInit) { + Logger.e(TAG, "nav panel 未初始化"); + return; + } + extraGroup.setVisibility(View.GONE); + speedGroup.setVisibility(View.GONE); + tvLimitSpeed.setVisibility(View.GONE); + + } + + private boolean isNav = false; + + public void startNav() { + isNav = true; + navGroup.setVisibility(View.VISIBLE); + speedGroup.setVisibility(View.GONE); + } + + public void stopNav() { + isNav = false; + speedGroup.setVisibility(View.VISIBLE); + navGroup.setVisibility(View.GONE); + } + + public void refreshLimitSpeed(int limitSpeed) { + handler.removeMessages(MSG_HIDE_LIMIT_SPEED); + tvLimitSpeed.setVisibility(View.VISIBLE); + tvLimitSpeed.setText(String.valueOf(limitSpeed)); + handler.sendEmptyMessageDelayed(MSG_HIDE_LIMIT_SPEED, HIDE_LIMIT_SPEED_DELAY); + } + + /** + * 刷新红绿灯显示状态 + * + * @param laneLight 固定数组长度为4的车道类型灯,从0-3依次代表 掉头,左转,执行,右转 + * @param surplusTime 固定数组长度为4的剩余时长数组,从0-3依次代表 掉头,左转,执行,右转 + */ + public void refreshTrafficLightStatus(int[] laneLight, String[] surplusTime) { + turnAroundLight.setTrafficLightStatus(laneLight[0], surplusTime[0]); + turnLeftLight.setTrafficLightStatus(laneLight[1], surplusTime[1]); + straightLight.setTrafficLightStatus(laneLight[2], surplusTime[2]); + turnRightLight.setTrafficLightStatus(laneLight[3], surplusTime[3]); + } + + public void release() { + isInit = false; + speedGroup = null; + navGroup = null; + extraGroup = null; + tvLimitSpeed = null; + turnAroundLight = null; + turnLeftLight = null; + straightLight = null; + turnRightLight = null; + } + + private static final int MSG_HIDE_LIMIT_SPEED = 1001; + private static final long HIDE_LIMIT_SPEED_DELAY = 5000; + + @Override + public boolean handleMessage(Message msg) { + if (!isInit) { + return false; + } + if (msg.what == MSG_HIDE_LIMIT_SPEED) { + tvLimitSpeed.setVisibility(View.GONE); + return true; + } + return false; + } + + @Override + public void onClick(View v) { + if (v.getId() == R.id.module_ext_id_navi_in_vr_speed_bg) { + boolean s = new Random().nextBoolean(); + boolean b = new Random().nextBoolean(); + if (s) { + if (b) { + startNav(); + } else { + stopNav(); + } + } else { + refreshLimitSpeed(90); + } + } else { + int[] color = new int[4]; + String[] time = new String[4]; + for (int i = 0; i < 4; i++) { + int s = new Random().nextInt(4); + boolean b = new Random().nextBoolean(); + color[i] = s; + time[i] = b ? "12" : ""; + } + refreshTrafficLightStatus(color, time); + } + + } +} diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/view/VerticalTrafficLightView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/view/VerticalTrafficLightView.java index 417309fc64..e16882fbcb 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/view/VerticalTrafficLightView.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/view/VerticalTrafficLightView.java @@ -41,7 +41,7 @@ public class VerticalTrafficLightView extends ConstraintLayout { private static final int[] TURN_RIGHT_ICON_RES = new int[]{R.drawable.module_ext_dw_traffic_turn_right_gray, R.drawable.module_ext_dw_traffic_turn_right_red, R.drawable.module_ext_dw_traffic_turn_right_yellow, R.drawable.module_ext_dw_traffic_turn_right_green}; private final int[] iconRes; - private final int[] colorRes = new int[]{-1, Color.parseColor("#F63A35"), Color.parseColor("#F63A35"), Color.parseColor("#11FF89")}; + private final int[] colorRes = new int[]{-1, Color.parseColor("#F63A35"), Color.parseColor("#FFA71F"), Color.parseColor("#11FF89")}; public VerticalTrafficLightView(Context context) { this(context, null); @@ -54,7 +54,6 @@ public class VerticalTrafficLightView extends ConstraintLayout { public VerticalTrafficLightView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); LayoutInflater.from(context).inflate(R.layout.merge_vertical_traffic_light_in_vr, this); - initView(); TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.VerticalTrafficLightView, 0, 0); int lightType = typedArray.getInt(R.styleable.VerticalTrafficLightView_iconRes, 0); typedArray.recycle(); @@ -76,6 +75,7 @@ public class VerticalTrafficLightView extends ConstraintLayout { iconRes = TURN_AROUND_ICON_RES; break; } + initView(); } private void initView() { @@ -84,6 +84,7 @@ public class VerticalTrafficLightView extends ConstraintLayout { tvLeftTime = findViewById(R.id.module_ext_id_traffic_light_left_time); tvLeftTimeUnit = findViewById(R.id.module_ext_id_traffic_light_left_time_unit); groupLeftTime = findViewById(R.id.module_ext_id_group_left_time); + ivTrafficLight.setImageResource(iconRes[0]); } /** diff --git a/modules/mogo-module-extensions/src/main/res/drawable-ldpi/module_ext_navi_in_vr_speed_bg.xml b/modules/mogo-module-extensions/src/main/res/drawable-ldpi/module_ext_navi_in_vr_speed_bg.xml index fc2be5c480..0d13832107 100644 --- a/modules/mogo-module-extensions/src/main/res/drawable-ldpi/module_ext_navi_in_vr_speed_bg.xml +++ b/modules/mogo-module-extensions/src/main/res/drawable-ldpi/module_ext_navi_in_vr_speed_bg.xml @@ -7,7 +7,8 @@ + android:endColor="#FF141C35" + android:angle="270"/> diff --git a/modules/mogo-module-extensions/src/main/res/drawable/module_ext_navi_in_vr_bg.xml b/modules/mogo-module-extensions/src/main/res/drawable/module_ext_navi_in_vr_bg.xml index 8ebb6406a4..d37d6205c8 100644 --- a/modules/mogo-module-extensions/src/main/res/drawable/module_ext_navi_in_vr_bg.xml +++ b/modules/mogo-module-extensions/src/main/res/drawable/module_ext_navi_in_vr_bg.xml @@ -8,7 +8,8 @@ + android:endColor="#68203784" + android:angle="270"/> diff --git a/modules/mogo-module-extensions/src/main/res/layout/include_navi_in_vr.xml b/modules/mogo-module-extensions/src/main/res/layout/include_navi_in_vr.xml index 0bf3225ba9..34a47aaadd 100644 --- a/modules/mogo-module-extensions/src/main/res/layout/include_navi_in_vr.xml +++ b/modules/mogo-module-extensions/src/main/res/layout/include_navi_in_vr.xml @@ -1,77 +1,116 @@ + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" + android:layout_marginTop="@dimen/module_ext_navi_in_vr_margin_top" + android:layout_marginStart="@dimen/module_ext_navi_in_vr_margin_start" + android:background="@drawable/module_ext_navi_in_vr_bg" /> + app:layout_constraintLeft_toLeftOf="@id/module_ext_id_navi_in_vr_bg" + app:layout_constraintRight_toRightOf="@id/module_ext_id_navi_in_vr_bg" + app:layout_constraintTop_toTopOf="@id/module_ext_id_navi_in_vr_bg" /> - - + app:layout_constraintLeft_toLeftOf="@id/module_ext_id_navi_in_vr_bg" + app:layout_constraintRight_toRightOf="@id/module_ext_id_navi_in_vr_bg" /> + app:layout_constraintBottom_toTopOf="@id/module_ext_id_navi_in_vr_traffic_bg" + app:layout_constraintLeft_toLeftOf="@id/module_ext_id_navi_in_vr_bg" + app:layout_constraintTop_toTopOf="@id/module_ext_id_navi_in_vr_bg" /> + app:layout_constraintLeft_toRightOf="@id/module_ext_id_tv_speed" /> + + + + + + + + + + + app:layout_constraintRight_toRightOf="@id/module_ext_id_navi_in_vr_bg" + app:layout_constraintTop_toTopOf="@id/module_ext_id_navi_in_vr_bg" /> + app:layout_constraintRight_toLeftOf="@id/module_ext_id_traffic_light_turn_left" + app:layout_constraintTop_toTopOf="@id/module_ext_id_navi_in_vr_traffic_bg" /> + app:layout_constraintRight_toRightOf="@id/module_ext_id_navi_in_vr_traffic_bg" + app:layout_constraintTop_toTopOf="@id/module_ext_id_traffic_light_straight" /> + + + + + \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/res/layout/merge_vertical_traffic_light_in_vr.xml b/modules/mogo-module-extensions/src/main/res/layout/merge_vertical_traffic_light_in_vr.xml index 391cdb1d56..9c14f81fb8 100644 --- a/modules/mogo-module-extensions/src/main/res/layout/merge_vertical_traffic_light_in_vr.xml +++ b/modules/mogo-module-extensions/src/main/res/layout/merge_vertical_traffic_light_in_vr.xml @@ -7,6 +7,8 @@ diff --git a/modules/mogo-module-extensions/src/main/res/layout/module_ext_item_self_car.xml b/modules/mogo-module-extensions/src/main/res/layout/module_ext_item_self_car.xml deleted file mode 100644 index 53c4d45924..0000000000 --- a/modules/mogo-module-extensions/src/main/res/layout/module_ext_item_self_car.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml index 1ca223ff81..de35c28104 100644 --- a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml +++ b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml @@ -16,6 +16,11 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> + + @@ -248,6 +251,7 @@ android:textSize="@dimen/module_ext_exit_vr_mode_text_size" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toTopOf="parent" app:layout_constraintRight_toRightOf="parent" /> - - - - - - -