diff --git a/.idea/misc.xml b/.idea/misc.xml
index 2db9aab721..47f1a4e1d4 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -4,7 +4,7 @@
-
+
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java
index 25062a36c4..1d9dc7439e 100644
--- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java
@@ -202,6 +202,7 @@ public class EntranceFragment extends MvpFragment {
+ handler.removeMessages(MSG_HIDE_LIMIT_SPEED);
+
+ if (tvLimitSpeed.getVisibility() == View.GONE) {
+ tvLimitSpeed.setVisibility(View.VISIBLE);
+ }
+ tvLimitSpeed.setText(msg.value);
+ limitSpeed = Integer.parseInt(msg.value);
+
+ handler.sendEmptyMessageDelayed(MSG_HIDE_LIMIT_SPEED, HIDE_LIMIT_SPEED_DELAY);
+ });
+ }
+ }
+ }
+
+ @Override
+ public void onLocationChanged(MogoLocation location) {
+ if (!isVrMode) {
+ return;
+ }
+ int speed = (int) (location.getSpeed() * 3.6F);
+ if (tvSelfSpeed != null) {
+ tvSelfSpeed.post(() -> {
+ if (tvSelfSpeed.getVisibility() == View.GONE) {
+ tvSelfSpeed.setVisibility(View.VISIBLE);
+ }
+ tvSelfSpeed.setText("" + speed);
+ });
+ }
+ }
+
+ @Override
+ public boolean handleMessage(Message msg) {
+ switch (msg.what) {
+ case MSG_HIDE_LIMIT_SPEED:
+ tvLimitSpeed.setVisibility(View.GONE);
+ return true;
+ case MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD:
+ if (!handler.hasMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU)) {
+ tvTrafficLight.setVisibility(View.GONE);
+ }
+ return true;
+ case MSG_HIDE_TRAFFIC_LIGHT_BY_OBU:
+ if (!handler.hasMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD)) {
+ tvTrafficLight.setVisibility(View.GONE);
+ }
+ return true;
+ default:
+ return false;
+ }
}
/**
@@ -53,9 +154,12 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback {
*
* @author tongchenfei
*/
- private class AdasNoticeReceiver extends BroadcastReceiver{
+ private class AdasNoticeReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
+ if (!isVrMode) {
+ return;
+ }
// todo 处理发给adas的事件, 主要处理逆向超车和obu行人碰撞
String id = intent.getStringExtra("v2x_warning_type");
if (id != null) {
@@ -63,15 +167,67 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback {
MogoApisHandler.getInstance().getApis().getEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_PEOPLE_WARN, R.drawable.module_ext_people_warn, "前方注意行人");
}
}
+
+ int type = intent.getIntExtra("type", -1);
+ if (type == 2) {
+ // 红绿灯处理
+ String data = intent.getStringExtra("data");
+ if (data != null && !data.isEmpty()) {
+ try {
+ JSONObject jsonObject = new JSONObject(data);
+ String lightStatus = jsonObject.optString("lightStatus");
+ String surplusTime = jsonObject.optString("surplusTime");
+ if (!lightStatus.isEmpty() && !surplusTime.isEmpty()) {
+ handleObuTrafficLightInfo(lightStatus, surplusTime);
+ } else {
+ Logger.d(TAG, "红绿灯必要信息都为空,不做展示");
+ }
+ } catch (Exception e) {
+ Logger.e(TAG, e, "解析adas数据异常");
+ e.printStackTrace();
+ }
+ }
+ }
}
}
- private View generateNoticeView(int iconRes, String content) {
- View view = LayoutInflater.from(context).inflate(R.layout.item_vr_left_notice, null);
- ImageView icon = view.findViewById(R.id.module_ext_iv_left_notice_icon);
- icon.setImageResource(iconRes);
- TextView tvContent = view.findViewById(R.id.module_ext_vr_mode_left_notice_container);
- tvContent.setText(content);
- return view;
+ private void handleObuTrafficLightInfo(String lightStatus, String surplusTime) {
+ 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(){
+ if (tvTrafficLight != null && !handler.hasMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU)) {
+ handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD);
+ // todo drawTrafficLight
+ handler.sendEmptyMessageDelayed(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD,
+ HIDE_TRAFFIC_LIGHT_DELAY);
+ }
+ }
+
+ private void drawTrafficLight(String lightStatus, String surplusTime) {
+ tvTrafficLight.post(() -> {
+ if (tvTrafficLight.getVisibility() == View.GONE) {
+ tvTrafficLight.setVisibility(View.VISIBLE);
+ }
+ // todo 设置字体颜色、背景颜色、leftDrawable
+ switch (lightStatus) {
+ case "Y":
+ // 黄灯
+ break;
+ case "R":
+ // 红灯
+ break;
+ default:
+ // 默认绿灯
+ break;
+ }
+ tvTrafficLight.setText(surplusTime + "S");
+ Logger.d(TAG, "展示红绿灯信息: " + lightStatus + " time: " + surplusTime);
+ });
}
}
diff --git a/modules/mogo-module-extensions/src/main/res/drawable/module_ext_vr_mode_speed_red_bg.xml b/modules/mogo-module-extensions/src/main/res/drawable/module_ext_vr_mode_speed_red_bg.xml
new file mode 100644
index 0000000000..9b599f0e63
--- /dev/null
+++ b/modules/mogo-module-extensions/src/main/res/drawable/module_ext_vr_mode_speed_red_bg.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-extensions/src/main/res/drawable/module_ext_vr_mode_speed_white_bg.xml b/modules/mogo-module-extensions/src/main/res/drawable/module_ext_vr_mode_speed_white_bg.xml
new file mode 100644
index 0000000000..84230c5a05
--- /dev/null
+++ b/modules/mogo-module-extensions/src/main/res/drawable/module_ext_vr_mode_speed_white_bg.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-extensions/src/main/res/drawable/module_ext_vr_mode_traffic_light_green_bg.xml b/modules/mogo-module-extensions/src/main/res/drawable/module_ext_vr_mode_traffic_light_green_bg.xml
new file mode 100644
index 0000000000..3c907981c6
--- /dev/null
+++ b/modules/mogo-module-extensions/src/main/res/drawable/module_ext_vr_mode_traffic_light_green_bg.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml
index a051178c81..1667f2a694 100644
--- a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml
+++ b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml
@@ -14,8 +14,7 @@
+ android:layout_height="wrap_content" />
@@ -102,17 +101,17 @@
+ android:background="@drawable/module_ext_dw_upload_road_condition_bkg"
+ android:gravity="center"
+ android:text="VR"
+ android:textColor="#fff"
+ 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" />
+ android:textSize="@dimen/module_ext_exit_vr_mode_text_size"
+ android:visibility="gone"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintRight_toRightOf="parent" />
+ app:layout_constraintLeft_toLeftOf="parent" />
+
+ app:layout_constraintLeft_toRightOf="@+id/module_ext_vr_mode_left_notice_container"
+ app:layout_goneMarginLeft="@dimen/module_common_shadow_width_pos">
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/modules/mogo-module-extensions/src/main/res/values/colors.xml b/modules/mogo-module-extensions/src/main/res/values/colors.xml
index 090cf78c05..24016f710c 100644
--- a/modules/mogo-module-extensions/src/main/res/values/colors.xml
+++ b/modules/mogo-module-extensions/src/main/res/values/colors.xml
@@ -5,4 +5,10 @@
#fff
#f1f1f1
+ #7DE261
+ #FF2B2B
+ #FFF
+ #FFF
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-extensions/src/main/res/values/dimens.xml b/modules/mogo-module-extensions/src/main/res/values/dimens.xml
index 9c8fa00258..c73c813857 100644
--- a/modules/mogo-module-extensions/src/main/res/values/dimens.xml
+++ b/modules/mogo-module-extensions/src/main/res/values/dimens.xml
@@ -176,4 +176,8 @@
32px
40px
50px
+
+ 36px
+ 15px
+
\ No newline at end of file
diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/ADASWarnMessage.java b/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/ADASWarnMessage.java
index ec32361939..4c24cb413c 100644
--- a/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/ADASWarnMessage.java
+++ b/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/ADASWarnMessage.java
@@ -19,4 +19,14 @@ class ADASWarnMessage {
*/
public int type;
public String value;
+
+ @Override
+ public String toString() {
+ return "ADASWarnMessage{" +
+ "content='" + content + '\'' +
+ ", level='" + level + '\'' +
+ ", type=" + type +
+ ", value='" + value + '\'' +
+ '}';
+ }
}
diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/entrance/IMogoEntranceButtonController.java b/services/mogo-service-api/src/main/java/com/mogo/service/entrance/IMogoEntranceButtonController.java
index 8c76f2b31a..83a191c64c 100644
--- a/services/mogo-service-api/src/main/java/com/mogo/service/entrance/IMogoEntranceButtonController.java
+++ b/services/mogo-service-api/src/main/java/com/mogo/service/entrance/IMogoEntranceButtonController.java
@@ -16,45 +16,45 @@ public interface IMogoEntranceButtonController extends IProvider {
/**
* 前车急刹
*/
- public static final int NOTICE_TYPE_SUDDENLY_BREAK = 1001;
+ int NOTICE_TYPE_SUDDENLY_BREAK = 1001;
/**
* vip变灯通行
*/
- public static final int NOTICE_TYPE_VIP = 1002;
+ int NOTICE_TYPE_VIP = 1002;
/**
* 行人碰撞预警
*/
- public static final int NOTICE_TYPE_PEOPLE_WARN = 1003;
+ int NOTICE_TYPE_PEOPLE_WARN = 1003;
/**
* 逆向超车
*/
- public static final int NOTICE_TYPE_ILLEGAL_OVERTAKE = 1004;
+ int NOTICE_TYPE_ILLEGAL_OVERTAKE = 1004;
/**
* 后方危险车辆提醒
*/
- public static final int NOTICE_TYPE_DANGEROUS_CAR_WARN = 1005;
+ int NOTICE_TYPE_DANGEROUS_CAR_WARN = 1005;
/**
* 特殊车辆快速通过
*/
- public static final int NOTICE_TYPE_SPECIAL_CAR_WARN = 1006;
+ int NOTICE_TYPE_SPECIAL_CAR_WARN = 1006;
/**
* 自车求助
*/
- public static final int NOTICE_TYPE_SEEK_HELP = 1007;
+ int NOTICE_TYPE_SEEK_HELP = 1007;
/**
* 交通事故识别
*/
- public static final int NOTICE_TYPE_ACCIDENT_WARN = 1008;
+ int NOTICE_TYPE_ACCIDENT_WARN = 1008;
/**
* 障碍物体绕行
*/
- public static final int NOTICE_TYPE_OBSTACLE_WARN = 1009;
+ int NOTICE_TYPE_OBSTACLE_WARN = 1009;
/**
* 障碍车辆绕行
*/
- public static final int NOTICE_TYPE_OBSTACLE_CAR_WARN = 1010;
+ int NOTICE_TYPE_OBSTACLE_CAR_WARN = 1010;
/**
* 获取入口按钮实例