wait
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
package com.mogo.eagle.core.data.config;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.ArrayMap;
|
||||
|
||||
import com.elegant.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.data.R;
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnum;
|
||||
import com.mogo.eagle.core.data.map.PoiWrapper;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 云端配置poi数据管理公共类
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class CloudPoiManager {
|
||||
private static final String TAG = "CloudPoiManager";
|
||||
|
||||
private final Map<String, PoiWrapper> poiWrapper = new ArrayMap<>();
|
||||
private static CloudPoiManager instance = null;
|
||||
|
||||
public static CloudPoiManager getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (CloudPoiManager.class) {
|
||||
if (instance == null) {
|
||||
instance = new CloudPoiManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void generateDefault() {
|
||||
if (poiWrapper.isEmpty()) {
|
||||
poiWrapper.put(EventTypeEnum.TRAFFIC_CHECK.getPoiType(), new PoiWrapper(EventTypeEnum.TRAFFIC_CHECK.getPoiType(),
|
||||
R.drawable.module_common_icon_map_marker_road_check2, R.drawable.module_common_icon_map_marker_road_check2_white, "交通检查"));
|
||||
poiWrapper.put(EventTypeEnum.ROAD_CLOSED.getPoiType(), new PoiWrapper(EventTypeEnum.ROAD_CLOSED.getPoiType(),
|
||||
R.drawable.module_common_icon_map_marker_road_block_off2, R.drawable.module_common_icon_map_marker_road_block_off2_white, "封路"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ROAD_WORK.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ROAD_WORK.getPoiType(),
|
||||
R.drawable.module_common_icon_map_marker_road_work2, R.drawable.module_common_icon_map_marker_road_work2_white, "施工"));
|
||||
poiWrapper.put(EventTypeEnum.AI_ROAD_WORK.getPoiType(), new PoiWrapper(EventTypeEnum.AI_ROAD_WORK.getPoiType(),
|
||||
R.drawable.module_common_icon_map_marker_road_work2, R.drawable.module_common_icon_map_marker_road_work2_white, "施工"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_BLOCK_UP.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_BLOCK_UP.getPoiType(),
|
||||
R.drawable.module_common_icon_map_marker_road_block_up2, R.drawable.module_common_icon_map_marker_road_block_up2_white, "拥堵"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_PONDING.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_PONDING.getPoiType(),
|
||||
R.drawable.module_common_icon_map_marker_pondingl2, R.drawable.module_common_icon_map_marker_pondingl2_white, "积水"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_FOG.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_FOG.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_dark_frog2, R.drawable.module_common_ic_rc_dark_frog2_white, "浓雾"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ICE.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ICE.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_freeze2, R.drawable.module_common_ic_rc_freeze2_white, "结冰"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "事故"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_01.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_01.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "重大事故"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_02.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_02.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "特大事故"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_03.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_03.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "较大事故"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_04.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_04.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "一般事故"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_05.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_05.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "轻微事故"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_LIVING.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_LIVING.getPoiType(),
|
||||
R.drawable.module_common_icon_map_marker_living, R.drawable.module_common_icon_map_marker_living_white, "实时路况"));
|
||||
poiWrapper.put(EventTypeEnum.ILLEGAL_PARK_LIVING.getPoiType(), new PoiWrapper(EventTypeEnum.ILLEGAL_PARK_LIVING.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_illegal_park, R.drawable.module_common_ic_rc_illegal_park_white, "违章停车"));
|
||||
// 分享里用到的故障求助
|
||||
poiWrapper.put("9999", new PoiWrapper("9999",
|
||||
R.drawable.module_common_icon_seek_help, R.drawable.module_common_icon_seek_help, "故障求助"));
|
||||
}
|
||||
}
|
||||
|
||||
public void updateFromConfig(Context context) {
|
||||
generateDefault();
|
||||
// 从sp中获取config属性,将服务端配置内容合并到本地
|
||||
String config = SharedPrefsMgr.getInstance(context).getString("SHARE_BUTTON_CONFIG", "");
|
||||
if (!config.isEmpty()) {
|
||||
List<PoiWrapper> configWrappers = GsonUtil.arrayFromJson(config, PoiWrapper.class);
|
||||
CallerLogger.INSTANCE.d(TAG, "config: " + configWrappers);
|
||||
if (configWrappers != null) {
|
||||
for (PoiWrapper wrapper : configWrappers) {
|
||||
wrapper.setIconInfoRes(R.drawable.module_common_icon_map_marker_road_block_up2_white);
|
||||
wrapper.setIconRes(R.drawable.module_common_icon_map_marker_road_block_up2);
|
||||
if (poiWrapper.containsKey(wrapper.getPoiType())) {
|
||||
PoiWrapper defWrapper = poiWrapper.get(wrapper.getPoiType());
|
||||
if (defWrapper != null) {
|
||||
wrapper.setIconRes(defWrapper.getIconRes());
|
||||
wrapper.setIconInfoRes(defWrapper.getIconInfoRes());
|
||||
}
|
||||
}
|
||||
CallerLogger.INSTANCE.d(TAG, "put===" + wrapper);
|
||||
poiWrapper.put(wrapper.getPoiType(), wrapper);
|
||||
}
|
||||
} else {
|
||||
CallerLogger.INSTANCE.e(TAG, "解析configWrapper异常: " + config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public PoiWrapper getWrapperByPoiType(String poiType) {
|
||||
return poiWrapper.get(poiType);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.mogo.eagle.core.data.enums
|
||||
|
||||
import com.mogo.module.common.R
|
||||
import com.mogo.module.common.utils.CloudPoiManager
|
||||
import com.mogo.eagle.core.data.R
|
||||
import com.mogo.eagle.core.data.config.CloudPoiManager
|
||||
|
||||
|
||||
/**
|
||||
* OBU、V2N事件类型枚举类
|
||||
@@ -138,63 +139,63 @@ enum class EventTypeEnum(
|
||||
ALERT_ILLEGAL_PARK("99992"),
|
||||
|
||||
TYPE_USECASE_ID_EBW(
|
||||
ObuConstants.USE_CASE_ID.EBW.toString(),
|
||||
0x2A01.toString(),
|
||||
"紧急制动预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_emergency_brake,
|
||||
content = "前车急刹车",
|
||||
tts = "前车急刹车"
|
||||
),
|
||||
TYPE_USECASE_ID_FCW(
|
||||
ObuConstants.USE_CASE_ID.FCW.toString(),
|
||||
0x2A02.toString(),
|
||||
"前向碰撞预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
|
||||
content = "前车碰撞预警",
|
||||
tts = "小心前车"
|
||||
),
|
||||
TYPE_USECASE_ID_ICW(
|
||||
ObuConstants.USE_CASE_ID.ICW.toString(),
|
||||
0x2A03.toString(),
|
||||
"交叉路口碰撞预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
|
||||
content = "交叉路口碰撞预警",
|
||||
tts = "注意交叉路口车辆"
|
||||
),
|
||||
TYPE_USECASE_ID_CLW(
|
||||
ObuConstants.USE_CASE_ID.CLW.toString(),
|
||||
0x2A04.toString(),
|
||||
"车辆失控预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_vehicle_control,
|
||||
content = "前%s失控预警",
|
||||
tts = "小心%s失控车辆"
|
||||
),
|
||||
TYPE_USECASE_ID_DNPW(
|
||||
ObuConstants.USE_CASE_ID.DNPW.toString(),
|
||||
0x2A05.toString(),
|
||||
"逆向超车预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_reverse_overtaking,
|
||||
content = "逆向超车预警",
|
||||
tts = "注意对向来车"
|
||||
),
|
||||
TYPE_USECASE_ID_AVW(
|
||||
ObuConstants.USE_CASE_ID.AVW.toString(),
|
||||
0x2A06.toString(),
|
||||
"异常车辆提醒",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle,
|
||||
content = "%s车异常",
|
||||
tts = "小心%s异常车辆"
|
||||
),
|
||||
TYPE_USECASE_ID_BSW(
|
||||
ObuConstants.USE_CASE_ID.BSW.toString(),
|
||||
0x2A07.toString(),
|
||||
"盲区预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_blind_area_collision,
|
||||
content = "%s后盲区预警",
|
||||
tts = "注意%s后车辆"
|
||||
),
|
||||
TYPE_USECASE_ID_LCW(
|
||||
ObuConstants.USE_CASE_ID.LCW.toString(),
|
||||
0x2A08.toString(),
|
||||
"变道预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_reverse_overtaking,
|
||||
content = "%s向变道预警",
|
||||
tts = "注意%s后车辆"
|
||||
),//注意左后车辆/注意右后车辆
|
||||
TYPE_USECASE_ID_EVW(
|
||||
ObuConstants.USE_CASE_ID.EVW.toString(),
|
||||
0x2A09.toString(),
|
||||
"紧急车辆提醒",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_special_vehicle_access,
|
||||
content = "注意特种车辆通行",
|
||||
@@ -215,49 +216,49 @@ enum class EventTypeEnum(
|
||||
tts = "注意摩托车"
|
||||
),//摩托车碰撞预警
|
||||
TYPE_USECASE_ID_SLW(
|
||||
ObuConstants.USE_CASE_ID.SLW.toString(),
|
||||
0x2B04.toString(),
|
||||
"限速预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_over_speed,
|
||||
content = "已超速",
|
||||
tts = "已超速"
|
||||
),
|
||||
TYPE_USECASE_ID_LTA(
|
||||
ObuConstants.USE_CASE_ID.LTA.toString(),
|
||||
0x2B05.toString(),
|
||||
"左转辅助",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
|
||||
content = "左转碰撞预警",
|
||||
tts = "注意路口对向来车"
|
||||
),
|
||||
TYPE_USECASE_ID_HLW(
|
||||
ObuConstants.USE_CASE_ID.HLW.toString(),
|
||||
0x2B06.toString(),
|
||||
"道路危险情况预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_road_dangerous,
|
||||
content = "道路危险情况预警",
|
||||
tts = "前方路况危险,小心行驶"
|
||||
),//(如果能给出具体的类别,则播报具体危险类别)
|
||||
TYPE_USECASE_OPTIMAL_LANE(
|
||||
ObuConstants.USE_CASE_ID.HLW.toString(),
|
||||
0x2B06.toString(),
|
||||
"最优车道",
|
||||
poiTypeSrcVr = R.drawable.v2x_icon_live_logo,
|
||||
content = "最优车道",
|
||||
tts = "最优车道"
|
||||
),
|
||||
TYPE_USECASE_ID_IVS(
|
||||
ObuConstants.USE_CASE_ID.IVS.toString(),
|
||||
0x2B07.toString(),
|
||||
"车内标牌",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_road_construction,
|
||||
content = "车内标牌",
|
||||
tts = ""
|
||||
),
|
||||
TYPE_USECASE_ID_TJW(
|
||||
ObuConstants.USE_CASE_ID.TJW.toString(),
|
||||
0x2B08.toString(),
|
||||
"前方拥堵提醒",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_congestion,
|
||||
content = "前方%d米道路拥堵",
|
||||
tts = "前方拥堵,减速慢行"
|
||||
),
|
||||
TYPE_USECASE_ID_IVP(
|
||||
ObuConstants.USE_CASE_ID.IVP.toString(),
|
||||
0x2B09.toString(),
|
||||
"闯红灯预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_traffic_lights_red,
|
||||
content = "路口红灯,禁止通行",
|
||||
@@ -271,7 +272,7 @@ enum class EventTypeEnum(
|
||||
tts = "建议车速 %s KM/H"
|
||||
),
|
||||
TYPE_USECASE_ID_COC(
|
||||
ObuConstants.USE_CASE_ID.COC.toString(),
|
||||
0x2B0A.toString(),
|
||||
"预留",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle,
|
||||
content = "路况预警",
|
||||
@@ -355,7 +356,7 @@ enum class EventTypeEnum(
|
||||
tts = "路况复杂,减速慢行"
|
||||
),
|
||||
TYPE_ERROR(
|
||||
ObuConstants.USE_CASE_ID.ERROR.toString(),
|
||||
"-1",
|
||||
"未知/错误/异常",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle,
|
||||
content = "",
|
||||
|
||||
Reference in New Issue
Block a user