Merge remote-tracking branch 'origin/dev_merge_shunyi_vr_map' into dev_merge_shunyi_vr_map

# Conflicts:
#	libraries/map-custom/build.gradle
#	modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/BaseNaviInfoView.java
This commit is contained in:
wangcongtao
2020-12-13 11:06:21 +08:00
117 changed files with 2217 additions and 1155 deletions

View File

@@ -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"

View File

@@ -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() ) {

View File

@@ -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 }

View File

@@ -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",

View File

@@ -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
######## 外部依赖引用
# 车聊聊

View File

@@ -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')

View File

@@ -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 );
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >204px</dimen>
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
<dimen name="module_main_entrance_fragment_container_marginLeft_out_vr_mode" >800px</dimen>
</resources>

View File

@@ -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

View File

@@ -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";
}

View File

@@ -30,6 +30,9 @@ class MogoSnapshotSetData implements Parcelable {
//红绿灯
private CloudRoadData trafficLight;
//路边摄像头
private CloudRoadData camera;
// 自车速度 本地添加
public double curSpeed = 0.0;

View File

@@ -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) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/module_common_icon_like_vr" android:state_pressed="true" />
<item android:drawable="@drawable/module_common_icon_like_selected_vr" android:state_selected="true" />
<item android:drawable="@drawable/module_common_icon_like_vr" android:state_pressed="false" />
<item android:drawable="@drawable/module_common_icon_like_vr" />
</selector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/module_common_icon_unlike_vr" android:state_pressed="false" />
<item android:drawable="@drawable/module_common_icon_unlike_vr" />
</selector>

View File

@@ -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<EntranceView, EntrancePresente
private ImageButton mMove2CurrentLocation;
private NaviInfoView mNaviInfo;
private BaseNaviInfoView mNaviInfo;
private TextView mExitNavi;
@@ -369,8 +372,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
R.dimen.module_map_display_overview_bottom_margin)
);
mNaviInfo = new NaviInfoView();
mNaviInfo.inflate(rootView);
mNaviInfo = new NaviInfoView(rootView);
findViewById(R.id.module_map_id_navi_bg).setOnClickListener(new OnPreventFastClickListener() {
@Override
@@ -440,14 +442,16 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
tvEnterVrMode.setOnClickListener((v)->{
// 进入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<EntranceView, EntrancePresente
e.printStackTrace();
}
});
TrafficLightPanelManager.getInstance().initPanel(mRootView);
}
private EditText etTimes;
@@ -491,10 +497,15 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mUploadRoadCondition.setVisibility(View.GONE);
mWeatherContainer.setVisibility(View.GONE);
mMsgContainer.setVisibility(View.GONE);
groupUserHead.setVisibility(View.GONE);
tvExitVrMode.setVisibility(View.VISIBLE);
TopViewAnimHelper.getInstance().enterVrMode();
TopViewNoLinkageAnimHelper.getInstance().enterVrMode();
showVrModeNaviView();
mNaviInfo = new VrModeNavInfoView(mRootView);
adasNoticeHelper.enterVrMode();
TrafficLightPanelManager.getInstance().showNavPanel();
}
private void exitVrMode(){
@@ -502,13 +513,17 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
tvEnterVrMode.setVisibility(View.VISIBLE);
mMove2CurrentLocation.setVisibility(View.VISIBLE);
mUploadRoadCondition.setVisibility(View.VISIBLE);
groupUserHead.setVisibility(View.VISIBLE);
// mWeatherContainer.setVisibility(View.VISIBLE);
// mMsgContainer.setVisibility(View.VISIBLE);
tvExitVrMode.setVisibility(View.GONE);
TopViewAnimHelper.getInstance().exitVrMode();
TopViewNoLinkageAnimHelper.getInstance().exitVrMode();
hideVrModeNaviView();
mNaviInfo = new NaviInfoView(mRootView);
adasNoticeHelper.exitVrMode();
TrafficLightPanelManager.getInstance().hideNavPanel();
}
private void debugCrashWarn(){
@@ -1209,5 +1224,15 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
mApis.getSocketManagerApi(getContext()).unregisterOnMessageListener(SEEK_HELP_NOTICE_NUM_MSG_TYPE, seekHelpNoticeListener);
}
TrafficLightPanelManager.getInstance().release();
}
private void showVrModeNaviView(){
}
private void hideVrModeNaviView(){
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.module.extensions.navi;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
@@ -16,10 +17,12 @@ import java.util.Calendar;
*/
public abstract class BaseNaviInfoView {
public void notifyChanged( MogoNaviInfo naviInfo ) {
public BaseNaviInfoView(View view) {
}
public abstract void notifyChanged( MogoNaviInfo naviInfo );
protected void fillNextCrossIconType( ImageView target, int iconId ) {
if ( iconId > 0 ) {
target.setImageResource( iconId );
@@ -143,4 +146,6 @@ public abstract class BaseNaviInfoView {
}
builder.append( "到达" );
}
public abstract boolean isVisible();
}

View File

@@ -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;
}

View File

@@ -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) {
}
}

View File

@@ -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;
}
}

View File

@@ -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();
}
}

View File

@@ -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;
}
}

View File

