diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 4ff10f68a5..83405b8de1 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -91,7 +91,6 @@
-
diff --git a/main-extensions/mogo-module-main-launcher/src/main/java/com/zhidao/mogo/module/main/launcher/MainLauncherActivity.java b/main-extensions/mogo-module-main-launcher/src/main/java/com/zhidao/mogo/module/main/launcher/MainLauncherActivity.java
index 9cccae807c..292ddc7922 100644
--- a/main-extensions/mogo-module-main-launcher/src/main/java/com/zhidao/mogo/module/main/launcher/MainLauncherActivity.java
+++ b/main-extensions/mogo-module-main-launcher/src/main/java/com/zhidao/mogo/module/main/launcher/MainLauncherActivity.java
@@ -19,6 +19,7 @@ import com.mogo.och.IMogoOCH;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
+import com.mogo.service.v2x.IWarningChangeListener;
import com.mogo.utils.logger.Logger;
/**
@@ -26,13 +27,14 @@ import com.mogo.utils.logger.Logger;
*
* @author tongchenfei
*/
-public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IMogoStatusChangedListener {
+public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IMogoStatusChangedListener, IWarningChangeListener {
private static final String TAG = "MainLauncherActivity";
protected boolean mIsHomeKeyDown = false;
+
@Override
- protected void onCreate( @Nullable Bundle savedInstanceState ) {
- super.onCreate( savedInstanceState );
- DebugConfig.setNeedRequestUserInfo( true );
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ DebugConfig.setNeedRequestUserInfo(true);
mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG,
StatusDescriptor.VR_MODE, this);
}
@@ -43,10 +45,10 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
// 显示左边遮罩
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
mLeftShadowFrame.setVisibility(View.GONE);
- }else {
+ } else {
mLeftShadowFrame.setVisibility(View.VISIBLE);
}
- MogoModulesManager.getInstance().loadAppsListModule( com.mogo.module.main.R.id.module_main_id_apps_fragment_container );
+ MogoModulesManager.getInstance().loadAppsListModule(com.mogo.module.main.R.id.module_main_id_apps_fragment_container);
}
@Override
@@ -57,21 +59,21 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
protected void hideLayout() {
super.hideLayout();
- mApps.setVisibility( View.GONE );
- mLeftShadowFrame.setVisibility( View.GONE );
+ mApps.setVisibility(View.GONE);
+ mLeftShadowFrame.setVisibility(View.GONE);
}
@Override
protected void showLayout() {
super.showLayout();
- mApps.setVisibility( View.VISIBLE );
- mLeftShadowFrame.setVisibility( View.VISIBLE );
+ mApps.setVisibility(View.VISIBLE);
+ mLeftShadowFrame.setVisibility(View.VISIBLE);
}
@Override
protected void onStart() {
super.onStart();
- getApis().getIntentManagerApi().registerIntentListener( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this );
+ getApis().getIntentManagerApi().registerIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
}
@Override
@@ -83,13 +85,13 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
protected void onStop() {
super.onStop();
- getApis().getIntentManagerApi().unregisterIntentListener( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this );
+ getApis().getIntentManagerApi().unregisterIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
}
@Override
- public void onIntentReceived( String intentStr, Intent intent ) {
- if ( TextUtils.equals( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, intentStr ) ) {
- mIsHomeKeyDown = intent.getBooleanExtra( "isHomeKeyDown", true );
+ public void onIntentReceived(String intentStr, Intent intent) {
+ if (TextUtils.equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, intentStr)) {
+ mIsHomeKeyDown = intent.getBooleanExtra("isHomeKeyDown", true);
}
}
@@ -107,10 +109,10 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
/**
* 加载网约车模块
*/
- private void loadOCHModule(){
- IMogoOCH och = ARouter.getInstance().navigation( IMogoOCH.class );
- if ( och != null ) {
- och.init( this, R.id.module_main_id_och_fragment );
+ private void loadOCHModule() {
+ IMogoOCH och = ARouter.getInstance().navigation(IMogoOCH.class);
+ if (och != null) {
+ och.init(this, R.id.module_main_id_och_fragment);
}
}
@@ -121,38 +123,53 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
StatusDescriptor.VR_MODE, this);
try {
// acc off 之后会出现进程还在,但是页面被杀的情况,这个直接杀掉进程,然后让整个进程重启
- Process.killProcess( Process.myPid() );
- } catch ( Exception e ) {
+ Process.killProcess(Process.myPid());
+ } catch (Exception e) {
e.printStackTrace();
}
}
@Override
- public void onMapUiModeChanged( EnumMapUI mapUI ) {
- super.onMapUiModeChanged( mapUI );
- Intent intent = new Intent( "com.mogo.style.SKIN_CHANGED" );
- intent.putExtra( "type", -1 );
- if ( mapUI == EnumMapUI.Type_Light ) {
- intent.putExtra( "type", 1 );
- } else if( mapUI == EnumMapUI.Type_Night ){
- intent.putExtra( "type", 0 );
+ public void onMapUiModeChanged(EnumMapUI mapUI) {
+ super.onMapUiModeChanged(mapUI);
+ Intent intent = new Intent("com.mogo.style.SKIN_CHANGED");
+ intent.putExtra("type", -1);
+ if (mapUI == EnumMapUI.Type_Light) {
+ intent.putExtra("type", 1);
+ } else if (mapUI == EnumMapUI.Type_Night) {
+ intent.putExtra("type", 0);
}
- sendBroadcast( intent );
- Logger.d( TAG, "send msg to AI Voice" );
+ sendBroadcast(intent);
+ Logger.d(TAG, "send msg to AI Voice");
}
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
- FrameLayout.LayoutParams entranceParams = ( ( FrameLayout.LayoutParams ) mEntrance.getLayoutParams() );
+ FrameLayout.LayoutParams entranceParams = ((FrameLayout.LayoutParams) mEntrance.getLayoutParams());
if (isTrue) {
- entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft_in_vr_mode );
+ entranceParams.leftMargin = getResources().getDimensionPixelSize(R.dimen.module_main_entrance_fragment_container_marginLeft_in_vr_mode);
mLeftShadowFrame.setVisibility(View.GONE);
mApps.setVisibility(View.GONE);
- }else{
- entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_id_entrance_fragment_container_marginLeft );
+ } else {
+ entranceParams.leftMargin = getResources().getDimensionPixelSize(R.dimen.module_main_id_entrance_fragment_container_marginLeft);
mLeftShadowFrame.setVisibility(View.VISIBLE);
mApps.setVisibility(View.VISIBLE);
}
- mEntrance.setLayoutParams( entranceParams );
+ mEntrance.setLayoutParams(entranceParams);
}
+
+ @Override
+ public void warningChangedWithType(String type) {
+ switch (type) {
+ case "top":
+ mWarningTop.setVisibility(View.VISIBLE);
+ case "left":
+ mWarningLeft.setVisibility(View.VISIBLE);
+ case "right":
+ mWarningRight.setVisibility(View.VISIBLE);
+ case "bottom":
+ mWarningBottom.setVisibility(View.VISIBLE);
+ }
+ }
+
}
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XMessageEntity.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XMessageEntity.java
index fce034aab3..1fe1fe1fc9 100644
--- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XMessageEntity.java
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XMessageEntity.java
@@ -145,6 +145,8 @@ public class V2XMessageEntity implements Serializable {
int ALERT_RECOMMEND_ROUTE = 1_011;
// 基于预判目的地违章高发停车场推荐
int ALERT_RECOMMEND_PARKING = 1_012;
+ // 前车碰撞预警
+ int ALERT_THE_FRONT_CRASH_WARNING = 1_0013;
// 推送VR消息展示
int ALERT_PUSH_VR_SHOW = 2_000;
// 自车求助
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java
index 1fc72806d6..51242be2f1 100644
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java
+++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java
@@ -5,6 +5,7 @@ import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;
+import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -64,6 +65,11 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
protected FrameLayout mLeftPanelLayout;
protected View mLeftShadowFrame;
+ protected ImageView mWarningTop;
+ protected ImageView mWarningLeft;
+ protected ImageView mWarningRight;
+ protected ImageView mWarningBottom;
+
@Override
protected int getLayoutId() {
if ( !DebugConfig.isMapBased() ) {
@@ -103,6 +109,11 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mLeftPanelLayout = findViewById( R.id.module_main_id_left_panel_fragment_container );
mHistoryMessagePanel = findViewById( R.id.module_main_id_message_history_fragment_container );
+ mWarningTop = findViewById(R.id.warning_top);
+ mWarningLeft = findViewById(R.id.warning_left);
+ mWarningRight = findViewById(R.id.warning_right);
+ mWarningBottom = findViewById(R.id.warning_bottom);
+
// 避免事件穿透导致地图被滑动
mLeftShadowFrame.setOnClickListener( view -> {
} );
diff --git a/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_bottom.xml b/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_bottom.xml
new file mode 100644
index 0000000000..72aa9cfff4
--- /dev/null
+++ b/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_bottom.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_left.xml b/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_left.xml
new file mode 100644
index 0000000000..bc04920106
--- /dev/null
+++ b/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_left.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_right.xml b/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_right.xml
new file mode 100644
index 0000000000..7300bc5cf7
--- /dev/null
+++ b/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_right.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_top.xml b/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_top.xml
new file mode 100644
index 0000000000..a6317a7428
--- /dev/null
+++ b/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_top.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml b/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml
index 6712a3a36d..b785d02a94 100644
--- a/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml
+++ b/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml
@@ -2,8 +2,8 @@
@@ -12,6 +12,36 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
+
+
+
+
+
+
+
+
18px
18px
18px
+
+ 1530px
\ No newline at end of file
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java
index ddac88ec6b..04d37ba382 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java
@@ -51,6 +51,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
private Button mBtnTriggerRoadEvent;
private Button mBtnClearRoadEvent;
private Button mBtnTriggerPushEvent;
+ private Button mBtnTriggerWarningEvent;
private Button mBtnTriggerPushLiveCarEvent;
private Button mBtnTriggerAnimationEvent;
private Button mBtnbtnFrontCarLiveEvent;
@@ -112,6 +113,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
mBtnTriggerOpen = findViewById(R.id.btnTriggerOpen);
mBtnClearRoadEvent = findViewById(R.id.btnClearRoadEvent);
mBtnTriggerRoadEvent = findViewById(R.id.btnTriggerRoadEvent);
+ mBtnTriggerWarningEvent = findViewById(R.id.btnTriggerWarningEvent);
mBtnTriggerPushEvent = findViewById(R.id.btnTriggerPushEvent);
mBtnTriggerPushLiveCarEvent = findViewById(R.id.btnTriggerPushLiveCarEvent);
mBtnTriggerAnimationEvent = findViewById(R.id.btnTriggerAnimationEvent);
@@ -211,6 +213,9 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING,
v2XMessageEntity.getContent().getNoveltyInfo());
+ });
+ mBtnTriggerWarningEvent.setOnClickListener(v->{
+
});
mBtnTriggerPushEvent.setOnClickListener(v -> {
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java
index 7757a27b51..8246b1985e 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java
@@ -156,6 +156,35 @@ public class TestOnLineCarUtils {
return null;
}
+ public static V2XMessageEntity getV2XScenarioPushWarningEventData() {
+ try {
+ InputStream inputStream = V2XUtils.getApp()
+ .getResources()
+ .openRawResource(R.raw.scenario_warning_event_data);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ int len = -1;
+ byte[] buffer = new byte[1024];
+ while ((len = inputStream.read(buffer)) != -1) {
+ baos.write(buffer, 0, len);
+ }
+ inputStream.close();
+
+ // 加载数据源
+ V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class);
+
+ V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>();
+ // 控制类型
+ v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING);
+ // 设置数据
+ v2xMessageEntity.setContent(v2xRoadEventEntity);
+ // 控制展示状态
+ v2xMessageEntity.setShowState(true);
+ return v2xMessageEntity;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
/**
* 模拟H5推送直播数据
diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml b/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml
index b9253925c9..0d8ba1418f 100644
--- a/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml
+++ b/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml
@@ -239,6 +239,20 @@
android:textSize="@dimen/dp_22"
android:textStyle="bold" />
+
+