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 87371b2ce8..8df19ce8d4 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 @@ -497,7 +497,7 @@ public class EntranceFragment extends MvpFragment { - 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 @@ -153,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) { } } @@ -181,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": @@ -198,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: @@ -237,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()) { @@ -278,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) { @@ -292,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) { } } @@ -386,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/res/layout/include_navi_in_vr.xml b/modules/mogo-module-extensions/src/main/res/layout/include_navi_in_vr.xml index debe55ed54..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 @@ -8,6 +8,10 @@ android:id="@+id/module_ext_id_navi_in_vr_bg" android:layout_width="@dimen/module_ext_navi_in_vr_width" android:layout_height="@dimen/module_ext_navi_in_vr_height" + 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" /> - - - - - - - - - - - \ 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 9f023a93dd..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 @@ -262,57 +262,6 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" /> - - - - - - -