bugfix: #103 红绿灯不消失,修改成无数据后1s,红绿灯数据隐藏
This commit is contained in:
@@ -16,6 +16,8 @@ import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.view.VerticalTrafficLightView;
|
||||
|
||||
import static com.mogo.module.common.constants.TrafficLightConst.TRAFFIC_LIGHT_COLOR_GRAY;
|
||||
|
||||
/**
|
||||
* vr模式下导航信息封装
|
||||
*
|
||||
@@ -28,14 +30,14 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
|
||||
private final VerticalTrafficLightView turnAroundLight, turnLeftLight, straightLight, turnRightLight;
|
||||
|
||||
private final ImageView ivTurnIcon;
|
||||
private final TextView tvDistance,tvDistanceUnit, tvNextRoad;
|
||||
private final TextView tvDistance, tvDistanceUnit, tvNextRoad;
|
||||
|
||||
private final TextView tvCurrentSpeed;
|
||||
|
||||
private final Handler handler = new Handler(this);
|
||||
|
||||
public VrModeNavInfoView(Context context) {
|
||||
this(context,null);
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public VrModeNavInfoView(Context context, AttributeSet attrs) {
|
||||
@@ -72,7 +74,7 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
|
||||
}
|
||||
|
||||
public void refreshLimitSpeed(int limitSpeed) {
|
||||
if(getVisibility() != View.VISIBLE){
|
||||
if (getVisibility() != View.VISIBLE) {
|
||||
return;
|
||||
}
|
||||
handler.removeMessages(MSG_HIDE_LIMIT_SPEED);
|
||||
@@ -91,6 +93,14 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
|
||||
private int[] lightArray = new int[4];
|
||||
private String[] surplusTimeArray = new String[4];
|
||||
|
||||
/**
|
||||
* 将红绿灯状态全部置灰,相当于隐藏红绿灯状态
|
||||
*/
|
||||
public void hideTrafficLightStatus() {
|
||||
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT);
|
||||
refreshTrafficLightStatus(new int[]{TRAFFIC_LIGHT_COLOR_GRAY, TRAFFIC_LIGHT_COLOR_GRAY, TRAFFIC_LIGHT_COLOR_GRAY, TRAFFIC_LIGHT_COLOR_GRAY}, new String[]{"", "", "", ""});
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新红绿灯显示状态
|
||||
*
|
||||
@@ -107,12 +117,15 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
|
||||
turnRightLight.setTrafficLightStatus(laneLight[3], surplusTime[3]);
|
||||
// todo 再根据当前所在车道,置灰不需关注的灯
|
||||
|
||||
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT);
|
||||
handler.sendEmptyMessageDelayed(MSG_HIDE_TRAFFIC_LIGHT, HIDE_TRAFFIC_LIGHT_DELAY);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据所在车道,控制红绿灯展示
|
||||
*/
|
||||
public void refreshLaneStatus(){
|
||||
public void refreshLaneStatus() {
|
||||
|
||||
}
|
||||
|
||||
@@ -136,16 +149,24 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
|
||||
public boolean isVisible() {
|
||||
return navGroup.getVisibility() == View.VISIBLE;
|
||||
}
|
||||
|
||||
private static final int MSG_HIDE_LIMIT_SPEED = 1001;
|
||||
private static final long HIDE_LIMIT_SPEED_DELAY = 5000;
|
||||
|
||||
private static final int MSG_HIDE_TRAFFIC_LIGHT = 1002;
|
||||
private static final long HIDE_TRAFFIC_LIGHT_DELAY = 1000;
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
if (!isAttachedToWindow()||getVisibility() != View.VISIBLE) {
|
||||
if (!isAttachedToWindow() || getVisibility() != View.VISIBLE) {
|
||||
return false;
|
||||
}
|
||||
if (msg.what == MSG_HIDE_LIMIT_SPEED) {
|
||||
tvLimitSpeed.setVisibility(View.GONE);
|
||||
return true;
|
||||
} else if (msg.what == MSG_HIDE_TRAFFIC_LIGHT) {
|
||||
hideTrafficLightStatus();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -158,8 +158,9 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
|
||||
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);
|
||||
vrModeNavInfoView.hideTrafficLightStatus();
|
||||
// handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
|
||||
// handler.sendEmptyMessage(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
|
||||
} else {
|
||||
// 红绿灯处理
|
||||
String data = intent.getStringExtra("data");
|
||||
|
||||
Reference in New Issue
Block a user