0 ) {
target.setImageResource( iconId );
@@ -143,4 +146,6 @@ public abstract class BaseNaviInfoView {
}
builder.append( "到达" );
}
+
+ public abstract boolean isVisible();
}
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java
index 6264550e08..67110d0ba7 100644
--- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java
@@ -26,7 +26,8 @@ public class NaviInfoView extends BaseNaviInfoView {
private TextView remainingTimeUnit;
private TextView arriveTime;
- public void inflate( View view ) {
+ public NaviInfoView(View view) {
+ super(view);
turnIcon = view.findViewById( R.id.module_map_id_navi_next_info_road_turn_icon );
distance = view.findViewById( R.id.module_map_id_navi_next_info_distance );
distanceUnit = view.findViewById( R.id.module_map_id_navi_next_info_distance_unit );
@@ -39,6 +40,7 @@ public class NaviInfoView extends BaseNaviInfoView {
arriveTime = view.findViewById( R.id.module_map_id_arrive_time );
}
+ @Override
public boolean isVisible() {
return turnIcon != null && turnIcon.getVisibility() == View.VISIBLE;
}
@@ -46,7 +48,6 @@ public class NaviInfoView extends BaseNaviInfoView {
@Override
public void notifyChanged( MogoNaviInfo naviInfo ) {
- super.notifyChanged( naviInfo );
if ( naviInfo == null ) {
return;
}
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/VrModeNavInfoView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/VrModeNavInfoView.java
new file mode 100644
index 0000000000..428d98494a
--- /dev/null
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/VrModeNavInfoView.java
@@ -0,0 +1,25 @@
+package com.mogo.module.extensions.navi;
+
+import android.view.View;
+
+import com.mogo.map.navi.MogoNaviInfo;
+
+/**
+ * vr模式下导航信息封装
+ *
+ * @author tongchenfei
+ */
+public class VrModeNavInfoView extends BaseNaviInfoView {
+ public VrModeNavInfoView(View view) {
+ super(view);
+ }
+
+ @Override
+ public boolean isVisible() {
+ return true;
+ }
+
+ @Override
+ public void notifyChanged(MogoNaviInfo naviInfo) {
+ }
+}
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 d5ec491f0e..a04b37eeab 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
@@ -6,23 +6,18 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.os.Handler;
import android.os.Message;
-import android.view.LayoutInflater;
import android.view.View;
-import android.widget.TextView;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.location.MogoLocation;
-import com.mogo.map.navi.MogoTraffic;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.CloudRoadData;
import com.mogo.module.common.entity.MogoSnapshotSetData;
-import com.mogo.module.extensions.R;
import com.mogo.service.adas.IMogoAdasWarnMessageCallback;
import com.mogo.service.adas.MogoADASWarnType;
import com.mogo.service.adas.entity.ADASWarnMessage;
import com.mogo.service.connection.IMogoOnWebSocketMessageListener;
import com.mogo.service.connection.WebSocketMsgType;
-import com.mogo.service.entrance.IMogoEntranceButtonController;
import com.mogo.utils.logger.Logger;
import org.json.JSONObject;
@@ -50,8 +45,6 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
private volatile boolean isVrMode = false;
- private TextView tvSelfSpeed, tvTrafficLight, tvLimitSpeed;
-
private int limitSpeed = -1;
private int currentSpeed = 0;
private String lightStatus = "G";
@@ -61,26 +54,18 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
private boolean isObuLightData = false;
- private View selfCar;
private boolean lightCenter = true;
public void init(Context context) {
this.context = context;
- if(!lightCenter) {
- selfCar = LayoutInflater.from(context).inflate(R.layout.module_ext_item_self_car, null);
- tvSelfSpeed = selfCar.findViewById(R.id.tvSelfSpeed);
- tvTrafficLight = selfCar.findViewById(R.id.tvTrafficLight);
- tvLimitSpeed = selfCar.findViewById(R.id.tvLimitSpeed);
+ if (!lightCenter) {
}
Logger.d(TAG, "init====");
}
public void initView(View root) {
- if(lightCenter) {
- tvSelfSpeed = root.findViewById(R.id.tvSelfSpeed);
- tvTrafficLight = root.findViewById(R.id.tvTrafficLight);
- tvLimitSpeed = root.findViewById(R.id.tvLimitSpeed);
+ if (lightCenter) {
}
}
@@ -88,13 +73,15 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
Logger.d(TAG, "enterVrMode===" + isVrMode);
if (!isVrMode) {
isVrMode = true;
+ MogoApisHandler.getInstance().getApis().getAdasControllerApi().closeADAS();
+
IntentFilter filter = new IntentFilter("com.mogo.launcher.adas.app.biz");
filter.addAction("com.mogo.launcher.adas");
context.registerReceiver(adasReceiver, filter);
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasWarnMessageCallback(this);
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoLocationListener(TAG, this);
MogoApisHandler.getInstance().getApis().getWebSocketManagerApi(context).registerOnWebSocketMessageListener(this);
- if(!lightCenter) {
+ if (!lightCenter) {
handler.sendEmptyMessageDelayed(MSG_REFRESH_CAR_STRATEGY, STRATEGY_DELAY);
}
}
@@ -104,10 +91,8 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
Logger.d(TAG, "退出vr模式===" + isVrMode);
if (isVrMode) {
isVrMode = false;
+ MogoApisHandler.getInstance().getApis().getAdasControllerApi().showADAS();
handler.removeMessages(MSG_REFRESH_CAR_STRATEGY);
- tvSelfSpeed.setVisibility(View.GONE);
- tvTrafficLight.setVisibility(View.GONE);
- tvLimitSpeed.setVisibility(View.GONE);
MogoApisHandler.getInstance().getApis().getAdasControllerApi().removeAdasWarnMessageCallback(this);
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoLocationListener(TAG);
MogoApisHandler.getInstance().getApis().getWebSocketManagerApi(context).unregisterOnWebSocketMessageListener(this);
@@ -130,18 +115,7 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
}
}
- private void drawLimitSpeed(){
- if (tvLimitSpeed != null) {
- tvLimitSpeed.post(() -> {
- handler.removeMessages(MSG_HIDE_LIMIT_SPEED);
-
- if (tvLimitSpeed.getVisibility() == View.GONE) {
- tvLimitSpeed.setVisibility(View.VISIBLE);
- }
- tvLimitSpeed.setText(limitSpeed+"");
- handler.sendEmptyMessageDelayed(MSG_HIDE_LIMIT_SPEED, HIDE_LIMIT_SPEED_DELAY);
- });
- }
+ private void drawLimitSpeed() {
}
@Override
@@ -150,25 +124,7 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
return;
}
currentSpeed = (int) (location.getSpeed() * 3.6F);
- if(lightCenter) {
- if (tvSelfSpeed != null) {
- tvSelfSpeed.post(() -> {
- if (tvSelfSpeed.getVisibility() == View.GONE) {
- tvSelfSpeed.setVisibility(View.VISIBLE);
- }
- if (limitSpeed != -1 && currentSpeed > limitSpeed) {
- // 显示红色
- tvSelfSpeed.setTextColor(context.getResources().getColor(R.color.module_ext_vr_mode_left_traffic_light_red));
- tvSelfSpeed.setBackgroundResource(R.drawable.module_ext_vr_mode_speed_red_bg);
- }else{
- // 显示白
- tvSelfSpeed.setTextColor(context.getResources().getColor(R.color.module_ext_vr_mode_left_traffic_light_white));
- tvSelfSpeed.setBackgroundResource(R.drawable.module_ext_vr_mode_speed_white_bg);
- }
- tvSelfSpeed.setText("" + currentSpeed);
- Logger.d(TAG, "onLocationChange: " + currentSpeed);
- });
- }
+ if (lightCenter) {
}
}
@@ -178,11 +134,6 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
case MSG_REFRESH_CAR_STRATEGY:
// todo 暂时不采用此种渲染方式
// 自车速度
- tvSelfSpeed.setText("" + currentSpeed);
- // 红绿灯
- if (tvTrafficLight.getVisibility() == View.GONE) {
- tvTrafficLight.setVisibility(View.VISIBLE);
- }
// todo 设置字体颜色、背景颜色、leftDrawable
switch (lightStatus) {
case "Y":
@@ -195,26 +146,21 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
// 默认绿灯
break;
}
- tvTrafficLight.setText(surplusTime + "S");
- MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().showMyLocation(inflateRoadInfo());
if (isVrMode) {
handler.sendEmptyMessageDelayed(MSG_REFRESH_CAR_STRATEGY, STRATEGY_DELAY);
}
return true;
case MSG_HIDE_LIMIT_SPEED:
limitSpeed = -1;
- tvLimitSpeed.setVisibility(View.GONE);
return true;
case MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD:
if (!isObuLightData && !handler.hasMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU)) {
- tvTrafficLight.setVisibility(View.GONE);
}
return true;
case MSG_HIDE_TRAFFIC_LIGHT_BY_OBU:
isObuLightData = false;
if (!handler.hasMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD)) {
- tvTrafficLight.setVisibility(View.GONE);
}
return true;
default:
@@ -234,22 +180,22 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
return;
}
String action = intent.getAction();
- if("com.mogo.launcher.adas".equals(action)){
+ if ("com.mogo.launcher.adas".equals(action)) {
// 收到限速信息
int limit = intent.getIntExtra("adas_speed_limit", -1);
- if(limit>0) {
+ if (limit > 0) {
limitSpeed = limit;
drawLimitSpeed();
}
- }else {
+ } else {
int type = intent.getIntExtra("type", -1);
if (type == 2) {
String obuLightAction = intent.getStringExtra("action");
- if("1".equals(obuLightAction)){
+ if ("1".equals(obuLightAction)) {
// 隐藏红绿灯
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
handler.sendEmptyMessage(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
- }else {
+ } else {
// 红绿灯处理
String data = intent.getStringExtra("data");
if (data != null && !data.isEmpty()) {
@@ -275,13 +221,6 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
private void handleObuTrafficLightInfo(String lightStatus, String surplusTime) {
isObuLightData = true;
- 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(CloudRoadData roadData) {
@@ -289,75 +228,12 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD);
return;
}
- if (tvTrafficLight != null && !handler.hasMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU)) {
- handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD);
- // todo drawTrafficLight
- String lightStatus = null;
- switch (roadData.getLightStatus()) {
- case 1:
- // 红灯
- lightStatus = "R";
- break;
- case 2:
- // 绿灯
- lightStatus = "G";
- break;
- case 3:
- // 黄灯
- lightStatus = "Y";
- break;
- default:
- break;
- }
- if(lightStatus == null){
- handler.sendEmptyMessage(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD);
- }else {
- int diff = (int) ((System.currentTimeMillis() - roadData.getSystemTime()) / 1000);
- int leftTime = roadData.getLightLeftTime() - diff;
- 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);
- }
- }
}
private void drawTrafficLight(String lightStatus, String surplusTime) {
this.lightStatus = lightStatus;
this.surplusTime = surplusTime;
- if(lightCenter) {
- tvTrafficLight.post(() -> {
- if (tvTrafficLight.getVisibility() == View.GONE) {
- tvTrafficLight.setVisibility(View.VISIBLE);
- }
- // todo 设置字体颜色、背景颜色、leftDrawable
- switch (lightStatus) {
- case "Y":
- // 黄灯
- tvTrafficLight.setTextColor(context.getResources().getColor(R.color.module_ext_vr_mode_left_traffic_light_yellow));
- tvTrafficLight.setBackgroundResource(R.drawable.module_ext_vr_mode_traffic_light_yellow_bg);
- tvTrafficLight.setCompoundDrawablesWithIntrinsicBounds(R.drawable.module_ext_traffic_light_yellow, 0, 0, 0);
- break;
- case "R":
- // 红灯
- tvTrafficLight.setTextColor(context.getResources().getColor(R.color.module_ext_vr_mode_left_traffic_light_red));
- tvTrafficLight.setBackgroundResource(R.drawable.module_ext_vr_mode_traffic_light_red_bg);
- tvTrafficLight.setCompoundDrawablesWithIntrinsicBounds(R.drawable.module_ext_traffic_light_red, 0, 0, 0);
- break;
- default:
- // 默认绿灯
- tvTrafficLight.setTextColor(context.getResources().getColor(R.color.module_ext_vr_mode_left_traffic_light_green));
- tvTrafficLight.setBackgroundResource(R.drawable.module_ext_vr_mode_traffic_light_green_bg);
- tvTrafficLight.setCompoundDrawablesWithIntrinsicBounds(R.drawable.module_ext_traffic_light_green, 0, 0, 0);
- break;
- }
- tvTrafficLight.setText(surplusTime + "S");
- Logger.d(TAG, "展示红绿灯信息: " + lightStatus + " time: " + surplusTime);
- });
+ if (lightCenter) {
}
}
@@ -383,12 +259,4 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
}
}
- private View inflateRoadInfo(){
- View view = View.inflate(context, R.layout.module_ext_item_self_car, null);
- TextView _speed = view.findViewById(R.id.tvSelfSpeed);
- _speed.setText("" + currentSpeed);
- Logger.d(TAG, "showCurrentSpeed: " + currentSpeed);
- return view;
- }
-
}
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java
index 98c10fe03c..ce4008e550 100644
--- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java
@@ -782,4 +782,18 @@ public class TopViewAnimHelper {
cameraMode = null;
transition = null;
}
+
+ public void enterVrMode(){
+ removeAllView();
+ topContainer.getLayoutParams().width = (int) getDimen(R.dimen.module_ext_top_view_width_in_vr_mode);
+// topContainer.requestLayout();
+// topMotionLayout.requestLayout();
+ }
+
+ public void exitVrMode(){
+ removeAllView();
+ topContainer.getLayoutParams().width = (int) getDimen(R.dimen.module_ext_top_view_width);
+// topContainer.requestLayout();
+// topMotionLayout.requestLayout();
+ }
}
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewNoLinkageAnimHelper.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewNoLinkageAnimHelper.java
index 8ab39f0e00..74f6808116 100644
--- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewNoLinkageAnimHelper.java
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewNoLinkageAnimHelper.java
@@ -384,6 +384,11 @@ public class TopViewNoLinkageAnimHelper {
}
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setTopViewShow(ExtensionsModuleConst.TYPE_ENTRANCE, true);
+
+ // vr模式下与TopView互斥
+ if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
+ TopViewAnimHelper.getInstance().removeAllView();
+ }
}
/**
@@ -536,4 +541,14 @@ public class TopViewNoLinkageAnimHelper {
cameraMode = null;
transition = null;
}
+
+ public void enterVrMode(){
+ removeAllView();
+ topContainerNoLinkage.getLayoutParams().width = (int) getDimen(R.dimen.module_ext_top_view_no_link_width_in_vr_mode);
+ }
+
+ public void exitVrMode(){
+ removeAllView();
+ topContainerNoLinkage.getLayoutParams().width = LayoutParams.MATCH_PARENT;
+ }
}
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TrafficLightPanelManager.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TrafficLightPanelManager.java
new file mode 100644
index 0000000000..1087cafce2
--- /dev/null
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TrafficLightPanelManager.java
@@ -0,0 +1,175 @@
+package com.mogo.module.extensions.utils;
+
+import android.os.Handler;
+import android.os.Message;
+import android.view.View;
+import android.widget.TextView;
+
+import androidx.constraintlayout.widget.Group;
+
+import com.mogo.module.extensions.R;
+import com.mogo.module.extensions.view.VerticalTrafficLightView;
+import com.mogo.utils.logger.Logger;
+
+import java.util.Random;
+
+/**
+ * 红绿灯面板管理类,控制各部分显示隐藏,同时控制限速、车速、红绿灯信息展示
+ *
+ * 导航信息内容通过{@link com.mogo.module.extensions.navi.VrModeNavInfoView} 在{@link com.mogo.module.extensions.entrance.EntranceFragment}进行控制
+ * 此处仅控制导航信息的显示与隐藏
+ *
+ * @author tongchenfei
+ */
+public class TrafficLightPanelManager implements Handler.Callback, View.OnClickListener {
+ private static final String TAG = "TrafficLightPanelManager";
+
+ private TrafficLightPanelManager() {
+ }
+
+ private final static TrafficLightPanelManager INSTANCE = new TrafficLightPanelManager();
+
+ public static TrafficLightPanelManager getInstance() {
+ return INSTANCE;
+ }
+
+ private Group speedGroup, navGroup, extraGroup;
+ private TextView tvLimitSpeed;
+ private VerticalTrafficLightView turnAroundLight, turnLeftLight, straightLight, turnRightLight;
+
+ private Handler handler = new Handler(this);
+
+ private boolean isInit = false;
+
+ public void initPanel(View root) {
+ speedGroup = root.findViewById(R.id.module_ext_id_group_navi_in_vr_speed);
+ navGroup = root.findViewById(R.id.module_ext_id_group_navi_in_vr_nav_info);
+ extraGroup = root.findViewById(R.id.module_ext_id_group_traffic_light_panel_extra);
+ tvLimitSpeed = root.findViewById(R.id.module_ext_id_tv_limit_speed);
+ turnAroundLight = root.findViewById(R.id.module_ext_id_traffic_light_turn_around);
+ turnLeftLight = root.findViewById(R.id.module_ext_id_traffic_light_turn_left);
+ straightLight = root.findViewById(R.id.module_ext_id_traffic_light_straight);
+ turnRightLight = root.findViewById(R.id.module_ext_id_traffic_light_turn_right);
+ isInit = true;
+
+ // debug
+ root.findViewById(R.id.module_ext_id_navi_in_vr_speed_bg).setOnClickListener(this);
+ root.findViewById(R.id.module_ext_id_navi_in_vr_traffic_bg).setOnClickListener(this);
+ }
+
+ public void showNavPanel() {
+ if (!isInit) {
+ Logger.e(TAG, "nav panel 未初始化");
+ return;
+ }
+ extraGroup.setVisibility(View.VISIBLE);
+ if (isNav) {
+ navGroup.setVisibility(View.VISIBLE);
+ speedGroup.setVisibility(View.GONE);
+ } else {
+ speedGroup.setVisibility(View.VISIBLE);
+ navGroup.setVisibility(View.GONE);
+ }
+ tvLimitSpeed.setVisibility(View.VISIBLE);
+ }
+
+ public void hideNavPanel() {
+ if (!isInit) {
+ Logger.e(TAG, "nav panel 未初始化");
+ return;
+ }
+ extraGroup.setVisibility(View.GONE);
+ speedGroup.setVisibility(View.GONE);
+ tvLimitSpeed.setVisibility(View.GONE);
+
+ }
+
+ private boolean isNav = false;
+
+ public void startNav() {
+ isNav = true;
+ navGroup.setVisibility(View.VISIBLE);
+ speedGroup.setVisibility(View.GONE);
+ }
+
+ public void stopNav() {
+ isNav = false;
+ speedGroup.setVisibility(View.VISIBLE);
+ navGroup.setVisibility(View.GONE);
+ }
+
+ public void refreshLimitSpeed(int limitSpeed) {
+ handler.removeMessages(MSG_HIDE_LIMIT_SPEED);
+ tvLimitSpeed.setVisibility(View.VISIBLE);
+ tvLimitSpeed.setText(String.valueOf(limitSpeed));
+ handler.sendEmptyMessageDelayed(MSG_HIDE_LIMIT_SPEED, HIDE_LIMIT_SPEED_DELAY);
+ }
+
+ /**
+ * 刷新红绿灯显示状态
+ *
+ * @param laneLight 固定数组长度为4的车道类型灯,从0-3依次代表 掉头,左转,执行,右转
+ * @param surplusTime 固定数组长度为4的剩余时长数组,从0-3依次代表 掉头,左转,执行,右转
+ */
+ public void refreshTrafficLightStatus(int[] laneLight, String[] surplusTime) {
+ turnAroundLight.setTrafficLightStatus(laneLight[0], surplusTime[0]);
+ turnLeftLight.setTrafficLightStatus(laneLight[1], surplusTime[1]);
+ straightLight.setTrafficLightStatus(laneLight[2], surplusTime[2]);
+ turnRightLight.setTrafficLightStatus(laneLight[3], surplusTime[3]);
+ }
+
+ public void release() {
+ isInit = false;
+ speedGroup = null;
+ navGroup = null;
+ extraGroup = null;
+ tvLimitSpeed = null;
+ turnAroundLight = null;
+ turnLeftLight = null;
+ straightLight = null;
+ turnRightLight = null;
+ }
+
+ private static final int MSG_HIDE_LIMIT_SPEED = 1001;
+ private static final long HIDE_LIMIT_SPEED_DELAY = 5000;
+
+ @Override
+ public boolean handleMessage(Message msg) {
+ if (!isInit) {
+ return false;
+ }
+ if (msg.what == MSG_HIDE_LIMIT_SPEED) {
+ tvLimitSpeed.setVisibility(View.GONE);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (v.getId() == R.id.module_ext_id_navi_in_vr_speed_bg) {
+ boolean s = new Random().nextBoolean();
+ boolean b = new Random().nextBoolean();
+ if (s) {
+ if (b) {
+ startNav();
+ } else {
+ stopNav();
+ }
+ } else {
+ refreshLimitSpeed(90);
+ }
+ } else {
+ int[] color = new int[4];
+ String[] time = new String[4];
+ for (int i = 0; i < 4; i++) {
+ int s = new Random().nextInt(4);
+ boolean b = new Random().nextBoolean();
+ color[i] = s;
+ time[i] = b ? "12" : "";
+ }
+ refreshTrafficLightStatus(color, time);
+ }
+
+ }
+}
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/view/VerticalTrafficLightView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/view/VerticalTrafficLightView.java
index 417309fc64..e16882fbcb 100644
--- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/view/VerticalTrafficLightView.java
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/view/VerticalTrafficLightView.java
@@ -41,7 +41,7 @@ public class VerticalTrafficLightView extends ConstraintLayout {
private static final int[] TURN_RIGHT_ICON_RES = new int[]{R.drawable.module_ext_dw_traffic_turn_right_gray, R.drawable.module_ext_dw_traffic_turn_right_red, R.drawable.module_ext_dw_traffic_turn_right_yellow, R.drawable.module_ext_dw_traffic_turn_right_green};
private final int[] iconRes;
- private final int[] colorRes = new int[]{-1, Color.parseColor("#F63A35"), Color.parseColor("#F63A35"), Color.parseColor("#11FF89")};
+ private final int[] colorRes = new int[]{-1, Color.parseColor("#F63A35"), Color.parseColor("#FFA71F"), Color.parseColor("#11FF89")};
public VerticalTrafficLightView(Context context) {
this(context, null);
@@ -54,7 +54,6 @@ public class VerticalTrafficLightView extends ConstraintLayout {
public VerticalTrafficLightView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
LayoutInflater.from(context).inflate(R.layout.merge_vertical_traffic_light_in_vr, this);
- initView();
TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.VerticalTrafficLightView, 0, 0);
int lightType = typedArray.getInt(R.styleable.VerticalTrafficLightView_iconRes, 0);
typedArray.recycle();
@@ -76,6 +75,7 @@ public class VerticalTrafficLightView extends ConstraintLayout {
iconRes = TURN_AROUND_ICON_RES;
break;
}
+ initView();
}
private void initView() {
@@ -84,6 +84,7 @@ public class VerticalTrafficLightView extends ConstraintLayout {
tvLeftTime = findViewById(R.id.module_ext_id_traffic_light_left_time);
tvLeftTimeUnit = findViewById(R.id.module_ext_id_traffic_light_left_time_unit);
groupLeftTime = findViewById(R.id.module_ext_id_group_left_time);
+ ivTrafficLight.setImageResource(iconRes[0]);
}
/**
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-ldpi/module_ext_navi_in_vr_speed_bg.xml b/modules/mogo-module-extensions/src/main/res/drawable-ldpi/module_ext_navi_in_vr_speed_bg.xml
index fc2be5c480..0d13832107 100644
--- a/modules/mogo-module-extensions/src/main/res/drawable-ldpi/module_ext_navi_in_vr_speed_bg.xml
+++ b/modules/mogo-module-extensions/src/main/res/drawable-ldpi/module_ext_navi_in_vr_speed_bg.xml
@@ -7,7 +7,8 @@
+ android:endColor="#FF141C35"
+ android:angle="270"/>
diff --git a/modules/mogo-module-extensions/src/main/res/drawable/module_ext_navi_in_vr_bg.xml b/modules/mogo-module-extensions/src/main/res/drawable/module_ext_navi_in_vr_bg.xml
index 8ebb6406a4..d37d6205c8 100644
--- a/modules/mogo-module-extensions/src/main/res/drawable/module_ext_navi_in_vr_bg.xml
+++ b/modules/mogo-module-extensions/src/main/res/drawable/module_ext_navi_in_vr_bg.xml
@@ -8,7 +8,8 @@
+ android:endColor="#68203784"
+ android:angle="270"/>
diff --git a/modules/mogo-module-extensions/src/main/res/layout/include_navi_in_vr.xml b/modules/mogo-module-extensions/src/main/res/layout/include_navi_in_vr.xml
index 0bf3225ba9..34a47aaadd 100644
--- a/modules/mogo-module-extensions/src/main/res/layout/include_navi_in_vr.xml
+++ b/modules/mogo-module-extensions/src/main/res/layout/include_navi_in_vr.xml
@@ -1,77 +1,116 @@
+ app:layout_constraintLeft_toLeftOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ android:layout_marginTop="@dimen/module_ext_navi_in_vr_margin_top"
+ android:layout_marginStart="@dimen/module_ext_navi_in_vr_margin_start"
+ android:background="@drawable/module_ext_navi_in_vr_bg" />
+ app:layout_constraintLeft_toLeftOf="@id/module_ext_id_navi_in_vr_bg"
+ app:layout_constraintRight_toRightOf="@id/module_ext_id_navi_in_vr_bg"
+ app:layout_constraintTop_toTopOf="@id/module_ext_id_navi_in_vr_bg" />
-
-
+ app:layout_constraintLeft_toLeftOf="@id/module_ext_id_navi_in_vr_bg"
+ app:layout_constraintRight_toRightOf="@id/module_ext_id_navi_in_vr_bg" />
+ app:layout_constraintBottom_toTopOf="@id/module_ext_id_navi_in_vr_traffic_bg"
+ app:layout_constraintLeft_toLeftOf="@id/module_ext_id_navi_in_vr_bg"
+ app:layout_constraintTop_toTopOf="@id/module_ext_id_navi_in_vr_bg" />
+ app:layout_constraintLeft_toRightOf="@id/module_ext_id_tv_speed" />
+
+
+
+
+
+
+
+
+
+
+ app:layout_constraintRight_toRightOf="@id/module_ext_id_navi_in_vr_bg"
+ app:layout_constraintTop_toTopOf="@id/module_ext_id_navi_in_vr_bg" />
+ app:layout_constraintRight_toLeftOf="@id/module_ext_id_traffic_light_turn_left"
+ app:layout_constraintTop_toTopOf="@id/module_ext_id_navi_in_vr_traffic_bg" />
+ app:layout_constraintRight_toRightOf="@id/module_ext_id_navi_in_vr_traffic_bg"
+ app:layout_constraintTop_toTopOf="@id/module_ext_id_traffic_light_straight" />
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-extensions/src/main/res/layout/merge_vertical_traffic_light_in_vr.xml b/modules/mogo-module-extensions/src/main/res/layout/merge_vertical_traffic_light_in_vr.xml
index 391cdb1d56..9c14f81fb8 100644
--- a/modules/mogo-module-extensions/src/main/res/layout/merge_vertical_traffic_light_in_vr.xml
+++ b/modules/mogo-module-extensions/src/main/res/layout/merge_vertical_traffic_light_in_vr.xml
@@ -7,6 +7,8 @@
diff --git a/modules/mogo-module-extensions/src/main/res/layout/module_ext_item_self_car.xml b/modules/mogo-module-extensions/src/main/res/layout/module_ext_item_self_car.xml
deleted file mode 100644
index 53c4d45924..0000000000
--- a/modules/mogo-module-extensions/src/main/res/layout/module_ext_item_self_car.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ 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 1ca223ff81..de35c28104 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
@@ -16,6 +16,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
+
+
@@ -248,6 +251,7 @@
android:textSize="@dimen/module_ext_exit_vr_mode_text_size"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent" />
-
-
-
-
-
-
-