@@ -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;
/**
* 红绿灯面板管理类,控制各部分显示隐藏,同时控制限速、车速、红绿灯信息展示
* <p>
* 导航信息内容通过{@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);
}
}
}

View File

@@ -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]);
}
/**

View File

@@ -7,7 +7,8 @@
<gradient
android:startColor="#FF344687"
android:endColor="#FF141C35" />
android:endColor="#FF141C35"
android:angle="270"/>
<corners android:radius="@dimen/module_ext_navi_in_vr_bg_corner" />

View File

@@ -8,7 +8,8 @@
<gradient
android:startColor="#9C4F77D1"
android:centerColor="#68203784"
android:endColor="#68203784" />
android:endColor="#68203784"
android:angle="270"/>
<corners android:radius="@dimen/module_ext_navi_in_vr_bg_corner" />

View File

@@ -1,77 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<View
android:id="@+id/module_ext_id_navi_in_vr_bg"
android:layout_width="@dimen/module_ext_navi_in_vr_width"
android:layout_height="@dimen/module_ext_navi_in_vr_height"
android:id="@+id/module_ext_id_navi_in_vr_bg"
android:background="@drawable/module_ext_navi_in_vr_bg"/>
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" />
<View
android:id="@+id/module_ext_id_navi_in_vr_speed_bg"
android:layout_width="@dimen/module_ext_navi_in_vr_speed_bg_width"
android:layout_height="@dimen/module_ext_navi_in_vr_speed_bg_height"
android:background="@drawable/module_ext_navi_in_vr_speed_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_constraintBottom_toBottomOf="@id/module_ext_id_navi_in_vr_bg"
app:layout_constraintRight_toRightOf="@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_constraintTop_toTopOf="@id/module_ext_id_navi_in_vr_bg" />
<View
android:id="@+id/module_ext_id_navi_in_vr_traffic_bg"
android:layout_width="@dimen/module_ext_navi_in_vr_speed_bg_width"
android:layout_height="@dimen/module_ext_navi_in_vr_traffic_bg_height"
android:layout_marginBottom="@dimen/module_ext_navi_in_vr_traffic_bg_margin_bottom"
android:background="@drawable/module_ext_navi_in_vr_traffic_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_toBottomOf="@id/module_ext_id_navi_in_vr_bg"
android:layout_marginBottom="@dimen/module_ext_navi_in_vr_traffic_bg_margin_bottom" />
<androidx.constraintlayout.widget.Group
android:id="@+id/module_ext_id_group_navi_in_vr_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="module_ext_id_tv_speed,module_ext_id_tv_speed_unit"/>
app:layout_constraintLeft_toLeftOf="@id/module_ext_id_navi_in_vr_bg"
app:layout_constraintRight_toRightOf="@id/module_ext_id_navi_in_vr_bg" />
<TextView
android:id="@+id/module_ext_id_tv_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="78"
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_constraintBottom_toTopOf="@id/module_ext_id_navi_in_vr_traffic_bg"
android:layout_marginStart="@dimen/module_ext_navi_in_vr_speed_margin_start"
android:text="78"
android:textColor="#fff"
android:textSize="@dimen/module_ext_navi_in_vr_speed_text_size"
android:textColor="#fff" />
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" />
<TextView
android:id="@+id/module_ext_id_tv_speed_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/module_ext_navi_in_vr_speed_unit_margin_start"
android:text="km/h"
android:textSize="@dimen/module_ext_navi_in_vr_speed_unit_size"
android:textColor="#fff"
app:layout_constraintLeft_toRightOf="@id/module_ext_id_tv_speed"
android:textSize="@dimen/module_ext_navi_in_vr_speed_unit_size"
app:layout_constraintBaseline_toBaselineOf="@id/module_ext_id_tv_speed"
android:layout_marginStart="@dimen/module_ext_navi_in_vr_speed_unit_margin_start" />
app:layout_constraintLeft_toRightOf="@id/module_ext_id_tv_speed" />
<ImageView
android:id="@+id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode"
android:layout_width="@dimen/module_ext_navi_in_vr_navi_icon_size"
android:layout_height="@dimen/module_ext_navi_in_vr_navi_icon_size"
android:src="@drawable/tc_11"
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" />
<TextView
android:id="@+id/module_map_id_navi_next_info_distance_in_vr_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="200"
android:textColor="#f1f1f1"
android:textSize="@dimen/module_ext_navi_in_vr_next_info_txt_size"
app:layout_constraintLeft_toRightOf="@id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode"
app:layout_constraintTop_toTopOf="@id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode" />
<TextView
android:id="@+id/module_map_id_navi_next_info_distance_unit_in_vr_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="米"
android:textColor="#f1f1f1"
android:textSize="@dimen/module_ext_navi_in_vr_next_info_unit_size"
app:layout_constraintBaseline_toBaselineOf="@id/module_map_id_navi_next_info_distance_in_vr_mode"
app:layout_constraintLeft_toRightOf="@id/module_map_id_navi_next_info_distance_in_vr_mode" />
<TextView
android:id="@+id/module_map_id_navi_next_info_road_in_vr_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="北三环东路辅路"
android:textColor="#f1f1f1"
android:textSize="@dimen/module_ext_navi_in_vr_next_info_road_txt_size"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_navi_next_info_distance_in_vr_mode"
app:layout_constraintTop_toBottomOf="@id/module_map_id_navi_next_info_distance_in_vr_mode" />
<TextView
android:id="@+id/module_ext_id_tv_limit_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/module_ext_navi_in_vr_limit_speed_margin_end"
android:background="@drawable/module_ext_vr_mode_limit_speed_bg"
android:gravity="center"
android:text="80"
android:textColor="#FF9CA8D8"
android:gravity="center"
android:textSize="@dimen/module_ext_navi_in_vr_limit_speed_text_size"
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_constraintBottom_toTopOf="@id/module_ext_id_navi_in_vr_traffic_bg"
android:layout_marginEnd="@dimen/module_ext_navi_in_vr_limit_speed_margin_end" />
app:layout_constraintRight_toRightOf="@id/module_ext_id_navi_in_vr_bg"
app:layout_constraintTop_toTopOf="@id/module_ext_id_navi_in_vr_bg" />
<com.mogo.module.extensions.view.VerticalTrafficLightView
android:id="@+id/module_ext_id_traffic_light_turn_around"
@@ -80,8 +119,8 @@
android:layout_marginTop="@dimen/module_ext_navi_in_vr_traffic_light_margin_top"
app:iconRes="turnAround"
app:layout_constraintLeft_toLeftOf="@id/module_ext_id_navi_in_vr_traffic_bg"
app:layout_constraintTop_toTopOf="@id/module_ext_id_navi_in_vr_traffic_bg"
app:layout_constraintRight_toLeftOf="@id/module_ext_id_traffic_light_turn_left"/>
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" />
<com.mogo.module.extensions.view.VerticalTrafficLightView
android:id="@+id/module_ext_id_traffic_light_turn_left"
@@ -107,10 +146,32 @@
android:layout_height="wrap_content"
app:iconRes="turnRight"
app:layout_constraintLeft_toRightOf="@id/module_ext_id_traffic_light_straight"
app:layout_constraintTop_toTopOf="@id/module_ext_id_traffic_light_straight"
app:layout_constraintRight_toRightOf="@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" />
<androidx.constraintlayout.widget.Group
android:id="@+id/module_ext_id_group_navi_in_vr_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="module_ext_id_tv_speed,module_ext_id_tv_speed_unit"
android:visibility="gone"
tools:visibility="visible" />
<androidx.constraintlayout.widget.Group
android:id="@+id/module_ext_id_group_navi_in_vr_nav_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="module_map_id_navi_next_info_road_turn_icon_in_vr_mode,module_map_id_navi_next_info_distance_in_vr_mode,module_map_id_navi_next_info_distance_unit_in_vr_mode,module_map_id_navi_next_info_road_in_vr_mode" />
<!-- 除了上面两个group以外的其他view的group方便整体控制显示隐藏不包含limitSpeed需要单独控制它的显示隐藏 -->
<androidx.constraintlayout.widget.Group
android:id="@+id/module_ext_id_group_traffic_light_panel_extra"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="module_ext_id_navi_in_vr_bg,module_ext_id_navi_in_vr_speed_bg,module_ext_id_navi_in_vr_traffic_bg,module_ext_id_traffic_light_turn_left,module_ext_id_traffic_light_turn_around,module_ext_id_traffic_light_straight,module_ext_id_traffic_light_turn_right"
tools:visibility="visible" />
</merge>

View File

@@ -7,6 +7,8 @@
<androidx.constraintlayout.widget.Group
android:id="@+id/module_ext_id_group_left_time"
app:constraint_referenced_ids="module_ext_id_traffic_light_left_time,module_ext_id_traffic_light_left_time_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible"/>

View File

@@ -1,64 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/tvSelfSpeed"
tools:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/module_ext_vr_mode_self_speed_margin_end"
android:background="@drawable/module_ext_vr_mode_speed_red_bg"
android:gravity="center"
android:text="72"
android:textColor="@color/module_ext_vr_mode_left_traffic_light_red"
android:textSize="@dimen/module_ext_vr_mode_traffic_light_text_size"
android:visibility="visible"
app:layout_constraintRight_toLeftOf="@+id/tvTrafficLight"
app:layout_constraintTop_toTopOf="@+id/tvTrafficLight"/>
<TextView
android:id="@+id/tvTrafficLight"
tools:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/module_ext_vr_mode_traffic_light_green_bg"
android:gravity="center"
android:text="26S"
android:textColor="@color/module_ext_vr_mode_left_traffic_light_green"
android:textSize="@dimen/module_ext_vr_mode_traffic_light_text_size"
android:visibility="visible"
app:layout_constraintLeft_toLeftOf="@+id/ivSelfCar"
app:layout_constraintRight_toRightOf="@+id/ivSelfCar"
app:layout_constraintBottom_toTopOf="@+id/ivSelfCar"/>
<TextView
android:id="@+id/tvLimitSpeed"
tools:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/module_ext_vr_mode_self_speed_margin_end"
android:background="@drawable/module_ext_vr_mode_speed_white_bg"
android:gravity="center"
android:text="160"
android:textColor="@color/module_ext_vr_mode_left_traffic_light_white"
android:textSize="@dimen/module_ext_vr_mode_traffic_light_text_size"
android:visibility="visible"
app:layout_constraintLeft_toRightOf="@+id/tvTrafficLight"
app:layout_constraintTop_toTopOf="@+id/tvTrafficLight"/>
<ImageView
android:id="@+id/ivSelfCar"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/module_ext_self_car" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -16,6 +16,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<include
layout="@layout/include_navi_in_vr"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageButton
android:id="@+id/module_entrance_id_move2_current_location"
android:layout_width="@dimen/module_ext_operation_panel_width"
@@ -187,7 +192,6 @@
android:clickable="true"
android:focusable="true"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<LinearLayout
@@ -232,7 +236,6 @@
android:gravity="center"
android:text="VR"
android:textColor="#fff"
android:visibility="gone"
android:textSize="@dimen/module_ext_enter_vr_mode_text_size"
app:layout_constraintBottom_toTopOf="@+id/module_entrance_id_move2_current_location"
app:layout_constraintRight_toRightOf="@+id/module_entrance_id_move2_current_location" />
@@ -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" />
<FrameLayout
@@ -258,57 +262,6 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<TextView
android:id="@+id/tvSelfSpeed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/module_ext_vr_mode_self_speed_margin_end"
android:background="@drawable/module_ext_vr_mode_speed_red_bg"
android:layout_marginBottom="@dimen/module_ext_vr_mode_self_speed_margin_bottom"
android:gravity="center"
android:text="72"
android:textColor="@color/module_ext_vr_mode_left_traffic_light_red"
android:textSize="@dimen/module_ext_vr_mode_traffic_light_text_size"
android:visibility="gone"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tvTrafficLight"
app:layout_constraintBottom_toBottomOf="parent"
tools:visibility="visible" />
<TextView
android:id="@+id/tvTrafficLight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/module_ext_vr_mode_self_speed_margin_end"
android:background="@drawable/module_ext_vr_mode_traffic_light_green_bg"
android:gravity="center"
android:text="26S"
android:drawableLeft="@drawable/module_ext_traffic_light_green"
android:textColor="@color/module_ext_vr_mode_left_traffic_light_green"
android:textSize="@dimen/module_ext_vr_mode_traffic_light_text_size"
android:visibility="gone"
app:layout_constraintRight_toLeftOf="@+id/tvLimitSpeed"
app:layout_constraintLeft_toRightOf="@+id/tvSelfSpeed"
app:layout_constraintTop_toTopOf="@+id/tvSelfSpeed"
tools:visibility="visible" />
<TextView
android:id="@+id/tvLimitSpeed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/module_ext_vr_mode_speed_white_bg"
android:gravity="center"
android:text="160"
android:textColor="@color/module_ext_vr_mode_left_traffic_light_white"
android:textSize="@dimen/module_ext_vr_mode_traffic_light_text_size"
android:visibility="gone"
app:layout_constraintLeft_toRightOf="@+id/tvTrafficLight"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/tvSelfSpeed"
tools:visibility="visible" />
<Button
android:id="@+id/btnDebugCtrlTopView"
android:layout_width="wrap_content"

View File

@@ -88,6 +88,8 @@
<!-- module_map_layout_navi_info_panel.xml-->
<dimen name="module_ext_top_view_width">1058px</dimen>
<dimen name="module_ext_top_view_width_in_vr_mode">760px</dimen>
<dimen name="module_ext_top_view_no_link_width_in_vr_mode">700px</dimen>
<dimen name="module_ext_navi_info_panel_width">544px</dimen>
<dimen name="module_ext_navi_info_panel_height">117px</dimen>
<dimen name="module_ext_navi_info_panel_small_height">80px</dimen>
@@ -212,6 +214,12 @@
<!-- 仅在vr模式下有此内容仅增加了xhdpi对应的大小 -->
<dimen name="module_ext_navi_in_vr_width">464px</dimen>
<dimen name="module_ext_navi_in_vr_height">304px</dimen>
<dimen name="module_ext_navi_in_vr_margin_start">20px</dimen>
<dimen name="module_ext_navi_in_vr_margin_top">8px</dimen>
<dimen name="module_ext_navi_in_vr_navi_icon_size">100px</dimen>
<dimen name="module_ext_navi_in_vr_next_info_txt_size">60px</dimen>
<dimen name="module_ext_navi_in_vr_next_info_unit_size">48px</dimen>
<dimen name="module_ext_navi_in_vr_next_info_road_txt_size">26px</dimen>
<dimen name="module_ext_navi_in_vr_speed_bg_width">458px</dimen>
<dimen name="module_ext_navi_in_vr_speed_bg_height">298px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_bg_height">140px</dimen>
@@ -231,4 +239,5 @@
<dimen name="module_ext_navi_in_vr_traffic_light_left_time_unit_size">21px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_no_time_margin_top">21px</dimen>
</resources>

View File

@@ -0,0 +1,165 @@
package com.mogo.module.media.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import com.mogo.module.media.R;
/**
* 环形进度条
*/
public class PercentageRingView extends View {
private Paint mCirclePaint;
private Paint mTextPaint;
private Paint mArcPaint;
private int mCircleX;
private int mCircleY;
private float mCurrentAngle;
private RectF mArcRectF;
private float mStartSweepValue;
private float mTargetPercent;
private float mCurrentPercent;
private int mRadius;
private int mCircleBackground;
private int mRingColor;
private int mTextSize;
private int mTextColor;
public PercentageRingView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context);
}
public PercentageRingView(Context context, AttributeSet attrs) {
super(context, attrs);
//自定义属性 values/attr
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.PercentageRing);
//中间圆的背景颜色 默认为浅紫色
mCircleBackground = typedArray.getColor(R.styleable.PercentageRing_circleBackground, 0xffafb4db);
//外圆环的颜色 默认为深紫色
mRingColor = typedArray.getColor(R.styleable.PercentageRing_ringColor, 0xff6950a1);
//中间圆的半径 默认为60
mRadius = typedArray.getInt(R.styleable.PercentageRing_radius, 60);
//字体颜色 默认为白色
mTextColor = typedArray.getColor(R.styleable.PercentageRing_textColor, 0xffffffff);
//最后一定要调用这个 释放掉TypedArray
typedArray.recycle();
//初始化数据
init(context);
}
public PercentageRingView(Context context) {
super(context);
init(context);
}
private void init(Context context) {
//圆环开始角度 -90° 正北方向
mStartSweepValue = -90;
//当前角度
mCurrentAngle = 0;
//当前百分比
mCurrentPercent = 0;
//设置中心园的画笔
mCirclePaint = new Paint();
mCirclePaint.setAntiAlias(true);
mCirclePaint.setColor(mCircleBackground);
mCirclePaint.setStyle(Paint.Style.FILL);
//设置文字的画笔
mTextPaint = new Paint();
mTextPaint.setColor(mTextColor);
mTextPaint.setAntiAlias(true);
mTextPaint.setStyle(Paint.Style.FILL);
mTextPaint.setStrokeWidth((float) (0.025 * mRadius));
mTextPaint.setTextSize(mRadius / 2);
mTextPaint.setTextAlign(Align.CENTER);
//设置外圆环的画笔
mArcPaint = new Paint();
mArcPaint.setAntiAlias(true);
mArcPaint.setColor(mRingColor);
mArcPaint.setStyle(Paint.Style.STROKE);
// mArcPaint.setStrokeWidth((float) (0.075 * mRadius));
mArcPaint.setStrokeWidth((float) (0.17 * mRadius));
//获得文字的字号 因为要设置文字在圆的中心位置
mTextSize = (int) mTextPaint.getTextSize();
}
//主要是测量wrap_content时候的宽和高因为宽高一样只需要测量一次宽即可高等于宽
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(measure(widthMeasureSpec), measure(widthMeasureSpec));
//设置圆心坐标
mCircleX = getMeasuredWidth() / 2;
mCircleY = getMeasuredHeight() / 2;
//如果半径大于圆心横坐标,需要手动缩小半径的值,否则就画到外面去了
if (mRadius > mCircleX) {
//设置半径大小为圆心横坐标到原点的距离
mRadius = mCircleX;
mRadius = (int) (mCircleX - 0.075 * mRadius);
//因为半径改变了,所以要重新设置一下字体宽度
mTextPaint.setStrokeWidth((float) (0.025 * mRadius));
//重新设置字号
mTextPaint.setTextSize(mRadius / 2);
//重新设置外圆环宽度
// mArcPaint.setStrokeWidth((float) (0.075 * mRadius));
mArcPaint.setStrokeWidth((float) (0.17 * mRadius));
//重新获得字号大小
mTextSize = (int) mTextPaint.getTextSize();
}
//画中心园的外接矩形,用来画圆环用
mArcRectF = new RectF(mCircleX - mRadius, mCircleY - mRadius, mCircleX + mRadius, mCircleY + mRadius);
}
//当wrap_content的时候view的大小根据半径大小改变但最大不会超过屏幕
private int measure(int measureSpec) {
int result = 0;
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
if (specMode == MeasureSpec.EXACTLY) {
result = specSize;
} else {
result = (int) (1.075 * mRadius * 2);
if (specMode == MeasureSpec.AT_MOST) {
result = Math.min(result, specSize);
}
}
return result;
}
//开始画中间圆、文字和外圆环
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//画中间圆
canvas.drawCircle(mCircleX, mCircleY, mRadius, mCirclePaint);
//画圆环
canvas.drawArc(mArcRectF, mStartSweepValue, mCurrentAngle, false, mArcPaint);
//画文字
canvas.drawText(String.valueOf(mCurrentPercent) + "%", mCircleX, mCircleY + mTextSize / 4, mTextPaint);
//判断当前百分比是否小于设置目标的百分比
if (mCurrentPercent < mTargetPercent) {
//当前百分比+1
mCurrentPercent += 1;
//当前角度+360
mCurrentAngle += 3.6;
//每10ms重画一次
postInvalidateDelayed(10);
}
}
//设置目标的百分比
public void setTargetPercent(int percent) {
this.mTargetPercent = percent;
}
}

View File

