[add] 前车碰撞预警 UI + 测试数据
This commit is contained in:
@@ -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 -> {
|
||||
|
||||
@@ -156,6 +156,35 @@ public class TestOnLineCarUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static V2XMessageEntity<V2XPushMessageEntity> 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<V2XPushMessageEntity> 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推送直播数据
|
||||
|
||||
Reference in New Issue
Block a user