增加了可以通过广播开启的V2X测试面板
This commit is contained in:
@@ -6,6 +6,13 @@
|
||||
<intent-filter>
|
||||
<action android:name="com.v2x.scene_handler_broadcast" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name=".receiver.TestPanelBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.v2x.test_panel_control" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
@@ -32,6 +32,13 @@ public class V2XConst {
|
||||
public static final String BROADCAST_SCENE_HANDLER_ACTION = "com.v2x.scene_handler_broadcast";
|
||||
public static final String BROADCAST_SCENE_EXTRA_KEY = "V2XMessageEntity";
|
||||
|
||||
/**
|
||||
* V2X 测试控制面板广播Action
|
||||
*/
|
||||
public static final String BROADCAST_TEST_PANEL_CONTROL_ACTION = "com.v2x.com.v2x.test_panel_control";
|
||||
public static final String BROADCAST_TEST_PANEL_CONTROL_EXTRA_KEY = "TextPanelOpenStatus";
|
||||
|
||||
|
||||
public static final String BROADCAST_SCENE_ACTION = "com.v2x.scene_local_broadcast";
|
||||
public static final String SEEK_HELP_TIME = "seek_help_time";
|
||||
public static final String V2X_ACC_ON_TIME_STR = "v2x_acc_on_time_str";
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.mogo.module.v2x.receiver.SceneBroadcastReceiver;
|
||||
import com.mogo.module.v2x.scenario.impl.V2XScenarioManager;
|
||||
import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkWindow;
|
||||
import com.mogo.module.v2x.scenario.scene.test.V2XTestConsoleWindow;
|
||||
import com.mogo.module.v2x.utils.FatigueDrivingUtils;
|
||||
import com.mogo.module.v2x.utils.TimeUtils;
|
||||
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
|
||||
@@ -136,12 +135,6 @@ public class V2XModuleProvider implements
|
||||
intentFilter.addAction(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
localBroadcastManager.registerReceiver(localReceiver, intentFilter);
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
// TODO 这是测试页面
|
||||
V2XServiceManager
|
||||
.getIMogoWindowManager()
|
||||
.addView(new V2XTestConsoleWindow(context), 0, 0, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
|
||||
@@ -22,7 +22,7 @@ public class SceneBroadcastReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
V2XMessageEntity v2XMessageEntity = (V2XMessageEntity) intent.getSerializableExtra("V2XMessageEntity");
|
||||
V2XMessageEntity v2XMessageEntity = (V2XMessageEntity) intent.getSerializableExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY);
|
||||
Logger.d(TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
|
||||
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.mogo.module.v2x.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.scenario.scene.test.V2XTestConsoleWindow;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* V2X 测试面板广播接收,目的是可以通过广播调用起来面板
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class TestPanelBroadcastReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = V2XConst.MODULE_NAME + "_TestPanelBroadcastReceiver";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
boolean textPanelOpenStatus = intent.getBooleanExtra(V2XConst.BROADCAST_TEST_PANEL_CONTROL_EXTRA_KEY, false);
|
||||
Logger.d(TAG, "textPanelOpenStatus:" + textPanelOpenStatus);
|
||||
if (textPanelOpenStatus) {
|
||||
V2XServiceManager
|
||||
.getIMogoWindowManager()
|
||||
.addView(V2XTestConsoleWindow.getInstance(context), 0, 0, false);
|
||||
} else {
|
||||
V2XServiceManager
|
||||
.getIMogoWindowManager()
|
||||
.removeView(V2XTestConsoleWindow.getInstance(context));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,8 @@ import java.util.List;
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
private static V2XTestConsoleWindow mV2XTestConsoleWindow;
|
||||
|
||||
private FlexboxLayout mFlTestPanel;
|
||||
private Button mBtnTriggerOpen;
|
||||
private Button mBtnTriggerRoadEvent;
|
||||
@@ -43,6 +45,17 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
private Button mBtnTriggerSeekHelpEvent;
|
||||
private Button mBtnTriggerParkEvent;
|
||||
|
||||
public static V2XTestConsoleWindow getInstance(Context context) {
|
||||
if (mV2XTestConsoleWindow == null) {
|
||||
synchronized (V2XTestConsoleWindow.class) {
|
||||
if (mV2XTestConsoleWindow == null) {
|
||||
mV2XTestConsoleWindow = new V2XTestConsoleWindow(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mV2XTestConsoleWindow;
|
||||
}
|
||||
|
||||
public V2XTestConsoleWindow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user