@@ -26,6 +26,7 @@ import com.mogo.module.media.presenter.PresenterFactory;
import com.mogo.module.media.utils.Utils;
import com.mogo.module.media.view.IMusicView;
import com.mogo.module.media.widget.AnimCircleImageView;
import com.mogo.module.media.widget.PercentageRingView;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.WindowUtils;
@@ -65,6 +66,10 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
private boolean mIsCallChatWindowVisible;
private ICallProviderResponse mCallProviderResponse;
private PercentageRingView mPercentageRingView;
private ImageView mPauseImage;
private AnimCircleImageView mAnimCircleImageView;
public void initMedia(Context context) {
mContext = context;
@@ -122,71 +127,129 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
return;
}
if (!mHasAddWindow) {
if (!mHasAddWindow) { //TODO
mHasAddWindow = true;
mWindowView =
LayoutInflater.from(mContext).inflate(R.layout.module_media_music_window_alert_layout, null);
mCircleImg = mWindowView.findViewById(R.id.window_circle_img);
mScrollText = mWindowView.findViewById(R.id.window_scroll_txt);
mWindowPlayPause = mWindowView.findViewById(R.id.window_play_pause);
mWindowPlayNext = mWindowView.findViewById(R.id.window_music_next);
mWindowCurrTime = mWindowView.findViewById(R.id.window_current_time);
mWindowMaxTime = mWindowView.findViewById(R.id.window_max_time);
mWindowProgress = mWindowView.findViewById(R.id.window_progress_bar);
if (mWindowPlayPause != null) {
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
}
int yPos =
getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location);
int xPos =
getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location_x);
int statusBarHeight = WindowUtils.getStatusBarHeight(mContext);
Logger.d(TAG,
"yPos: " + yPos + " xPos: " + xPos + " statusBarHeight: " + statusBarHeight);
Log.d(TAG, "addMediaWindoView");
FrameLayout.LayoutParams params =
new FrameLayout.LayoutParams((int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_width), (int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_height));
params.leftMargin = xPos;
params.topMargin = yPos;
ServiceMediaHandler.getMogoWindowManager().addView(mWindowView, params, false);
updateWindowUI(true);
mWindowView.setOnClickListener(new NoDoubleClickListener() {
@Override
public void onClicks(View view) {
mPresenter.openApp();
}
});
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
mWindowView =
LayoutInflater.from(mContext).inflate(R.layout.module_media_music_window_alert_layout_new, null);
mPercentageRingView = mWindowView.findViewById(R.id.window_circle_bg);
mAnimCircleImageView = mWindowView.findViewById(R.id.window_circle_img_new);
mPauseImage = mWindowView.findViewById(R.id.window_play_pause_new);
mWindowPlayPause.setOnClickListener(new NoDoubleClickListener() {
@Override
public void onClicks(View view) {
if (mMediaInfoData != null) {
if (mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PAUSE_OR_STOP) {
mPresenter.play(mMediaInfoData);
} else {
// 没有做详细判断,不是暂停就是播放
mPresenter.pause(mMediaInfoData);
}
} else {
if (mPauseImage != null) {
mPauseImage.setImageResource(R.drawable.module_media_window_pop_pause);
}
int yPos =
getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location_new);
int xPos =
getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location_x_new);
int statusBarHeight = WindowUtils.getStatusBarHeight(mContext);
Logger.d(TAG,
"yPos: " + yPos + " xPos: " + xPos + " statusBarHeight: " + statusBarHeight);
Log.d(TAG, "addMediaWindoView");
FrameLayout.LayoutParams params =
new FrameLayout.LayoutParams((int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_width_new), (int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_height_new));
params.leftMargin = xPos;
params.topMargin = yPos;
ServiceMediaHandler.getMogoWindowManager().addView(mWindowView, params, false);
updateWindowUI(true);
mWindowView.setOnClickListener(new NoDoubleClickListener() {
@Override
public void onClicks(View view) {
mPresenter.openApp();
}
}
});
});
mWindowPlayNext.setOnClickListener(new NoDoubleClickListener() {
@Override
public void onClicks(View view) {
if (mPresenter != null) {
mPresenter.next();
mPauseImage.setOnClickListener(new NoDoubleClickListener() {
@Override
public void onClicks(View view) {
if (mMediaInfoData != null) {
if (mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PAUSE_OR_STOP) {
mPresenter.play(mMediaInfoData);
} else {
// 没有做详细判断,不是暂停就是播放
mPresenter.pause(mMediaInfoData);
}
} else {
mPresenter.openApp();
}
}
}
});
});
if ( mIsCallChatWindowVisible ) {
Logger.d( TAG, "vr mWindowView.setVisibility: status = " + mIsCallChatWindowVisible );
mWindowView.setVisibility(View.GONE);
} else {
mWindowView.setVisibility(View.VISIBLE);
}
if ( mIsCallChatWindowVisible ) {
Logger.d( TAG, "mWindowView.setVisibility: status = " + mIsCallChatWindowVisible );
mWindowView.setVisibility(View.GONE);
} else {
mWindowView.setVisibility(View.VISIBLE);
mWindowView =
LayoutInflater.from(mContext).inflate(R.layout.module_media_music_window_alert_layout, null);
mCircleImg = mWindowView.findViewById(R.id.window_circle_img);
mScrollText = mWindowView.findViewById(R.id.window_scroll_txt);
mWindowPlayPause = mWindowView.findViewById(R.id.window_play_pause);
mWindowPlayNext = mWindowView.findViewById(R.id.window_music_next);
mWindowCurrTime = mWindowView.findViewById(R.id.window_current_time);
mWindowMaxTime = mWindowView.findViewById(R.id.window_max_time);
mWindowProgress = mWindowView.findViewById(R.id.window_progress_bar);
if (mWindowPlayPause != null) {
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
}
int yPos =
getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location);
int xPos =
getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location_x);
int statusBarHeight = WindowUtils.getStatusBarHeight(mContext);
Logger.d(TAG,
"yPos: " + yPos + " xPos: " + xPos + " statusBarHeight: " + statusBarHeight);
Log.d(TAG, "addMediaWindoView");
FrameLayout.LayoutParams params =
new FrameLayout.LayoutParams((int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_width), (int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_height));
params.leftMargin = xPos;
params.topMargin = yPos;
ServiceMediaHandler.getMogoWindowManager().addView(mWindowView, params, false);
updateWindowUI(true);
mWindowView.setOnClickListener(new NoDoubleClickListener() {
@Override
public void onClicks(View view) {
mPresenter.openApp();
}
});
mWindowPlayPause.setOnClickListener(new NoDoubleClickListener() {
@Override
public void onClicks(View view) {
if (mMediaInfoData != null) {
if (mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PAUSE_OR_STOP) {
mPresenter.play(mMediaInfoData);
} else {
// 没有做详细判断,不是暂停就是播放
mPresenter.pause(mMediaInfoData);
}
} else {
mPresenter.openApp();
}
}
});
mWindowPlayNext.setOnClickListener(new NoDoubleClickListener() {
@Override
public void onClicks(View view) {
if (mPresenter != null) {
mPresenter.next();
}
}
});
if ( mIsCallChatWindowVisible ) {
Logger.d( TAG, "mWindowView.setVisibility: status = " + mIsCallChatWindowVisible );
mWindowView.setVisibility(View.GONE);
} else {
mWindowView.setVisibility(View.VISIBLE);
}
}
}
}
@@ -214,41 +277,71 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
return;
}
if (mScrollText != null) {
mScrollText.setText(mMediaInfoData.getMediaName());
}
if (first || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_BUFF) {
if (mWindowMaxTime != null) {
mWindowMaxTime.setText(Utils.calculateTime((int) mMediaInfoData.getMaxTime()));
}
if (mWindowCurrTime != null) {
mWindowCurrTime.setText(Utils.calculateTime((int) mMediaInfoData.getCurTime()));
}
if( mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING) {
// kw音乐做的容错
if (mWindowPlayPause != null) {
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play);
}
if (mCircleImg != null) {
mCircleImg.startAnim();
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (first || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_BUFF) {
if( mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING) {
// kw音乐做的容错
if (mPauseImage != null) {
mPauseImage.setImageResource(R.drawable.module_media_window_pop_play);
}
if (mAnimCircleImageView != null) {
mAnimCircleImageView.startAnim();
}
}
}
}
if (mCircleImg != null) {
if(mMediaInfoData!=null&&mMediaInfoData.getMediaImg()!=null&&!mMediaInfoData.getMediaImg().isEmpty()) {
int size =
mContext.getResources().getDimensionPixelSize(R.dimen.module_media_pop_window_anim_img_size);
Logger.d(TAG, "overload: " + size);
com.bumptech.glide.request.RequestOptions options =
new com.bumptech.glide.request.RequestOptions()
.placeholder(R.drawable.module_media_default_music_img).error(R.drawable.module_media_default_music_img).override(size, size);
GlideApp.with(mContext).asBitmap().apply(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mCircleImg, options));
if (mAnimCircleImageView != null) {
if(mMediaInfoData!=null&&mMediaInfoData.getMediaImg()!=null&&!mMediaInfoData.getMediaImg().isEmpty()) {
int size =
mContext.getResources().getDimensionPixelSize(R.dimen.module_media_pop_window_anim_img_size_new);
Logger.d(TAG, "overload: " + size);
com.bumptech.glide.request.RequestOptions options =
new com.bumptech.glide.request.RequestOptions()
.placeholder(R.drawable.module_media_default_music_img).error(R.drawable.module_media_default_music_img).override(size, size);
GlideApp.with(mContext).asBitmap().apply(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mAnimCircleImageView, options));
// GlideApp.with(mContext).applyDefaultRequestOptions(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mCircleImg, options));
}else{
mCircleImg.setImageResource(R.drawable.module_media_default_music_img);
}else{
mAnimCircleImageView.setImageResource(R.drawable.module_media_default_music_img);
}
}
} else {
if (mScrollText != null) {
mScrollText.setText(mMediaInfoData.getMediaName());
}
if (first || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_BUFF) {
if (mWindowMaxTime != null) {
mWindowMaxTime.setText(Utils.calculateTime((int) mMediaInfoData.getMaxTime()));
}
if (mWindowCurrTime != null) {
mWindowCurrTime.setText(Utils.calculateTime((int) mMediaInfoData.getCurTime()));
}
if( mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING) {
// kw音乐做的容错
if (mWindowPlayPause != null) {
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play);
}
if (mCircleImg != null) {
mCircleImg.startAnim();
}
}
}
if (mCircleImg != null) {
if(mMediaInfoData!=null&&mMediaInfoData.getMediaImg()!=null&&!mMediaInfoData.getMediaImg().isEmpty()) {
int size =
mContext.getResources().getDimensionPixelSize(R.dimen.module_media_pop_window_anim_img_size);
Logger.d(TAG, "overload: " + size);
com.bumptech.glide.request.RequestOptions options =
new com.bumptech.glide.request.RequestOptions()
.placeholder(R.drawable.module_media_default_music_img).error(R.drawable.module_media_default_music_img).override(size, size);
GlideApp.with(mContext).asBitmap().apply(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mCircleImg, options));
// GlideApp.with(mContext).applyDefaultRequestOptions(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mCircleImg, options));
}else{
mCircleImg.setImageResource(R.drawable.module_media_default_music_img);
}
}
}
@@ -265,12 +358,22 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
Log.d(TAG, "onMusicPlaying===" + mMediaInfoData);
isFirstPlay = false;
updateWindowUI(false);
if (mWindowPlayPause != null) {
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play);
}
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (mPauseImage != null) {
mPauseImage.setImageResource(R.drawable.module_media_window_pop_play);
}
if (mCircleImg != null) {
mCircleImg.startAnim();
if (mAnimCircleImageView != null) {
mAnimCircleImageView.startAnim();
}
} else {
if (mWindowPlayPause != null) {
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play);
}
if (mCircleImg != null) {
mCircleImg.startAnim();
}
}
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setMediaPlayStatus(TAG, true);
@@ -280,12 +383,22 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
public void onMusicPause() {
Logger.d(TAG, "onMusicPause: ===" + mMediaInfoData);
Log.d(TAG, "onMusicPause: ===" + mMediaInfoData);
if (mWindowPlayPause != null) {
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
}
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (mPauseImage != null) {
mPauseImage.setImageResource(R.drawable.module_media_window_pop_pause);
}
if (mCircleImg != null) {
mCircleImg.stopAnim();
if (mAnimCircleImageView != null) {
mAnimCircleImageView.stopAnim();
}
} else {
if (mWindowPlayPause != null) {
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
}
if (mAnimCircleImageView != null) {
mAnimCircleImageView.stopAnim();
}
}
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setMediaPlayStatus(TAG,false);
@@ -295,12 +408,22 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
public void onMusicStopped() {
Logger.d(TAG, "onMusicStopped===" + mMediaInfoData);
Log.d(TAG, "onMusicStopped===" + mMediaInfoData);
if (mWindowPlayPause != null) {
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
}
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (mPauseImage != null) {
mPauseImage.setImageResource(R.drawable.module_media_window_pop_pause);
}
if (mCircleImg != null) {
mCircleImg.stopAnim();
if (mAnimCircleImageView != null) {
mAnimCircleImageView.stopAnim();
}
} else {
if (mWindowPlayPause != null) {
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
}
if (mCircleImg != null) {
mCircleImg.stopAnim();
}
}
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setMediaPlayStatus(TAG,false);
@@ -318,22 +441,37 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
@Override
public void onMusicProgress(long current, long total) {
// Logger.d(TAG, "onMusicProgress==current: " + current + " total: " + total);
if (mMediaInfoData != null) {
mMediaInfoData.setCurTime((int) current);
mMediaInfoData.setMaxTime((int) total);
}
if (mWindowCurrTime != null) {
mWindowCurrTime.setText(Utils.calculateTime((int) current));
mWindowMaxTime.setText(Utils.calculateTime((int) total));
}
try {
int progress =
(int) ((current * 1.0f * 100) / (total * 1.0f));
if (mWindowProgress != null) {
mWindowProgress.setProgress(progress);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
try {
int progress =
(int) ((current * 1.0f * 100) / (total * 1.0f));
if (mPercentageRingView != null) {
mPercentageRingView.setVisibility(View.VISIBLE);
Log.d(TAG, "progress vr = " + progress);
mPercentageRingView.setTargetPercent(progress);
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
if (mMediaInfoData != null) {
mMediaInfoData.setCurTime((int) current);
mMediaInfoData.setMaxTime((int) total);
}
if (mWindowCurrTime != null) {
mWindowCurrTime.setText(Utils.calculateTime((int) current));
mWindowMaxTime.setText(Utils.calculateTime((int) total));
}
try {
int progress =
(int) ((current * 1.0f * 100) / (total * 1.0f));
if (mWindowProgress != null) {
Log.d(TAG, "progress = " + progress);
mWindowProgress.setProgress(progress);
}
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/module_media_pop_window_size"
android:layout_height="@dimen/module_media_pop_window_size">
<com.mogo.module.media.widget.PercentageRingView
android:id="@+id/window_circle_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:circleBackground="@color/modules_media_music_bg_color"
app:radius="100"
app:ringColor="@color/modules_media_music_circle_color" />
<com.mogo.module.media.widget.AnimCircleImageView
android:id="@+id/window_circle_img_new"
android:layout_width="@dimen/module_media_pop_window_anim_img_size_new"
android:layout_height="@dimen/module_media_pop_window_anim_img_size_new"
android:src="@drawable/module_media_default_music_img"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/window_play_pause_new"
android:layout_width="@dimen/module_media_pop_window_pause"
android:layout_height="@dimen/module_media_pop_window_pause"
android:background="@drawable/module_media_play_bg_selector"
android:src="@drawable/module_media_window_pop_play"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -2,7 +2,8 @@
<resources>
<dimen name="module_media_music_state_location">872px</dimen>
<dimen name="module_media_music_state_location_x">1067px</dimen>
<dimen name="module_media_music_state_location_new">40px</dimen>
<dimen name="module_media_music_state_location_x_new">1760px</dimen>
<!-- lcc start-->
<dimen name="module_media_back_width">660px</dimen>
<dimen name="module_media_back_height">660px</dimen>
@@ -63,9 +64,14 @@
<dimen name="module_media_pop_window_width">600px</dimen>
<dimen name="module_media_pop_window_height">140px</dimen>
<dimen name="module_media_pop_window_width_new">116px</dimen>
<dimen name="module_media_pop_window_height_new">116px</dimen>
<dimen name="module_media_pop_window_inner_height">112px</dimen>
<dimen name="module_media_pop_window_inner_padding">30px</dimen>
<dimen name="module_media_pop_window_anim_img_size">80px</dimen>
<dimen name="module_media_pop_window_anim_img_size_new">90px</dimen>
<dimen name="module_media_pop_window_pause">60px</dimen>
<dimen name="module_media_pop_window_size">116px</dimen>
<dimen name="module_media_pop_window_text_width">230px</dimen>
<dimen name="module_media_pop_window_text_margin">14px</dimen>
<dimen name="module_media_pop_window_text_top_size">35px</dimen>

View File

@@ -35,4 +35,12 @@
<attr format="color" name="civ_fill_color"/>
</declare-styleable>
<declare-styleable name="PercentageRing">
<attr name="radius" format="integer"/>
<attr name="circleBackground" format="color"/>
<attr name="ringColor" format="color"/>
<attr name="textColor" format = "color"/>
</declare-styleable>
</resources>

View File

@@ -2,4 +2,6 @@
<resources>
<color name="modules_media_music_title_text_color">#fff</color>
<color name="modules_media_music_time_text_color">#7affffff</color>
<color name="modules_media_music_bg_color">#444E6E</color>
<color name="modules_media_music_circle_color">#B63737</color>
</resources>

View File

@@ -2,6 +2,8 @@
<resources>
<dimen name="module_media_music_state_location">467px</dimen>
<dimen name="module_media_music_state_location_x">573px</dimen>
<dimen name="module_media_music_state_location_new">80px</dimen>
<dimen name="module_media_music_state_location_x_new">930px</dimen>
<!-- lcc start-->
<dimen name="module_media_back_width">352px</dimen>
@@ -63,9 +65,13 @@
<dimen name="module_media_pop_window_width">338px</dimen>
<dimen name="module_media_pop_window_height">82px</dimen>
<dimen name="module_media_pop_window_width_new">116px</dimen>
<dimen name="module_media_pop_window_height_new">116px</dimen>
<dimen name="module_media_pop_window_inner_height">60px</dimen>
<dimen name="module_media_pop_window_inner_padding">18px</dimen>
<dimen name="module_media_pop_window_anim_img_size">44px</dimen>
<dimen name="module_media_pop_window_anim_img_size_new">55px</dimen>
<dimen name="module_media_pop_window_pause">60px</dimen>
<dimen name="module_media_pop_window_text_width">123px</dimen>
<dimen name="module_media_pop_window_text_margin">10px</dimen>
<dimen name="module_media_pop_window_text_top_size">18px</dimen>

View File

@@ -1,19 +1,23 @@
plugins {
id 'com.android.library'
}
apply plugin: 'com.android.library'
apply plugin: 'com.alibaba.arouter'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
compileSdkVersion rootProject.ext.android.compileSdkVersion
// buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
@@ -22,6 +26,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
@@ -30,7 +35,25 @@ android {
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
annotationProcessor rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(RELEASE)) {
api rootProject.ext.dependencies.mogomap
api rootProject.ext.dependencies.mogomapapi
api rootProject.ext.dependencies.mogoutils
api rootProject.ext.dependencies.mogocommons
api rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.modulecommon
} else {
api project(":libraries:mogo-map")
api project(":libraries:mogo-map-api")
api project(":foudations:mogo-utils")
api project(":foudations:mogo-commons")
api project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
}
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.module
POM_ARTIFACT_ID=module-small-map
VERSION_CODE=1

View File

@@ -2,4 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.module.small.map">
<application>
<service
android:name=".SmallMapService"
android:exported="false"
android:process=":smallMap" />
</application>
</manifest>

View File

@@ -0,0 +1,12 @@
package com.mogo.module.small.map;
import com.mogo.service.module.IMogoModuleProvider;
/**
* @author donghongyu
* @date 12/10/20 1:36 PM
*/
public interface IMogoSmallMapProvider extends IMogoModuleProvider {
String path = "/small_map/api";
}

View File

@@ -0,0 +1,79 @@
package com.mogo.module.small.map;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import androidx.annotation.Nullable;
import com.mogo.module.common.entity.MogoSnapshotSetData;
import com.mogo.module.common.machinevision.IMachineVisionInterface;
import com.mogo.module.common.wm.WindowManagerView;
import com.mogo.utils.logger.Logger;
/**
* @author donghongyu
* @date 12/10/20 1:35 PM
*/
public class SmallMapService extends Service {
private static final String TAG = "MachineVisionMapService";
private IBinder mBinder;
private WindowManagerView mMachineVisionMapViewManager;
private SmallMapView mMapView;
@Nullable
@Override
public IBinder onBind(Intent intent) {
mBinder = new SmallMapServiceBinder();
addMachineVisionMapView();
Logger.d(TAG, "onBind");
return mBinder;
}
@Override
public void onRebind(Intent intent) {
super.onRebind(intent);
addMachineVisionMapView();
Logger.d(TAG, "onRebind");
}
@Override
public boolean onUnbind(Intent intent) {
return true;
}
@Override
public void onDestroy() {
super.onDestroy();
}
private void addMachineVisionMapView() {
}
/**
* 小地图与大地图之间进程通讯
*/
public class SmallMapServiceBinder extends IMachineVisionInterface.Stub {
@Override
public void postData(MogoSnapshotSetData data) throws RemoteException {
}
@Override
public void hideViewIfExist() throws RemoteException {
}
@Override
public void showViewIfExist() throws RemoteException {
}
}
}

View File

@@ -0,0 +1,47 @@
package com.mogo.module.small.map;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import androidx.annotation.Nullable;
import com.mogo.map.MogoBaseMapView;
/**
* @author donghongyu
* @date 12/10/20 1:35 PM
*/
public class SmallMapView extends MogoBaseMapView {
private final String TAG = "SmallMapView";
public SmallMapView(Context context) {
this(context, null);
}
public SmallMapView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public SmallMapView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void addDleMaps() {
Log.d(TAG, "addDleMaps……");
}
@Override
public void display2DMap(boolean invokeCreateAuto, boolean invokeResumeAuto) {
Log.d(TAG, "display2DMap……");
}
@Override
public void displayVRMap(boolean invokeCreateAuto, boolean invokeResumeAuto) {
Log.d(TAG, "displayVRMap……");
}
}

View File

@@ -0,0 +1,8 @@
package com.mogo.module.small.map;
/**
* @author donghongyu
* @date 12/10/20 1:35 PM
*/
public class SmallMapViewHandler {
}

View File

@@ -0,0 +1,54 @@
package com.mogo.module.small.map;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.service.module.ModuleType;
/**
* @author donghongyu
* @date 12/10/20 1:34 PM
*/
@Route(path = IMogoSmallMapProvider.path)
public class SmallVisionProvider implements IMogoSmallMapProvider {
private final String TAG = "SmallVisionProvider";
@Override
public Fragment createFragment(Context context, Bundle data) {
return null;
}
@Override
public View createView(Context context) {
return null;
}
@NonNull
@Override
public String getModuleName() {
return TAG;
}
@Override
public int getType() {
return ModuleType.TYPE_SERVICE;
}
@Override
public void init(Context context) {
Log.d(TAG, "小地图模块初始化……");
}
@Override
public void onDestroy() {
Log.d(TAG, "小地图模块销毁……");
}
}

View File

@@ -1,5 +1,7 @@
package com.mogo.module.v2x;
import com.mogo.module.common.MogoApisHandler;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
@@ -8,6 +10,8 @@ package com.mogo.module.v2x;
* version: 1.0
*/
public class V2XConst {
public static final String T_SCENARIO_HISTORY = "t_search_poi";
/**
* V2X面板名称
*/

View File

@@ -19,7 +19,6 @@ import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.MogoMarkersHandler;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.uicontroller.EnumMapUI;
@@ -37,7 +36,6 @@ import com.mogo.module.v2x.network.V2XRefreshCallback;
import com.mogo.module.v2x.receiver.SceneBroadcastReceiver;
import com.mogo.module.v2x.scenario.impl.V2XScenarioManager;
import com.mogo.module.v2x.scenario.scene.livecar.V2XVoiceCallLiveBiz;
import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario;
import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkWindow;
import com.mogo.module.v2x.utils.FatigueDrivingUtils;
import com.mogo.module.v2x.utils.TimeUtils;
@@ -52,12 +50,9 @@ import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.mogo.utils.storage.SharedPrefsMgr;
import static com.mogo.module.v2x.VideoInitKt.initVideo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
import static com.mogo.module.v2x.VideoInitKt.initVideo;
/**
* author : donghongyu
@@ -237,12 +232,12 @@ public class V2XModuleProvider implements
@Override
public boolean onMarkerClicked(IMogoMarker marker) {
Log.d(TAG,"onMarkerClicked2222");
Log.d(TAG, "onMarkerClicked2222");
//点击的marker的具体数据
MarkerExploreWay exploreWay = extractFromMarker(marker);
MarkerExploreWayItem item = exploreWay.getItems().get(0);
MarkerExploreWayItem item = exploreWay.getItems().get(0);
String path = item.getUrl();
if (path.contains(".mp4")){
if (path.contains(".mp4")) {
initVideo();
}
@@ -285,9 +280,9 @@ public class V2XModuleProvider implements
Logger.d(V2XConst.MODULE_NAME,
"V2X===违章停车:onMarkerClicked=" + markerExploreWay);
((V2XIllegalParkWindow) V2XIllegalParkScenario.getInstance()
.getV2XWindow())
.show(markerExploreWay, false);
//直接展示弹窗
V2XIllegalParkWindow parkScenario = new V2XIllegalParkWindow();
parkScenario.show(markerExploreWay, false);
} catch (Exception e) {
e.printStackTrace();
}

View File

@@ -14,6 +14,7 @@ import com.mogo.module.v2x.adapter.holder.V2XLiveVideoVH;
import com.mogo.module.v2x.adapter.holder.V2XOtherSeekHelpVH;
import com.mogo.module.v2x.adapter.holder.V2XPushEventVH;
import com.mogo.module.v2x.adapter.holder.V2XRoadEventVH;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import java.util.List;
@@ -28,8 +29,12 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
private List<V2XEventShowEntity> itemList;
public V2XRoadEventAdapter(List<V2XEventShowEntity> itemList) {
// 当前展示条目绑定的window
private IV2XWindow mV2XWindow;
public V2XRoadEventAdapter(List<V2XEventShowEntity> itemList, IV2XWindow v2XWindow) {
this.itemList = itemList;
this.mV2XWindow = v2XWindow;
}
@NonNull
@@ -39,31 +44,31 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
switch (viewType) {
// 直播
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING:
holder = new V2XLiveVideoVH(parent);
holder = new V2XLiveVideoVH(parent, mV2XWindow);
break;
//道路事件详情
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
holder = new V2XRoadEventVH(parent);
holder = new V2XRoadEventVH(parent, mV2XWindow);
break;
//违章停车
case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
holder = new V2XIllegalParkVH(parent);
holder = new V2XIllegalParkVH(parent, mV2XWindow);
break;
//推送展示
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
holder = new V2XPushEventVH(parent);
holder = new V2XPushEventVH(parent, mV2XWindow);
break;
//疲劳驾驶
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
holder = new V2XFatigueDrivingVH(parent);
holder = new V2XFatigueDrivingVH(parent, mV2XWindow);
break;
//他人故障求助
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
holder = new V2XOtherSeekHelpVH(parent);
holder = new V2XOtherSeekHelpVH(parent, mV2XWindow);
break;
//道路事件UGC
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
holder = new V2XEventUgcVH(parent);
holder = new V2XEventUgcVH(parent, mV2XWindow);
break;
}
return holder;

View File

@@ -107,7 +107,7 @@ public class V2XShareEventAdapter extends RecyclerView.Adapter<RecyclerView.View
if (poitype != null) {
((shareItemViewHolder) holder).caseStyleTextView.setText(EventTypeUtils.getPoiTypeStr(poitype));
((shareItemViewHolder) holder).caseStyleTextView.setBackgroundResource(EventTypeUtils.getPoiTypeBg(poitype));
((shareItemViewHolder) holder).caseStyleTextView.setBackgroundResource(EventTypeUtils.getPoiTypeBgForShareItem(poitype));
}
if (address != null) {

View File

@@ -17,6 +17,7 @@ import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.V2XEventZanData;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.ChartingUtil;
import com.mogo.module.v2x.utils.RoadConditionUtils;
import com.mogo.module.v2x.utils.TimeUtils;
@@ -43,10 +44,13 @@ public abstract class V2XBaseViewHolder<T>
private static final String TAG = "V2XBaseViewHolder";
private ICarsChattingProvider mCarsChattingProvider;
public V2XBaseViewHolder(@NonNull View itemView) {
super(itemView);
}
// 当前展示条目绑定的window
protected IV2XWindow mV2XWindow;
public V2XBaseViewHolder(@NonNull View itemView, IV2XWindow v2XWindow) {
super(itemView);
mV2XWindow = v2XWindow;
}
/**
* 填充View视图
@@ -58,7 +62,13 @@ public abstract class V2XBaseViewHolder<T>
/**
* 延迟关闭窗体视图
*/
public abstract void delayedCloseWindow();
public void delayedCloseWindow() {
itemView.post(() -> {
if (mV2XWindow != null) {
mV2XWindow.close();
}
});
}
/**
* 点赞
@@ -105,7 +115,7 @@ public abstract class V2XBaseViewHolder<T>
String name = noveltyInfo.getUserInfo().getUserName();
mogoDriverInfo.setUserName(name != null ? name : "");
mogoDriverInfo.setUserHead(noveltyInfo.getUserInfo().getUserHead());
if ( mCarsChattingProvider != null ) {
if (mCarsChattingProvider != null) {
mCarsChattingProvider.showUserWindow(MODULE_NAME, mogoDriverInfo, this.itemView.getContext());
}

View File

@@ -16,7 +16,7 @@ import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.scene.ugc.V2XEventUgcScenario;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.EventTypeUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
@@ -59,9 +59,10 @@ public class V2XEventUgcVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private V2XRoadEventEntity mV2XRoadEventEntity;
private V2XEventShowEntity mV2XEventShowEntity;
public V2XEventUgcVH(ViewGroup viewGroup) {
public V2XEventUgcVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_event_ugc, viewGroup, false));
.inflate(R.layout.item_v2x_event_ugc, viewGroup, false)
, v2XWindow);
ivEventTypeIcon = itemView.findViewById(R.id.ivEventTypeIcon);
tvEventUgcTitle = itemView.findViewById(R.id.tvEventUgcTitle);
ivEventReportTrue = itemView.findViewById(R.id.ivEventReportTrue);
@@ -197,12 +198,4 @@ public class V2XEventUgcVH extends V2XBaseViewHolder<V2XEventShowEntity> {
delayedCloseWindow();
}
/**
* 延迟关闭窗体
*/
@Override
public void delayedCloseWindow() {
itemView.postDelayed(() -> V2XEventUgcScenario.getInstance().close(), 1000);
}
}

View File

@@ -14,7 +14,7 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.service.Utils;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.scenario.scene.fatigue.V2XFatigueDrivingScenario;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.LocationUtils;
import com.mogo.module.v2x.utils.SpanUtils;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
@@ -39,15 +39,16 @@ public class V2XFatigueDrivingVH extends V2XBaseViewHolder<V2XEventShowEntity> {
// 语音控制导航
private V2XVoiceCallbackListener mNaviCb = (command, intent) -> triggerStartNavi(mNoveltyInfo);
public V2XFatigueDrivingVH(ViewGroup viewGroup) {
public V2XFatigueDrivingVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_fatigue_driving, viewGroup, false));
.inflate(R.layout.item_v2x_fatigue_driving, viewGroup, false)
, v2XWindow);
mTvAddress = itemView.findViewById(R.id.tvAddress);
mTvAddressDistance = itemView.findViewById(R.id.tvAddressDistance);
mIvToNav = itemView.findViewById(R.id.ivToNav);
mIvClose = itemView.findViewById(R.id.ivClose);
mIvToNav.setOnClickListener(v -> triggerStartNavi(mNoveltyInfo));
mIvClose.setOnClickListener(v -> V2XFatigueDrivingScenario.getInstance().close());
mIvClose.setOnClickListener(v -> delayedCloseWindow());
// 设置视图状态监听
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@@ -106,12 +107,5 @@ public class V2XFatigueDrivingVH extends V2XBaseViewHolder<V2XEventShowEntity> {
.create();
}
/**
* 延迟关闭窗体
*/
@Override
public void delayedCloseWindow() {
itemView.postDelayed(() -> V2XFatigueDrivingScenario.getInstance().close(), 1000);
}
}

View File

@@ -0,0 +1,260 @@
package com.mogo.module.v2x.adapter.holder;
import android.util.Log;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.voice.AIAssist;
import com.mogo.map.MogoLatLng;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.navi.MogoTraffic;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.V2XEventZanData;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.ChartingUtil;
import com.mogo.module.v2x.utils.RoadConditionUtils;
import com.mogo.module.v2x.utils.TimeUtils;
import com.mogo.module.v2x.utils.TrackUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
import com.zhidao.carchattingprovider.ICarsChattingProvider;
import com.zhidao.carchattingprovider.MogoDriverInfo;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* 出行动态
*
* @author donghongyu
*/
public abstract class V2XHistoryBaseViewHolder<T>
extends RecyclerView.ViewHolder
implements IMogoNaviListener {
private static final String TAG = "V2XBaseViewHolder";
private ICarsChattingProvider mCarsChattingProvider;
public V2XHistoryBaseViewHolder(@NonNull View itemView) {
super(itemView);
}
/**
* 填充View视图
*
* @param viewData 与视图绑定的数据
*/
public abstract void initView(T viewData);
/**
* 延迟关闭窗体视图
*/
public void delayedCloseWindow() {
}
/**
* 点赞
*/
public void triggerZan(MarkerExploreWay noveltyInfo) {
try {
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已点赞", null);
showTip("已点赞");
if (noveltyInfo != null) {
// 调用网络API接口
V2XServiceManager.getV2XMarkerService()
.getV2XRefreshModel()
.giveLikeLiveVideo(null, noveltyInfo.getSn());
V2XEventZanData v2XEventZanData = new V2XEventZanData();
v2XEventZanData.setEventId(noveltyInfo.getInfoId());
v2XEventZanData.setTriggerTime(TimeUtils.getNowMills());
V2XSQLiteUtils.saveEventZanLocalStory(v2XEventZanData);
// 上报数据统计
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
noveltyInfo.getSn(),
V2XConst.V2X_ROAD_ZAN);
}
} catch (Exception e) {
e.printStackTrace();
}
delayedCloseWindow();
}
public void triggerIVReportHead(MarkerExploreWay noveltyInfo) {
Log.d(TAG, "点击头像" + mCarsChattingProvider);
try {
mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation();
MogoDriverInfo mogoDriverInfo = new MogoDriverInfo();
int ageNumber = noveltyInfo.getUserInfo().getAgeNumber();
mogoDriverInfo.setAge(ageNumber);
String gender = noveltyInfo.getUserInfo().getGender();
mogoDriverInfo.setGender(gender);
String sn = noveltyInfo.getUserInfo().getSn();
mogoDriverInfo.setSn(sn != null ? sn : "");
String name = noveltyInfo.getUserInfo().getUserName();
mogoDriverInfo.setUserName(name != null ? name : "");
mogoDriverInfo.setUserHead(noveltyInfo.getUserInfo().getUserHead());
if (mCarsChattingProvider != null) {
mCarsChattingProvider.showUserWindow(MODULE_NAME, mogoDriverInfo, this.itemView.getContext());
}
} catch (Exception e) {
Log.d(TAG, "点击头像发生错误--triggerIVReportHead" + e);
e.printStackTrace();
}
}
/**
* 打电话
*/
public void triggerCallChart(MarkerExploreWay noveltyInfo) {
try {
MarkerLocation location = new MarkerLocation();
location.setLat(noveltyInfo.getLocation().getLat());
location.setLon(noveltyInfo.getLocation().getLon());
ChartingUtil.callChatting(noveltyInfo.getUserInfo(), location);
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
noveltyInfo.getSn(),
V2XConst.V2X_ROAD_CHAT);
} catch (Exception e) {
e.printStackTrace();
TipToast.tip("用户信息异常");
}
delayedCloseWindow();
}
/**
* 反馈路况错误
*/
public void triggerReportErr(MarkerExploreWay noveltyInfo) {
try {
RoadConditionUtils.sendShareReceiverInfo(
noveltyInfo.getInfoId(),
noveltyInfo.getPoiType(),
3);
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
noveltyInfo.getSn(),
V2XConst.V2X_ROAD_REPORT_ERROR);
} catch (Exception e) {
e.printStackTrace();
TipToast.tip("路况信息异常");
}
delayedCloseWindow();
}
/**
* 反馈路况正确
*/
public void triggerReportTrue(MarkerExploreWay noveltyInfo) {
try {
RoadConditionUtils.sendShareReceiverInfo(
noveltyInfo.getInfoId(),
noveltyInfo.getPoiType(),
2);
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
noveltyInfo.getSn(),
V2XConst.V2X_ROAD_REPORT_RIGHT);
} catch (Exception e) {
e.printStackTrace();
TipToast.tip("路况信息异常");
}
delayedCloseWindow();
}
/**
* 导航规划路线
*/
public void triggerStartNavi(MarkerExploreWay noveltyInfo) {
try {
V2XServiceManager.getMogoRegisterCenter().registerMogoNaviListener(MODULE_NAME, this);
MogoLatLng endPoint = new MogoLatLng(
noveltyInfo.getLocation().getLat(),
noveltyInfo.getLocation().getLon());
V2XServiceManager.getNavi().naviTo(endPoint);
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
noveltyInfo.getSn(),
V2XConst.V2X_ROAD_NAVI);
} catch (Exception e) {
e.printStackTrace();
TipToast.tip("路况信息异常");
}
delayedCloseWindow();
}
/**
* 显示自定义 Toast
*
* @param msg
*/
public void showTip(String msg) {
TipToast.tip(msg);
}
@Override
public void onInitNaviFailure() {
}
@Override
public void onInitNaviSuccess() {
}
@Override
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
}
@Override
public void onStartNavi() {
}
@Override
public void onStopNavi() {
}
@Override
public void onCalculateSuccess() {
Logger.w(TAG, "onCalculateSuccess");
V2XServiceManager.getNavi().startNavi(true);
V2XServiceManager.getMogoRegisterCenter().unregisterMogoNaviListener(MODULE_NAME);
}
@Override
public void onoCalculateFailed() {
}
@Override
public void onUpdateTraffic(MogoTraffic traffic) {
}
}

