From 90c8e9f07a272fb3af6193567aeefced655a6ddc Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Thu, 29 Oct 2020 19:16:07 +0800 Subject: [PATCH] opt --- .../extensions/utils/AdasNoticeHelper.java | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java index 0d2eb539ee..aaeec71c8f 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java @@ -242,21 +242,28 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca }else { 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, "红绿灯必要信息都为空,不做展示"); + String obuLightAction = intent.getStringExtra("action"); + if("1".equals(obuLightAction)){ + // 隐藏红绿灯 + handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU); + handler.sendEmptyMessage(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU); + }else { + // 红绿灯处理 + 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(); } - } catch (Exception e) { - Logger.e(TAG, e, "解析adas数据异常"); - e.printStackTrace(); } } } @@ -303,6 +310,8 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca 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);