opt
This commit is contained in:
@@ -199,7 +199,24 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
|
||||
if (tvTrafficLight != null && !handler.hasMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU)) {
|
||||
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD);
|
||||
// todo drawTrafficLight
|
||||
|
||||
String lightStatus;
|
||||
switch (roadData.getLightStatus()) {
|
||||
case 1:
|
||||
// 红灯
|
||||
lightStatus = "R";
|
||||
break;
|
||||
case 3:
|
||||
// 黄灯
|
||||
lightStatus = "Y";
|
||||
break;
|
||||
default:
|
||||
// 默认绿灯
|
||||
lightStatus = "G";
|
||||
break;
|
||||
}
|
||||
int diff = (int) ((System.currentTimeMillis() - roadData.getSystemTime())/1000);
|
||||
int leftTime = roadData.getLightLeftTime() - diff;
|
||||
drawTrafficLight(lightStatus, "" + leftTime);
|
||||
handler.sendEmptyMessageDelayed(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD,
|
||||
HIDE_TRAFFIC_LIGHT_DELAY);
|
||||
}
|
||||
@@ -239,6 +256,8 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
|
||||
if (roadData != null) {
|
||||
Logger.d(TAG, "收到红绿灯数据");
|
||||
handleCloudTrafficLight(roadData);
|
||||
}else{
|
||||
handler.sendEmptyMessage(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,16 @@ class MockUtil:Handler.Callback {
|
||||
view.findViewById<Button>(R.id.btnRushRedLight).setOnClickListener {
|
||||
obu.onMessageReceived("{\"rush_redlight\": {\"glosa_info\": [{\"rush_redlight_alarm\": 0}]}}".toByteArray())
|
||||
}
|
||||
|
||||
view.findViewById<Button>(R.id.btnStartTrafficLight).setOnClickListener {
|
||||
intervalMockData()
|
||||
}
|
||||
|
||||
view.findViewById<Button>(R.id.btnStopTrafficLight).setOnClickListener {
|
||||
if (intervalObs != null&&!intervalObs.isDisposed) {
|
||||
intervalObs.dispose()
|
||||
}
|
||||
}
|
||||
handler.sendEmptyMessageDelayed(1001, 10000)
|
||||
|
||||
}
|
||||
|
||||
@@ -34,8 +34,16 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="行人碰撞" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnStartTrafficLight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始红绿灯倒计时" />
|
||||
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnStopTrafficLight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="停止红绿灯倒计时" />
|
||||
|
||||
</GridLayout>
|
||||
Reference in New Issue
Block a user