View File

@@ -1,10 +1,13 @@
package com.mogo.module.v2x.adapter.holder;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XHistoryScenarioData;
@@ -12,7 +15,7 @@ import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.RoadConditionUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.module.v2x.view.HeartLikeView;
@@ -45,9 +48,12 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private V2XVoiceCallbackListener v2XVoiceCallbackYouYongListener = (command, intent) -> roadReportTrue();
private V2XVoiceCallbackListener v2XVoiceCallbackMeiYongListener = (command, intent) -> roadReportErr();
public V2XIllegalParkVH(ViewGroup viewGroup) {
public V2XIllegalParkVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_illegal_parking, viewGroup, false));
.inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
R.layout.item_v2x_illegal_parking_vr :
R.layout.item_v2x_illegal_parking, viewGroup, false)
, v2XWindow);
mAddressTv = itemView.findViewById(R.id.tvAddress);
mIllegalNumTv = itemView.findViewById(R.id.tvIllegalNum);
@@ -105,11 +111,12 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder<V2XEventShowEntity> {
*/
@Override
public void delayedCloseWindow() {
V2XHistoryScenarioData v2XHistoryScenarioData =new V2XHistoryScenarioData();
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
v2XHistoryScenarioData.setScenarioType(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING);
v2XHistoryScenarioData.setEventJsonData(GsonUtil.jsonFromObject(mExploreWay));
v2XHistoryScenarioData.setEventJsonDataHashCode(mExploreWay.hashCode());
V2XSQLiteUtils.updateScenarioHistoryDataIsDispose(v2XHistoryScenarioData);
itemView.postDelayed(() -> V2XIllegalParkScenario.getInstance().close(), 1000);
super.delayedCloseWindow();
}
/**

View File

@@ -11,6 +11,7 @@ import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.TrackUtils;
import com.mogo.module.v2x.view.V2XLiveGSYVideoView;
import com.mogo.service.imageloader.MogoImageView;
@@ -21,6 +22,7 @@ import com.mogo.service.imageloader.MogoImageView;
* date : 2020/3/11 4:35 PM
* desc : 直播类型的卡片
* version: 1.0
*
* @author donghongyu
*/
public class V2XLiveVideoVH extends V2XBaseViewHolder<V2XEventShowEntity> {
@@ -35,8 +37,8 @@ public class V2XLiveVideoVH extends V2XBaseViewHolder<V2XEventShowEntity> {
// 预警的道路事件数据
private V2XRoadEventEntity mV2XRoadEventEntity;
public V2XLiveVideoVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_live_video, viewGroup, false));
public V2XLiveVideoVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
super(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_live_video, viewGroup, false), v2XWindow);
videoPlayer = itemView.findViewById(R.id.videoPlayer);
ivReportHead = itemView.findViewById(R.id.ivReportHead);
}
@@ -57,9 +59,4 @@ public class V2XLiveVideoVH extends V2XBaseViewHolder<V2XEventShowEntity> {
TrackUtils.trackV2xRoadEvent(mV2XRoadEventEntity.getNoveltyInfo().getInfoId(), v2XLiveCarEntity.getSn(), V2XConst.V2X_ROAD_VIDEO);
}
@Override
public void delayedCloseWindow() {
ivReportHead.postDelayed(() -> V2XRoadEventScenario.getInstance().close(), 2000);
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.module.v2x.adapter.holder;
import android.content.Context;
import android.content.res.Resources;
import android.text.TextUtils;
import android.view.LayoutInflater;
@@ -8,6 +9,8 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
@@ -16,7 +19,7 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpScenario;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.ChartingUtil;
import com.mogo.module.v2x.utils.SpanUtils;
import com.mogo.module.v2x.utils.V2XUtils;
@@ -24,6 +27,7 @@ import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.imageloader.MogoImageView;
import com.mogo.utils.glide.GlideRoundedCornersTransform;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -42,6 +46,7 @@ import static android.view.View.VISIBLE;
*/
public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private Context mContext;
private MogoImageView ivHead;
private TextView tvName;
private TextView tvDistance;
@@ -68,9 +73,13 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
// 查看车辆信息
private V2XVoiceCallbackListener mVoiceOpenCarInfoLis = ((command, intent) -> triggerIVReportHead(mNoveltyInfo));
public V2XOtherSeekHelpVH(ViewGroup viewGroup) {
public V2XOtherSeekHelpVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_fault_help, viewGroup, false));
.inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
R.layout.item_v2x_fault_help_vr :
R.layout.item_v2x_fault_help, viewGroup, false)
, v2XWindow);
mContext = viewGroup.getContext();
ivHead = itemView.findViewById(R.id.ivFaultHelpHead);
tvName = itemView.findViewById(R.id.tvFaultHelpName);
tvDistance = itemView.findViewById(R.id.tvFaultHelpDistance);
@@ -177,8 +186,13 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
}
try {
if (!TextUtils.isEmpty(mV2XPushMessageEntity.getHeadImgUrl())) {
V2XServiceManager.getImageLoader()
.displayImage(mV2XPushMessageEntity.getHeadImgUrl(), ivHead);
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
Glide.with(mContext).load(mV2XPushMessageEntity.getHeadImgUrl()).apply(RequestOptions.bitmapTransform(
new GlideRoundedCornersTransform(20, GlideRoundedCornersTransform.CornerType.LEFT))).into(ivHead);
} else {
V2XServiceManager.getImageLoader()
.displayImage(mV2XPushMessageEntity.getHeadImgUrl(), ivHead);
}
}
tvName.setText(mV2XPushMessageEntity.getDisplayName());
@@ -194,7 +208,9 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
.append("" + (int) mV2XPushMessageEntity.getDistance())
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
.append("")
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
.setFontSize((int) itemView.getResources().getDimension(
V2XServiceManager.getMoGoStatusManager().isVrMode() ?
R.dimen.module_v2x_event_distance_title_vr : R.dimen.module_v2x_event_distance_title))
.create();
}
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA);
@@ -207,12 +223,4 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
}
}
/**
* 延迟关闭窗体
*/
@Override
public void delayedCloseWindow() {
itemView.postDelayed(() -> V2XSeekHelpScenario.getInstance().close(), 1000);
}
}

