opt left notice
This commit is contained in:
@@ -427,6 +427,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
|
||||
private void exitVrMode(){
|
||||
EntranceViewHolder.getInstance().forceHideNoticeView();
|
||||
mApis.getStatusManagerApi().setVrMode(TYPE_ENTRANCE, false);
|
||||
tvEnterVrMode.setVisibility(View.VISIBLE);
|
||||
mMove2CurrentLocation.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -49,6 +49,16 @@ public class MogoEntranceButtonControllerImpl implements IMogoEntranceButtonCont
|
||||
EntranceViewHolder.getInstance().hideLeftNoticeView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLeftNoticeByType(int noticeType, int iconRes, String content) {
|
||||
EntranceViewHolder.getInstance().showLeftNoticeByType(noticeType, iconRes, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideLeftNoticeByType(int noticeType) {
|
||||
EntranceViewHolder.getInstance().hideLeftNoticeByType(noticeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.mogo.module.extensions.utils;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.bean.BottomLayerViewWrapper;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -13,6 +17,8 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.service.entrance.IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP;
|
||||
|
||||
/**
|
||||
* 入口页view管理
|
||||
* @author tongchenfei
|
||||
@@ -119,22 +125,72 @@ public class EntranceViewHolder {
|
||||
}
|
||||
|
||||
public void showLeftNoticeView(View view) {
|
||||
if (leftNoticeContainer != null) {
|
||||
realShowLeftNoticeView(view);
|
||||
}else{
|
||||
preAddLeftNoticeView = view;
|
||||
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (leftNoticeContainer != null) {
|
||||
realShowLeftNoticeView(view);
|
||||
} else {
|
||||
preAddLeftNoticeView = view;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void hideLeftNoticeView(View view) {
|
||||
if (preAddLeftNoticeView != null && preAddLeftNoticeView == view) {
|
||||
preAddLeftNoticeView = null;
|
||||
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (preAddLeftNoticeView != null && preAddLeftNoticeView == view) {
|
||||
preAddLeftNoticeView = null;
|
||||
}
|
||||
if (leftNoticeContainer != null) {
|
||||
realHideLeftNoticeView(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void forceHideNoticeView(){
|
||||
preAddLeftNoticeView = null;
|
||||
currentShowNoticeType = 0;
|
||||
if (leftNoticeContainer != null) {
|
||||
realHideLeftNoticeView(view);
|
||||
leftNoticeContainer.removeAllViews();
|
||||
}
|
||||
}
|
||||
|
||||
private int currentShowNoticeType = 0;
|
||||
public void showLeftNoticeByType(int noticeType, int iconRes, String content){
|
||||
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
currentShowNoticeType = noticeType;
|
||||
if (leftNoticeContainer != null) {
|
||||
realShowLeftNoticeView(generateNoticeViewByType(noticeType, iconRes, content));
|
||||
} else {
|
||||
preAddLeftNoticeView = generateNoticeViewByType(noticeType, iconRes, content);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void hideLeftNoticeByType(int noticeType) {
|
||||
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (currentShowNoticeType == noticeType) {
|
||||
forceHideNoticeView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private View generateNoticeViewByType(int noticeType,int iconRes, String content) {
|
||||
View view =
|
||||
LayoutInflater.from(leftNoticeContainer.getContext()).inflate(R.layout.item_vr_left_notice, leftNoticeContainer, false);
|
||||
ImageView icon = view.findViewById(R.id.module_ext_iv_left_notice_icon);
|
||||
if (noticeType == NOTICE_TYPE_SEEK_HELP) {
|
||||
// 自车求助,是橘色的背景
|
||||
icon.setBackgroundResource(R.drawable.module_ext_left_notice_icon_orange_bg);
|
||||
}else{
|
||||
// 其他是红色背景
|
||||
icon.setBackgroundResource(R.drawable.module_ext_left_notice_icon_red_bg);
|
||||
}
|
||||
icon.setImageResource(iconRes);
|
||||
TextView tvContent = view.findViewById(R.id.module_ext_vr_mode_left_notice_container);
|
||||
tvContent.setText(content);
|
||||
return view;
|
||||
}
|
||||
|
||||
private void realShowLeftNoticeView(View view){
|
||||
leftNoticeContainer.removeAllViews();
|
||||
leftNoticeContainer.addView(view);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<size
|
||||
android:width="@dimen/module_ext_vr_mode_left_notice_icon_width"
|
||||
android:height="@dimen/module_ext_vr_mode_left_notice_height" />
|
||||
|
||||
<gradient
|
||||
android:startColor="#FA8F36"
|
||||
android:endColor="#DB6B28"
|
||||
android:angle="0"/>
|
||||
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/module_ext_common_corner"
|
||||
android:bottomLeftRadius="@dimen/module_ext_common_corner" />
|
||||
|
||||
</shape>
|
||||
@@ -9,6 +9,7 @@
|
||||
android:layout_width="@dimen/module_ext_vr_mode_left_notice_icon_width"
|
||||
android:layout_height="@dimen/module_ext_vr_mode_left_notice_height"
|
||||
android:id="@+id/module_ext_iv_left_notice_icon"
|
||||
android:src="@drawable/module_ext_accident_warn"
|
||||
android:background="@drawable/module_ext_left_notice_icon_red_bg"/>
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -7,10 +7,11 @@ import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
import android.util.ArrayMap;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XObuEventEntity;
|
||||
@@ -21,6 +22,7 @@ import com.mogo.module.v2x.utils.ADASUtils;
|
||||
import com.mogo.module.v2x.utils.DrivingDirectionUtils;
|
||||
import com.mogo.module.v2x.utils.ObuConfig;
|
||||
import com.mogo.module.v2x.utils.TestOnLineCarUtils;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.mogo.module.obu.ObuConstant;
|
||||
import com.zhidao.mogo.module.obu.ObuManager;
|
||||
@@ -33,8 +35,6 @@ import org.json.JSONObject;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
import static com.mogo.module.v2x.scenario.scene.obu.V2XObuEventScenario.ACTION_LAUNCHER_ADAS_APP_BIZ;
|
||||
@@ -211,6 +211,7 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_COLLISION_WARN_TEXT);
|
||||
messageEntity.setContent(urgencyEvent);
|
||||
V2XObuEventScenario.getInstance().init(messageEntity);
|
||||
V2XServiceManager.getMogoEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SUDDENLY_BREAK, R.drawable.module_v2x_suddenly_break, "前车急刹,保持车距");
|
||||
break;
|
||||
case ObuConstant.TYPE_ROAD_USER_COLLISION_WARNING:
|
||||
// 行人预警,给adas发送广播即可
|
||||
@@ -229,6 +230,7 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
changeLightEvent.setDesc(info.getDescribe());
|
||||
messageEntity.setContent(changeLightEvent);
|
||||
V2XObuEventScenario.getInstance().init(messageEntity);
|
||||
V2XServiceManager.getMogoEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_VIP, R.drawable.module_v2x_suddenly_break, "将为您变灯,vip车辆可优先通行");
|
||||
break;
|
||||
case ObuConstant.TYPE_RUSH_RED_LIGHT:
|
||||
// 闯红灯预警
|
||||
|
||||
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
@@ -13,6 +13,49 @@ import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
*/
|
||||
public interface IMogoEntranceButtonController extends IProvider {
|
||||
|
||||
/**
|
||||
* 前车急刹
|
||||
*/
|
||||
public static final int NOTICE_TYPE_SUDDENLY_BREAK = 1001;
|
||||
/**
|
||||
* vip变灯通行
|
||||
*/
|
||||
public static final int NOTICE_TYPE_VIP = 1002;
|
||||
/**
|
||||
* 行人碰撞预警
|
||||
*/
|
||||
public static final int NOTICE_TYPE_PEOPLE_WARN = 1003;
|
||||
/**
|
||||
* 逆向超车
|
||||
*/
|
||||
public static final int NOTICE_TYPE_ILLEGAL_OVERTAKE = 1004;
|
||||
/**
|
||||
* 后方危险车辆提醒
|
||||
*/
|
||||
public static final int NOTICE_TYPE_DANGEROUS_CAR_WARN = 1005;
|
||||
/**
|
||||
* 特殊车辆快速通过
|
||||
*/
|
||||
public static final int NOTICE_TYPE_SPECIAL_CAR_WARN = 1006;
|
||||
/**
|
||||
* 自车求助
|
||||
*/
|
||||
public static final int NOTICE_TYPE_SEEK_HELP = 1007;
|
||||
/**
|
||||
* 交通事故识别
|
||||
*/
|
||||
public static final int NOTICE_TYPE_ACCIDENT_WARN = 1008;
|
||||
|
||||
/**
|
||||
* 障碍物体绕行
|
||||
*/
|
||||
public static final int NOTICE_TYPE_OBSTACLE_WARN = 1009;
|
||||
|
||||
/**
|
||||
* 障碍车辆绕行
|
||||
*/
|
||||
public static final int NOTICE_TYPE_OBSTACLE_CAR_WARN = 1010;
|
||||
|
||||
/**
|
||||
* 获取入口按钮实例
|
||||
*
|
||||
@@ -49,8 +92,22 @@ public interface IMogoEntranceButtonController extends IProvider {
|
||||
void showLeftNoticeView(View view);
|
||||
|
||||
/**
|
||||
* 隐藏vr模式下,左下角提示view
|
||||
* 隐藏vr模式下,左下角提示view,需要与{@link #showLeftNoticeView(View)}成对使用
|
||||
* @param view 待隐藏view
|
||||
*/
|
||||
void hideLeftNoticeView(View view);
|
||||
|
||||
/**
|
||||
* 根据noticeType添加左侧提示
|
||||
* @param noticeType {@link #NOTICE_TYPE_SUDDENLY_BREAK}...
|
||||
* @param iconRes 本地 icon res
|
||||
* @param content 提示内容
|
||||
*/
|
||||
void showLeftNoticeByType(int noticeType, int iconRes, String content);
|
||||
|
||||
/**
|
||||
* 移除noticeType,需要与{@link #showLeftNoticeByType(int, int, String)}成对使用
|
||||
* @param noticeType {@link #NOTICE_TYPE_SUDDENLY_BREAK}...
|
||||
*/
|
||||
void hideLeftNoticeByType(int noticeType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user