View File

@@ -13,7 +13,7 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.scene.push.V2XPushEventScenario;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
@@ -27,6 +27,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* date : 2020/3/11 4:35 PM
* desc : TODO 这里是前瞻演示需求,推送的消息,
* version: 1.0
*
* @author donghongyu
*/
public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
@@ -65,9 +66,10 @@ public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
// 点赞语音回调
private V2XVoiceCallbackListener v2XVoiceCallbackLickListener = (command, intent) -> triggerZan(mNoveltyInfo);
public V2XPushEventVH(ViewGroup viewGroup) {
public V2XPushEventVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_push_event_detail, viewGroup, false));
.inflate(R.layout.item_v2x_push_event_detail, viewGroup, false)
, v2XWindow);
ivImg = itemView.findViewById(R.id.ivImg);
ivReportHead = itemView.findViewById(R.id.ivReportHead);
@@ -178,12 +180,4 @@ public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
}
}
/**
* 延迟关闭窗体
*/
@Override
public void delayedCloseWindow() {
itemView.postDelayed(() -> V2XPushEventScenario.getInstance().close(), 1000);
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.module.v2x.adapter.holder;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
@@ -9,8 +10,9 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerUserInfo;
import com.mogo.module.common.entity.V2XEventShowEntity;
@@ -22,9 +24,9 @@ import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
import com.mogo.module.v2x.network.V2XRefreshCallback;
import com.mogo.module.v2x.scenario.scene.livecar.V2XRoadLiveCarScenario;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventWindow;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadVideoCarScenario;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.ChartingUtil;
import com.mogo.module.v2x.utils.EventTypeUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
@@ -35,6 +37,7 @@ import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.imageloader.MogoImageView;
import com.mogo.utils.ArrayUtils;
import com.mogo.utils.DateTimeUtils;
import com.mogo.utils.glide.GlideRoundedCornersTransform;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
@@ -57,6 +60,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private static final String TAG = "V2XRoadEventVH";
private Context mContext;
private MogoImageView ivEventImg;
private MogoImageView ivReportHead;
private ImageView ivEventPlay;
@@ -138,11 +142,12 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
ivEventReportErr = itemView.findViewById(R.id.ivEventReportErr);
}
public V2XRoadEventVH(ViewGroup viewGroup) {
super(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ?
LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail, viewGroup, false) :
LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail_vr, viewGroup, false)
);
public V2XRoadEventVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
super(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail_vr, viewGroup, false) :
LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail, viewGroup, false)
, v2XWindow);
mContext = viewGroup.getContext();
init(itemView);
// 设置视图状态监听
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@@ -205,8 +210,13 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
imgUrl = mNoveltyInfo.getItems().get(0).getUrl();
}
if (!TextUtils.isEmpty(imgUrl)) {
V2XServiceManager.getImageLoader()
.displayImage(imgUrl, ivEventImg);
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
Glide.with(mContext).load(imgUrl).apply(RequestOptions.bitmapTransform(
new GlideRoundedCornersTransform(20, GlideRoundedCornersTransform.CornerType.LEFT))).into(ivEventImg);
} else {
V2XServiceManager.getImageLoader()
.displayImage(imgUrl, ivEventImg);
}
}
if (url.contains(".mp4")) {
ivEventImg.setOnClickListener(v -> {
@@ -339,8 +349,11 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
V2XRoadLiveCarScenario.getInstance().init(v2XMessageEntity);
// 打开直播后,窗口倒计时暂停关闭,直播被关闭后继续倒计时
V2XRoadEventWindow window = (V2XRoadEventWindow) V2XRoadEventScenario.getInstance().getV2XWindow();
window.stopCountDown();
if (mV2XWindow != null) {
if (mV2XWindow instanceof V2XRoadEventWindow) {
((V2XRoadEventWindow) mV2XWindow).stopCountDown();
}
}
}
}
@@ -413,18 +426,18 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
});
}
}
/**
* 延迟关闭窗体
*/
@Override
public void delayedCloseWindow() {
itemView.postDelayed(() -> {
// 移除窗体
V2XServiceManager
.getIMogoWindowManager()
.removeView(V2XRoadEventScenario.getInstance().getV2XWindow().getView());
V2XRoadEventScenario.getInstance().close();
}, 1000);
}
//
// /**
// * 延迟关闭窗体
// */
// @Override
// public void delayedCloseWindow() {
//// itemView.postDelayed(() -> {
//// // 移除窗体
//// V2XServiceManager
//// .getIMogoWindowManager()
//// .removeView(V2XRoadEventScenario.getInstance().getV2XWindow().getView());
//// V2XRoadEventScenario.getInstance().close();
//// }, 1000);
// }
}

View File

@@ -5,8 +5,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XHistoryScenarioData;
import com.mogo.module.v2x.R;
@@ -23,7 +21,7 @@ import com.mogo.utils.network.utils.GsonUtil;
*
* @author donghongyu
*/
public class V2XScenarioHistoryIllegalParkVH extends V2XBaseViewHolder<V2XHistoryScenarioData> {
public class V2XScenarioHistoryIllegalParkVH extends V2XHistoryBaseViewHolder<V2XHistoryScenarioData> {
private TextView mTvAddress;
private TextView mTvIllegalNum;
@@ -37,7 +35,7 @@ public class V2XScenarioHistoryIllegalParkVH extends V2XBaseViewHolder<V2XHistor
private V2XHistoryScenarioData mOldScenarioData;
public V2XScenarioHistoryIllegalParkVH(@NonNull ViewGroup viewGroup) {
public V2XScenarioHistoryIllegalParkVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_scennario_history, viewGroup, false));
mTvAddress = itemView.findViewById(R.id.tvAddress);
@@ -98,6 +96,7 @@ public class V2XScenarioHistoryIllegalParkVH extends V2XBaseViewHolder<V2XHistor
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
v2XHistoryScenarioData.setEventJsonDataHashCode(mOldScenarioData.getEventJsonDataHashCode());
v2XHistoryScenarioData.setDispose(true);
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData);
mOldScenarioData.setDispose(true);

View File

@@ -7,8 +7,6 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
@@ -37,7 +35,7 @@ import static android.view.View.VISIBLE;
*
* @author donghongyu
*/
public class V2XScenarioHistoryOtherSeekHelpVH extends V2XBaseViewHolder<V2XHistoryScenarioData> {
public class V2XScenarioHistoryOtherSeekHelpVH extends V2XHistoryBaseViewHolder<V2XHistoryScenarioData> {
private TextView mTagEventType;
private TextView mTagEventEvaluate;
@@ -54,7 +52,7 @@ public class V2XScenarioHistoryOtherSeekHelpVH extends V2XBaseViewHolder<V2XHist
private V2XHistoryScenarioData mOldScenarioData;
public V2XScenarioHistoryOtherSeekHelpVH(@NonNull ViewGroup viewGroup) {
public V2XScenarioHistoryOtherSeekHelpVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_scennario_history_other_help, viewGroup, false));
mTagEventType = itemView.findViewById(R.id.tagEventType);
@@ -170,6 +168,7 @@ public class V2XScenarioHistoryOtherSeekHelpVH extends V2XBaseViewHolder<V2XHist
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
v2XHistoryScenarioData.setEventJsonDataHashCode(mOldScenarioData.getEventJsonDataHashCode());
v2XHistoryScenarioData.setDispose(true);
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData);
mOldScenarioData.setDispose(true);

View File

@@ -6,8 +6,6 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XHistoryScenarioData;
import com.mogo.module.v2x.R;
@@ -26,7 +24,7 @@ import com.mogo.utils.network.utils.GsonUtil;
*
* @author donghongyu
*/
public class V2XScenarioHistoryRoadEventVH extends V2XBaseViewHolder<V2XHistoryScenarioData> {
public class V2XScenarioHistoryRoadEventVH extends V2XHistoryBaseViewHolder<V2XHistoryScenarioData> {
private TextView mTvAddress;
private TextView mTvIllegalNum;
private ImageView mIvIconP;
@@ -39,7 +37,7 @@ public class V2XScenarioHistoryRoadEventVH extends V2XBaseViewHolder<V2XHistoryS
private MarkerExploreWay mExploreWay;
private V2XHistoryScenarioData mOldScenarioData;
public V2XScenarioHistoryRoadEventVH(@NonNull ViewGroup viewGroup) {
public V2XScenarioHistoryRoadEventVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_scennario_history, viewGroup, false));
mTvAddress = itemView.findViewById(R.id.tvAddress);
@@ -104,6 +102,7 @@ public class V2XScenarioHistoryRoadEventVH extends V2XBaseViewHolder<V2XHistoryS
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
v2XHistoryScenarioData.setEventJsonDataHashCode(mOldScenarioData.getEventJsonDataHashCode());
v2XHistoryScenarioData.setDispose(true);
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData);

View File

@@ -178,7 +178,7 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
//如果poiType是道路拥堵则调用接口查询拥堵状态
String poiType = v2XRoadEventEntity.getPoiType();
if(poiType != null && poiType.equals(FOURS_BLOCK_UP)){
if (poiType != null && poiType.equals(FOURS_BLOCK_UP)) {
V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus();
}
}
@@ -320,11 +320,11 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
/**
* 存储本地数据
*
* @param markerExploreWay 要存储的场景
* @param v2XRoadEventEntity 要存储的场景
*/
public void saveLocalStory(int scenarioType, Object markerExploreWay) {
public void saveLocalStory(int scenarioType, MarkerExploreWay v2XRoadEventEntity) {
try {
V2XSQLiteUtils.saveLocalStory(scenarioType,markerExploreWay);
V2XSQLiteUtils.saveLocalStory(scenarioType, v2XRoadEventEntity, v2XRoadEventEntity.hashCode());
} catch (Exception e) {
e.printStackTrace();
}

View File

@@ -7,20 +7,14 @@ import androidx.annotation.Nullable;
import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
import com.mogo.commons.voice.VoicePreemptType;
import com.mogo.module.common.entity.V2XHistoryScenarioData;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.manager.IMoGoV2XStatusManager;
import com.mogo.module.v2x.scenario.IV2XScenario;
import com.mogo.module.v2x.scenario.view.IV2XButton;
import com.mogo.module.v2x.scenario.view.IV2XMarker;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.TimeUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
/**
* author : donghongyu
@@ -34,11 +28,9 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
private IV2XWindow mV2XWindow;
private IV2XButton mV2XButton;
private IV2XMarker mV2XMarker;
private IMoGoV2XStatusManager mV2XStatusManager;
private V2XMessageEntity<T> mV2XMessageEntity;
protected AbsV2XScenario() {
this.mV2XStatusManager = V2XServiceManager.getMoGoV2XStatusManager();
}
public abstract void init(@Nullable V2XMessageEntity<T> v2XMessageEntity);
@@ -50,6 +42,16 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
clearPOI();
}
/**
* 释放资源
*/
public void release() {
mV2XMessageEntity = null;
mV2XWindow = null;
mV2XButton = null;
mV2XMarker = null;
}
@Override
public void speakTTSVoice(@Nullable String msg, IMogoVoiceCmdCallBack callBack) {
if (!TextUtils.isEmpty(msg)) {
@@ -97,18 +99,4 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
}
return mV2XMessageEntity.equals(v2XMessageEntity);
}
/**
* 存储本地数据
*
* @param markerExploreWay 要存储的场景
*/
public void saveLocalStory(int scenarioType, Object markerExploreWay) {
try {
V2XSQLiteUtils.saveLocalStory(scenarioType,markerExploreWay);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -22,9 +22,6 @@ import com.mogo.module.v2x.scenario.scene.ugc.V2XEventUgcScenario;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import java.util.HashMap;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -37,8 +34,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XScenarioManager implements IV2XScenarioManager {
private static V2XScenarioManager mV2XScenarioManager;
private AbsV2XScenario mV2XScenario;
private HashMap<Integer, AbsV2XScenario> mV2XScenarioSet = new HashMap<>();
private AbsV2XScenario mV2XScenario = null;
private V2XScenarioManager() {
}
@@ -64,55 +60,50 @@ public class V2XScenarioManager implements IV2XScenarioManager {
V2XUtils.runOnUiThread(() -> {
// 提取之前存储的场景
if (v2XMessageEntity != null) {
// 广播给应用内部其它模块
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
mV2XScenario = mV2XScenarioSet.get(v2XMessageEntity.getType());
// 如果没有拿到之前的,根据类型分发
if (mV2XScenario == null) {
switch (v2XMessageEntity.getType()) {
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
mV2XScenario = V2XRoadEventScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
mV2XScenario = V2XSeekHelpScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
mV2XScenario = V2XFatigueDrivingScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
mV2XScenario = V2XPushEventScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING:
mV2XScenario = V2XPushLiveCarScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_ANIMATION_WARNING:
mV2XScenario = V2XAnimationScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP:
mV2XScenario = V2XCarForHelpScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
mV2XScenario = V2XIllegalParkScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
mV2XScenario = V2XEventUgcScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW:
mV2XScenario = V2XVoiceCallLiveScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW:
mV2XScenario = V2XPushVREventScenario.getInstance();
break;
default:
Logger.e(MODULE_NAME, "当前V2X消息类型未定义。");
TipToast.tip("当前V2X消息类型未定义");
return;
}
switch (v2XMessageEntity.getType()) {
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
mV2XScenario = new V2XRoadEventScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
mV2XScenario = new V2XSeekHelpScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
mV2XScenario = new V2XFatigueDrivingScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
mV2XScenario = new V2XPushEventScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING:
mV2XScenario = new V2XPushLiveCarScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_ANIMATION_WARNING:
mV2XScenario = new V2XAnimationScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP:
mV2XScenario = new V2XCarForHelpScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
mV2XScenario = new V2XIllegalParkScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
mV2XScenario = new V2XEventUgcScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW:
mV2XScenario = new V2XVoiceCallLiveScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW:
mV2XScenario = new V2XPushVREventScenario();
break;
default:
mV2XScenario = null;
Logger.e(MODULE_NAME, "当前V2X消息类型未定义。");
TipToast.tip("当前V2X消息类型未定义");
return;
}
// 展示最新的消息
@@ -121,7 +112,6 @@ public class V2XScenarioManager implements IV2XScenarioManager {
hidOtherPanel();
}
mV2XScenario.init(v2XMessageEntity);
mV2XScenarioSet.put(v2XMessageEntity.getType(), mV2XScenario);
}
}
});

View File

@@ -0,0 +1,48 @@
package com.mogo.module.v2x.scenario.scene;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
import com.mogo.utils.logger.Logger;
/**
* @author donghongyu
* @date 12/11/20 10:35 AM
*/
public class V2XBasWindow extends RelativeLayout {
private final String TAG = "V2XBasWindow";
public V2XBasWindow(Context context) {
super(context);
}
public V2XBasWindow(Context context, AttributeSet attrs) {
super(context, attrs);
}
public V2XBasWindow(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
Logger.w(TAG, "onAttachedToWindow……");
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
Logger.w(TAG, "onDetachedFromWindow……");
release();
}
/**
* 这里释放资源
*/
protected void release() {
Logger.w(TAG, "release……");
}
}

View File

@@ -2,10 +2,10 @@ package com.mogo.module.v2x.scenario.scene.animation;
import androidx.annotation.Nullable;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.ADASUtils;
@@ -20,22 +20,8 @@ import com.mogo.utils.logger.Logger;
*/
public class V2XAnimationScenario extends AbsV2XScenario<V2XPushMessageEntity> {
private static V2XAnimationScenario mV2XAnimationScenario;
private V2XAnimationScenario() {
}
public static V2XAnimationScenario getInstance() {
if (mV2XAnimationScenario == null) {
synchronized (V2XAnimationScenario.class) {
if (mV2XAnimationScenario == null) {
mV2XAnimationScenario = new V2XAnimationScenario();
mV2XAnimationScenario.setV2XWindow(new V2XAnimationWindow());
}
}
}
return mV2XAnimationScenario;
public V2XAnimationScenario() {
setV2XWindow(new V2XAnimationWindow());
}
@Override

View File

@@ -6,11 +6,11 @@ import android.view.ViewGroup;
import androidx.annotation.Nullable;
import com.mogo.map.MogoLatLng;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
@@ -30,23 +30,11 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XFatigueDrivingScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
private static V2XFatigueDrivingScenario mV2XTiredScenario;
// 语音控制导航
private V2XVoiceCallbackListener mNaviCb = (command, intent) -> startNavi();
private V2XFatigueDrivingScenario() {
}
public static V2XFatigueDrivingScenario getInstance() {
if (mV2XTiredScenario == null) {
synchronized (V2XFatigueDrivingScenario.class) {
if (mV2XTiredScenario == null) {
mV2XTiredScenario = new V2XFatigueDrivingScenario();
mV2XTiredScenario.setV2XWindow(new V2XFatigueDrivingWindow());
}
}
}
return mV2XTiredScenario;
public V2XFatigueDrivingScenario() {
setV2XWindow(new V2XFatigueDrivingWindow());
}
@Override

View File

@@ -19,6 +19,7 @@ import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.utils.logger.Logger;
@@ -34,7 +35,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : 疲劳驾驶场景Window
* version: 1.0
*/
public class V2XFatigueDrivingWindow extends RelativeLayout
public class V2XFatigueDrivingWindow extends V2XBasWindow
implements IV2XWindow<V2XPushMessageEntity> {
// 展示列表
private RecyclerView mRecyclerView;
@@ -72,7 +73,7 @@ public class V2XFatigueDrivingWindow extends RelativeLayout
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
// 详情列表
mRecyclerView = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList,this);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);

View File

@@ -43,23 +43,12 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
private V2XSeekHelpDialog v2xFaultHelpDialog;
private V2XSeekHelpButton mV2XSeekHelpButton;
private V2XCarForHelpScenario() {
public V2XCarForHelpScenario() {
mV2XSeekHelpButton = new V2XSeekHelpButton();
setV2XButton(mV2XSeekHelpButton);
V2XServiceManager.getMoGoStatusManager().registerStatusChangedListener(TAG, StatusDescriptor.SEEK_HELPING, this);
}
public static V2XCarForHelpScenario getInstance() {
if (mV2XCarForHelpScenario == null) {
synchronized (V2XCarForHelpScenario.class) {
if (mV2XCarForHelpScenario == null) {
mV2XCarForHelpScenario = new V2XCarForHelpScenario();
}
}
}
return mV2XCarForHelpScenario;
}
@Override
public void init(@Nullable V2XMessageEntity<Boolean> v2XMessageEntity) {
// 设置Button的显示

View File

@@ -9,16 +9,12 @@ import androidx.annotation.Nullable;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.ADASUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* author : donghongyu
@@ -29,21 +25,8 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XPushLiveCarScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
private static V2XPushLiveCarScenario mV2XLiveCarScenario;
private V2XPushLiveCarScenario() {
}
public static V2XPushLiveCarScenario getInstance() {
if (mV2XLiveCarScenario == null) {
synchronized (V2XPushLiveCarScenario.class) {
if (mV2XLiveCarScenario == null) {
mV2XLiveCarScenario = new V2XPushLiveCarScenario();
mV2XLiveCarScenario.setV2XWindow(new V2XPushLiveCarWindow());
}
}
}
return mV2XLiveCarScenario;
public V2XPushLiveCarScenario() {
setV2XWindow(new V2XPushLiveCarWindow());
}
@Override

View File

@@ -14,6 +14,7 @@ import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.MarkerUtils;
import com.mogo.module.v2x.view.V2XLiveGSYVideoView;
@@ -29,7 +30,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : TODO 演示使用的推送单车机直播场景
* version: 1.0
*/
public class V2XPushLiveCarWindow extends RelativeLayout implements IV2XWindow<V2XPushMessageEntity> {
public class V2XPushLiveCarWindow extends V2XBasWindow implements IV2XWindow<V2XPushMessageEntity> {
private Context mContext;
private V2XLiveGSYVideoView mV2XLiveGSYVideoView;

View File

@@ -144,8 +144,8 @@ public class V2XRoadLiveCarScenario extends AbsV2XScenario<List<V2XEventShowEnti
// 警报状态true-警报中false-警报结束
V2XServiceManager.getMoGoV2XStatusManager().setRoadLiveCarWindowShow(TAG, false);
// 打开直播后,窗口倒计时暂停关闭,直播被关闭后继续倒计时
V2XRoadEventWindow window = (V2XRoadEventWindow) V2XRoadEventScenario.getInstance().getV2XWindow();
window.startCountDown();
// V2XRoadEventWindow window = (V2XRoadEventWindow) V2XRoadEventScenario.getInstance().getV2XWindow();
// window.startCountDown();
// 重置场景提示的消息
setV2XMessageEntity(null);
// 关闭场景提示

View File

@@ -18,19 +18,16 @@ import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.module.v2x.voice.V2XVoicePagingListener;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import java.util.ArrayList;
import java.util.List;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
@@ -38,7 +35,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : 道路预警中的直播场景
* version: 1.0
*/
public class V2XRoadLiveCarWindow extends RelativeLayout
public class V2XRoadLiveCarWindow extends V2XBasWindow
implements IV2XWindow<List<V2XEventShowEntity>> {
private String TAG = "V2XRoadEventDetailWindow";
private TextView mTvEventStubClose;
@@ -105,7 +102,7 @@ public class V2XRoadLiveCarWindow extends RelativeLayout
close();
});
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);

View File

@@ -107,8 +107,8 @@ public class V2XVoiceCallLiveBiz {
return;
}
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(liveCarSn, null);
V2XVoiceCallLiveScenario.getInstance().setV2XWindow(new V2XVoiceCallLiveCarWindow());
V2XVoiceCallLiveScenario.getInstance().init(v2XMessageEntity);
// V2XVoiceCallLiveScenario.getInstance().setV2XWindow(new V2XVoiceCallLiveCarWindow());
// V2XVoiceCallLiveScenario.getInstance().init(v2XMessageEntity);
}
public void getOpenRoadCameraLive() {
@@ -122,8 +122,8 @@ public class V2XVoiceCallLiveBiz {
if (result != null && result.getResult().getUrl() != null) {
String liveUrl = result.getResult().getUrl();
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(null, liveUrl);
V2XVoiceCallLiveScenario.getInstance().setV2XWindow(new V2XVoiceCrossRoadLiveWindow());
V2XVoiceCallLiveScenario.getInstance().init(v2XMessageEntity);
// V2XVoiceCallLiveScenario.getInstance().setV2XWindow(new V2XVoiceCrossRoadLiveWindow());
// V2XVoiceCallLiveScenario.getInstance().init(v2XMessageEntity);
} else {
Logger.d(MODULE_NAME, "getOpenRoadCameraLive 路口实况直播地址为空");
}

View File

@@ -14,13 +14,14 @@ import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.view.V2XCarLiveVideoView;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
public class V2XVoiceCallLiveCarWindow extends RelativeLayout
public class V2XVoiceCallLiveCarWindow extends V2XBasWindow
implements IV2XWindow<V2XPushMessageEntity> {
private V2XCarLiveVideoView mV2XCarLiveVideoView;

View File

@@ -24,23 +24,10 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XVoiceCallLiveScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
private V2XVoiceCallLiveScenario() {
public V2XVoiceCallLiveScenario() {
}
private static volatile V2XVoiceCallLiveScenario mV2XVoiceCallLiveCarScenario;
public static V2XVoiceCallLiveScenario getInstance() {
if (mV2XVoiceCallLiveCarScenario == null) {
synchronized (V2XVoiceCallLiveScenario.class) {
if (mV2XVoiceCallLiveCarScenario == null) {
mV2XVoiceCallLiveCarScenario = new V2XVoiceCallLiveScenario();
}
}
}
return mV2XVoiceCallLiveCarScenario;
}
@Override
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
if (v2XMessageEntity == null) {

View File

@@ -14,13 +14,14 @@ import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.view.V2XCrossRoadVideoView;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
public class V2XVoiceCrossRoadLiveWindow extends RelativeLayout
public class V2XVoiceCrossRoadLiveWindow extends V2XBasWindow
implements IV2XWindow<V2XPushMessageEntity> {
private V2XCrossRoadVideoView mV2XCrossRoadVideoView;

View File

@@ -12,6 +12,7 @@ import com.mogo.module.v2x.alarm.V2XAlarmServer;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.ADASUtils;
import com.mogo.module.v2x.utils.TrackUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import java.util.ArrayList;
import java.util.List;
@@ -27,19 +28,9 @@ import java.util.List;
public class V2XIllegalParkScenario extends AbsV2XScenario<List<MarkerExploreWay>> {
private static final String TAG = "V2XILLegalParkScenario";
private static V2XIllegalParkScenario mV2XIllegalParkScenario;
public static V2XIllegalParkScenario getInstance() {
if (mV2XIllegalParkScenario == null) {
synchronized (V2XIllegalParkScenario.class) {
if (mV2XIllegalParkScenario == null) {
mV2XIllegalParkScenario = new V2XIllegalParkScenario();
mV2XIllegalParkScenario.setV2XWindow(new V2XIllegalParkWindow());
mV2XIllegalParkScenario.setV2XMarker(new V2XIllegalParkMarker());
}
}
}
return mV2XIllegalParkScenario;
public V2XIllegalParkScenario() {
setV2XWindow(new V2XIllegalParkWindow());
setV2XMarker(new V2XIllegalParkMarker());
}
@Override
@@ -113,4 +104,16 @@ public class V2XIllegalParkScenario extends AbsV2XScenario<List<MarkerExploreWay
public void clearPOI() {
}
/**
* 存储本地数据
*
* @param messageEntity 要存储的场景
*/
private void saveLocalStory(int scenarioType, MarkerExploreWay messageEntity) {
try {
V2XSQLiteUtils.saveLocalStory(scenarioType, messageEntity, messageEntity.hashCode());
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -6,7 +6,6 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -17,13 +16,12 @@ import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.List;
@@ -32,7 +30,7 @@ import java.util.List;
* 违章停车
* 弹窗视图
*/
public class V2XIllegalParkWindow extends RelativeLayout implements IV2XWindow<MarkerExploreWay> {
public class V2XIllegalParkWindow extends V2XBasWindow implements IV2XWindow<MarkerExploreWay> {
private static final String TAG = "V2XIllegalParkWindow";
// 展示列表
private RecyclerView mRecyclerView;
@@ -73,7 +71,7 @@ public class V2XIllegalParkWindow extends RelativeLayout implements IV2XWindow<M
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
// 详情列表
mRecyclerView = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);

View File

@@ -27,25 +27,12 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XPushEventScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
private static V2XPushEventScenario mV2XPushEventScenario;
private V2XPushEventScenario() {
public V2XPushEventScenario() {
setV2XMarker(new V2XPushEventMarker());
setV2XWindow(new V2XPushEventWindow());
}
public static V2XPushEventScenario getInstance() {
if (mV2XPushEventScenario == null) {
synchronized (V2XPushEventScenario.class) {
if (mV2XPushEventScenario == null) {
mV2XPushEventScenario = new V2XPushEventScenario();
mV2XPushEventScenario.setV2XMarker(new V2XPushEventMarker());
mV2XPushEventScenario.setV2XWindow(new V2XPushEventWindow());
}
}
}
return mV2XPushEventScenario;
}
@Override
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
Logger.w(MODULE_NAME, "处理推送场景:" + GsonUtil.jsonFromObject(v2XMessageEntity));

View File

@@ -6,7 +6,6 @@ import android.os.Handler;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -20,6 +19,7 @@ import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
@@ -39,7 +39,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* TODO 目前睡前瞻推送使用的消息都在这里展示
* version: 1.0
*/
public class V2XPushEventWindow extends RelativeLayout implements IV2XWindow<V2XPushMessageEntity> {
public class V2XPushEventWindow extends V2XBasWindow implements IV2XWindow<V2XPushMessageEntity> {
private String TAG = "V2XPushEventDetailWindow";
// 展示列表
private RecyclerView mRecyclerView;
@@ -82,7 +82,7 @@ public class V2XPushEventWindow extends RelativeLayout implements IV2XWindow<V2X
LayoutInflater.from(context).inflate(R.layout.window_push_event_detail, this);
// 详情列表
mRecyclerView = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);

View File

@@ -25,25 +25,11 @@ public class V2XPushVREventScenario
implements IMogoTopViewStatusListener {
private String TAG = "V2XPushVREventWindow";
private static V2XPushVREventScenario mV2XPushEventScenario;
private V2XPushVREventScenario() {
public V2XPushVREventScenario() {
setV2XMarker(new V2XPushVREventMarker());
setV2XWindow(new V2XPushVREventWindow());
}
public static V2XPushVREventScenario getInstance() {
if (mV2XPushEventScenario == null) {
synchronized (V2XPushVREventScenario.class) {
if (mV2XPushEventScenario == null) {
mV2XPushEventScenario = new V2XPushVREventScenario();
mV2XPushEventScenario.setV2XMarker(new V2XPushVREventMarker());
mV2XPushEventScenario.setV2XWindow(new V2XPushVREventWindow());
}
}
}
return mV2XPushEventScenario;
}
@Override
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "处理推送VR场景" + GsonUtil.jsonFromObject(v2XMessageEntity));

View File

@@ -29,23 +29,11 @@ import java.util.Map;
*/
public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> implements IMogoTopViewStatusListener {
private static final String TAG = "V2XRoadEventScenario";
private static V2XRoadEventScenario mV2XRoadEventScenario;
private V2XRoadEventScenario() {
}
public static V2XRoadEventScenario getInstance() {
if (mV2XRoadEventScenario == null) {
synchronized (V2XRoadEventScenario.class) {
if (mV2XRoadEventScenario == null) {
mV2XRoadEventScenario = new V2XRoadEventScenario();
mV2XRoadEventScenario.setV2XButton(new V2XRoadEventButton());
mV2XRoadEventScenario.setV2XMarker(new V2XRoadEventMarker());
mV2XRoadEventScenario.setV2XWindow(new V2XRoadEventWindow());
}
}
}
return mV2XRoadEventScenario;
public V2XRoadEventScenario() {
setV2XButton(new V2XRoadEventButton());
setV2XMarker(new V2XRoadEventMarker());
setV2XWindow(new V2XRoadEventWindow());
}
@Override
@@ -201,7 +189,8 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
@Override
public void onViewRemoved(View view) {
//Logger.d(MODULE_NAME, "关闭 Window 动画结束");
Logger.d(V2XConst.MODULE_NAME, "关闭 Window 动画结束");
release();
}
@Override

View File

@@ -6,35 +6,33 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.v2x.entity.net.V2XLiveCarRes;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.network.V2XRefreshCallback;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.module.v2x.voice.V2XVoicePagingListener;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.List;
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_BLOCK_UP;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* author : donghongyu
@@ -43,7 +41,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : 显示事件的列表
* version: 1.0
*/
public class V2XRoadEventWindow extends RelativeLayout
public class V2XRoadEventWindow extends V2XBasWindow
implements V2XRefreshCallback<V2XLiveCarRes>, IV2XWindow<V2XRoadEventEntity> {
private String TAG = "V2XRoadEventDetailWindow";
// 关闭按钮
@@ -53,11 +51,11 @@ public class V2XRoadEventWindow extends RelativeLayout
// 列表数据适配器
private V2XRoadEventAdapter mV2XRoadEventAdapter;
// 列表展示
private List<V2XEventShowEntity> mItemList = new ArrayList<>();
private final List<V2XEventShowEntity> mItemList = new ArrayList<>();
// 当前展示的位置
private int mCurPosition;
// 处理道路事件30秒倒计时
private Handler handlerV2XEvent = new Handler();
private final Handler handlerV2XEvent = new Handler();
private Runnable runnableV2XEvent;
private int mExpireTime = 20000;
// 关闭弹窗回调
@@ -103,7 +101,8 @@ public class V2XRoadEventWindow extends RelativeLayout
private void initView(Context context) {
//Logger.d(MODULE_NAME, "V2X===初始化道路事件小窗口View。。。。。");
// 填充布局
LayoutInflater.from(context).inflate(R.layout.window_road_event_detail, this);
LayoutInflater.from(context).inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
R.layout.window_road_event_detail_vr : R.layout.window_road_event_detail, this);
// 详情列表
mBtnCloseWindow = findViewById(R.id.btnCloseWindow);
// 详情列表
@@ -116,7 +115,7 @@ public class V2XRoadEventWindow extends RelativeLayout
}
});
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
@@ -205,8 +204,6 @@ public class V2XRoadEventWindow extends RelativeLayout
@Override
public void onSuccess(V2XLiveCarRes result) {
// TODO 这里是测试数据
//result = TestOnLineCarUtils.queryNearbyVehicleLiveByLocation();
//Logger.d(MODULE_NAME, "V2X===事件周边的直播车机:" + result);
try {
if (!mItemList.isEmpty() &&
@@ -299,4 +296,9 @@ public class V2XRoadEventWindow extends RelativeLayout
runnableV2XEvent = null;
}
}
@Override
protected void release() {
super.release();
}
}

View File

@@ -16,6 +16,7 @@ import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.view.SimpleCoverVideoPlayer;
import com.mogo.utils.BitmapHelper;
@@ -31,7 +32,7 @@ import static com.shuyu.gsyvideoplayer.utils.GSYVideoType.SCREEN_MATCH_FULL;
/**
* https://github.com/CarGuo/GSYVideoPlayer/tree/master/doc SimpleCoverVideoPlayer文档
*/
public class V2XRoadVideoWindow extends RelativeLayout implements
public class V2XRoadVideoWindow extends V2XBasWindow implements
IV2XWindow, IDestroyable {
private static final String TAG = "V2XRoadVideoWindow";
@@ -68,7 +69,7 @@ public class V2XRoadVideoWindow extends RelativeLayout implements
}
private void initView(Context context) {
LayoutInflater.from(mContext).inflate(R.layout.window_road_video_layout, this);
LayoutInflater.from(mContext).inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.layout.window_road_video_layout_vr : R.layout.window_road_video_layout, this);
playImageView = this.findViewById(R.id.window_video_play);
thumbnailImage = this.findViewById(R.id.thumbnail_image);
simpleCoverVideoPlayer = this.findViewById(R.id.roadVideoView);

View File

@@ -14,6 +14,7 @@ import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.ADASUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.entrance.IMogoEntranceButtonController;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
@@ -32,22 +33,10 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> implements IMogoTopViewStatusListener {
private volatile static V2XSeekHelpScenario mV2XSeekHelpScenario;
private V2XSeekHelpScenario() {
}
public static V2XSeekHelpScenario getInstance() {
if (mV2XSeekHelpScenario == null) {
synchronized (V2XSeekHelpScenario.class) {
if (mV2XSeekHelpScenario == null) {
mV2XSeekHelpScenario = new V2XSeekHelpScenario();
mV2XSeekHelpScenario.setV2XWindow(new V2XSeekHelpWindow());
mV2XSeekHelpScenario.setV2XMarker(new V2XSeekHelpMarker());
}
}
}
return mV2XSeekHelpScenario;
public V2XSeekHelpScenario() {
setV2XWindow(new V2XSeekHelpWindow());
setV2XMarker(new V2XSeekHelpMarker());
}
private List<V2XMarkerEntity> mMarkerEntity;
@@ -176,4 +165,17 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
setV2XMessageEntity(null);
clearPOI();
}
/**
* 存储本地数据
*
* @param messageEntity 要存储的场景
*/
private void saveLocalStory(int scenarioType, V2XPushMessageEntity messageEntity) {
try {
V2XSQLiteUtils.saveLocalStory(scenarioType, messageEntity, messageEntity.hashCode());
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -19,6 +19,7 @@ import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.utils.logger.Logger;
@@ -34,7 +35,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : 他人发起的故障求助
* version: 1.0
*/
public class V2XSeekHelpWindow extends ConstraintLayout implements IV2XWindow<V2XPushMessageEntity> {
public class V2XSeekHelpWindow extends V2XBasWindow implements IV2XWindow<V2XPushMessageEntity> {
private static final String TAG = "V2XSeekHelpWindow";
// 展示列表
@@ -73,7 +74,7 @@ public class V2XSeekHelpWindow extends ConstraintLayout implements IV2XWindow<V2
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
// 详情列表
mRecyclerView = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
@@ -114,6 +115,11 @@ public class V2XSeekHelpWindow extends ConstraintLayout implements IV2XWindow<V2
@Override
public void close() {
//Logger.d(TAG, "移除window= " + this);
// 停止倒计时
if (handlerV2XEvent != null && runnableV2XEvent != null) {
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
runnableV2XEvent = null;
}
//移除窗体
V2XServiceManager
.getMogoTopViewManager()

View File

@@ -190,6 +190,12 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
// 存储本地,出行动态作展示
saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING,
v2XMessageEntity.getContent().getNoveltyInfo());
});
mBtnTriggerPushEvent.setOnClickListener(v -> {
@@ -334,4 +340,16 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
});
}
/**
* 存储本地数据
*
* @param v2XRoadEventEntity 要存储的场景
*/
public void saveLocalStory(int scenarioType, MarkerExploreWay v2XRoadEventEntity) {
try {
V2XSQLiteUtils.saveLocalStory(scenarioType, v2XRoadEventEntity, v2XRoadEventEntity.hashCode());
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -15,8 +15,6 @@ import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
@@ -28,21 +26,8 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XEventUgcScenario extends AbsV2XScenario<V2XRoadEventEntity> implements IMogoTopViewStatusListener {
private static V2XEventUgcScenario mV2XTiredScenario;
private V2XEventUgcScenario() {
}
public static V2XEventUgcScenario getInstance() {
if (mV2XTiredScenario == null) {
synchronized (V2XEventUgcScenario.class) {
if (mV2XTiredScenario == null) {
mV2XTiredScenario = new V2XEventUgcScenario();
mV2XTiredScenario.setV2XWindow(new V2XEventUgcWindow());
}
}
}
return mV2XTiredScenario;
public V2XEventUgcScenario() {
setV2XWindow(new V2XEventUgcWindow());
}
@Override

View File

@@ -19,6 +19,7 @@ import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.utils.logger.Logger;
@@ -36,7 +37,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443
* version: 1.0
*/
public class V2XEventUgcWindow extends RelativeLayout
public class V2XEventUgcWindow extends V2XBasWindow
implements IV2XWindow<V2XRoadEventEntity> {
// 展示列表
private RecyclerView mRecyclerView;
@@ -74,7 +75,7 @@ public class V2XEventUgcWindow extends RelativeLayout
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
// 详情列表
mRecyclerView = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);

View File

@@ -4,9 +4,11 @@ import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.marker.PoiWrapper;
import com.mogo.module.common.utils.CloudPoiManager;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.utils.logger.Logger;
/**
* @ProjectName: MoGoModulSafeDriving
* @Package: com.mogo.module.v2x.utils
@@ -92,6 +94,37 @@ public class EventTypeUtils {
* @return 背景
*/
public static int getPoiTypeBg(String poiType) {
int strBg;
switch (poiType) {
case V2XPoiTypeEnum.FOURS_PARKING: // 停车场
case V2XPoiTypeEnum.GAS_STATION: // 加油站
strBg = R.drawable.bg_v2x_event_type_blue;
break;
case V2XPoiTypeEnum.FOURS_BLOCK_UP: // 拥堵
case V2XPoiTypeEnum.FOURS_LIVING: // 实时路况
case V2XPoiTypeEnum.FOURS_NEALY: // 身边
strBg = V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.drawable.bg_v2x_event_type_orange_vr : R.drawable.bg_v2x_event_type_orange;
break;
case V2XPoiTypeEnum.TRAFFIC_CHECK:// 交通检查
case V2XPoiTypeEnum.ROAD_CLOSED:// 封路
case V2XPoiTypeEnum.FOURS_ROAD_WORK:// 施工
case V2XPoiTypeEnum.FOURS_PONDING:// 积水
case V2XPoiTypeEnum.FOURS_FOG: // 浓雾
case V2XPoiTypeEnum.FOURS_ICE: // 结冰
case V2XPoiTypeEnum.FOURS_ACCIDENT: // 事故
strBg = V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.drawable.bg_v2x_event_type_red_vr : R.drawable.bg_v2x_event_type_read;
break;
default:
strBg = V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.drawable.bg_v2x_event_type_red_vr : R.drawable.bg_v2x_event_type_read;
break;
}
return strBg;
}
/*
* VR模式下道路类型影响到分享列表 (VR模式暂时没有事件面板,所以可以删除此方法,公用上边的getPoiTypeBg)
* */
public static int getPoiTypeBgForShareItem(String poiType) {
int strBg;
switch (poiType) {
case V2XPoiTypeEnum.FOURS_PARKING: // 停车场
@@ -119,7 +152,6 @@ public class EventTypeUtils {
return strBg;
}
/**
* 判断是否是道路预警事件
*

View File

@@ -135,6 +135,7 @@ public class V2XSQLiteUtils {
newScenarioData.setDispose(true);
newScenarioData.setTriggerTime(TimeUtils.getNowMills());
newScenarioData.setEventJsonData(oldScenarioData.getEventJsonData());
newScenarioData.setEventJsonDataHashCode(oldScenarioData.getEventJsonDataHashCode());
newScenarioData.setScenarioType(oldScenarioData.getScenarioType());
int result = getScenarioHistoryDao().update(oldScenarioData, newScenarioData);
@@ -150,15 +151,19 @@ public class V2XSQLiteUtils {
*
* @param markerExploreWay 要存储的场景
*/
public static void saveLocalStory(int scenarioType, Object markerExploreWay) {
public static void saveLocalStory(int scenarioType, Object markerExploreWay, int hashCode) {
try {
Logger.d(V2XConst.MODULE_NAME, "saveLocalStory" + markerExploreWay);
// 进行数据库存储
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
v2XHistoryScenarioData.setScenarioType(scenarioType);
v2XHistoryScenarioData.setEventJsonData(GsonUtil.jsonFromObject(markerExploreWay));
v2XHistoryScenarioData.setEventJsonDataHashCode(hashCode);
List<V2XHistoryScenarioData> historyScenarioData = getTargetScenarioHistoryData(v2XHistoryScenarioData);
v2XHistoryScenarioData.setEventJsonData(GsonUtil.jsonFromObject(markerExploreWay));
v2XHistoryScenarioData.setTriggerTime(TimeUtils.getNowMills());
v2XHistoryScenarioData.setDispose(false);

View File

@@ -13,6 +13,8 @@ import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
/**
* 红心点赞按钮控件
@@ -44,7 +46,7 @@ public class HeartLikeView extends LinearLayout implements Animator.AnimatorList
inflate(context, R.layout.view_heart_like_gray_back, this);
mIllegalParkingLike = findViewById(R.id.ivLikeForGrayBack);
} else {
inflate(context, R.layout.view_heart_like, this);
inflate(context, V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.layout.view_heart_like_vr : R.layout.view_heart_like, this);
mIllegalParkingLike = findViewById(R.id.ivIllegalParkingLike);
}
@@ -73,6 +75,9 @@ public class HeartLikeView extends LinearLayout implements Animator.AnimatorList
if (mOnClickCallListener != null) {
mOnClickCallListener.onClicked(HeartLikeView.this);
}
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
mIllegalParkingLike.setImageResource(R.drawable.module_common_icon_like_selected_vr);
}
}
@Override

View File

@@ -12,6 +12,8 @@ import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
/**
* 不喜欢按钮控件
@@ -35,7 +37,7 @@ public class HeartUnLikeView extends LinearLayout implements Animator.AnimatorLi
public HeartUnLikeView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
inflate(context, R.layout.view_heart_unlike, this);
inflate(context, V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.layout.view_heart_unlike_vr : R.layout.view_heart_unlike, this);
mIllegalParkingUnLike = findViewById(R.id.ivIllegalParkingUnLike);
setOnClickListener(v -> {
@@ -43,8 +45,7 @@ public class HeartUnLikeView extends LinearLayout implements Animator.AnimatorLi
isAnimator = true;
if (mAnimatorSet == null) {
mAnimatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(getContext(),
R.anim.v2x_unlike_heart_animation);
mAnimatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(getContext(), R.anim.v2x_unlike_heart_animation);
mAnimatorSet.setTarget(mIllegalParkingUnLike);
mAnimatorSet.addListener(this);
}
@@ -64,6 +65,9 @@ public class HeartUnLikeView extends LinearLayout implements Animator.AnimatorLi
if (mOnClickCallListener != null) {
mOnClickCallListener.onClicked(HeartUnLikeView.this);
}
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
mIllegalParkingUnLike.setImageResource(R.drawable.module_common_icon_unlike_selected_vr);
}
}
@Override

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Some files were not shown because too many files have changed in this diff Show More