This commit is contained in:
zhongchao
2022-03-31 20:36:35 +08:00
parent d02ce90e32
commit 2bc4a8b6ee
156 changed files with 19912 additions and 2719 deletions

View File

@@ -1,126 +0,0 @@
package com.mogo.module.common.drawer;
import android.view.animation.LinearInterpolator;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import com.mogo.map.MogoMarkerManager;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerShowEntity;
import java.util.List;
import java.util.Map;
public
/**
* @author congtaowang
* @since 2020/10/28
*
* 描述
*/
class RoadConditionDrawer {
private static final String TAG = "RoadConditionDrawer";
private static volatile RoadConditionDrawer sInstance;
private RoadConditionDrawer() {
}
public static RoadConditionDrawer getInstance() {
if ( sInstance == null ) {
synchronized ( RoadConditionDrawer.class ) {
if ( sInstance == null ) {
sInstance = new RoadConditionDrawer();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
/**
* 探路数据
*
* @param exploreWayList
*/
public void drawRoadConditionMarker( List< MarkerExploreWay > exploreWayList, int maxAmount, IMogoMarkerClickListener listener ) {
// 将数据同步给探路,避免探路每次 perform 的时候去拉取,造成消耗
if ( exploreWayList == null || exploreWayList.isEmpty() ) {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers( ModuleNames.CARD_TYPE_ROAD_CONDITION );
return;
}
int size = MarkerDrawer.getInstance().getAppropriateSize( maxAmount, exploreWayList );
Map< String, IMogoMarker > existCarMap = MarkerDrawer.getInstance().purgeMarkerData( exploreWayList, ModuleNames.CARD_TYPE_ROAD_CONDITION );
for ( int i = 0; i < size; i++ ) {
MarkerExploreWay markerExploreWay = exploreWayList.get( i );
if ( !markerExploreWay.getCanLive() ) {
MarkerLocation markerLocation = markerExploreWay.getLocation();
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setBindObj( markerExploreWay );
markerShowEntity.setMarkerLocation( markerLocation );
markerShowEntity.setMarkerType( markerExploreWay.getType() );
markerShowEntity.setTextContent( markerExploreWay.getAddr() );
String sn = MarkerDrawer.getInstance().getPrimaryKeyFromEntity( markerExploreWay );
IMogoMarker mogoMarker = existCarMap.get( sn );
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
try {
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, true, MarkerDrawer.MARKER_Z_INDEX_HIGH, listener );
// mogoMarker.setInfoWindowAdapter( new RoadConditionInfoWindow3DAdapter( markerShowEntity, AbsMogoApplication.getApp(), mogoMarker.getMogoMarkerOptions() ) );
// mogoMarker.showInfoWindow();
} else {
post2AddAndStartAnimation( markerShowEntity, i * 100L, listener );
}
} catch ( Exception e ) {
e.printStackTrace();
}
}
}
}
}
private void post2AddAndStartAnimation( MarkerShowEntity entity, long delay, IMogoMarkerClickListener listener ) {
if ( entity == null ) {
return;
}
WorkThreadHandler.getInstance().postDelayed( () -> {
if ( entity == null ) {
return;
}
IMogoMarker marker = MarkerDrawer.getInstance().drawMapMarkerImpl( entity, MarkerDrawer.MARKER_Z_INDEX_HIGH, listener );
if ( marker == null ) {
return;
}
marker.startScaleAnimationWithAlpha( 0, 1.2f, 0, 1.2f, 0f, 1f, 300, new LinearInterpolator(), new OnMarkerAnimationListener() {
@Override
public void onAnimStart() {
}
@Override
public void onAnimEnd() {
if ( marker == null || marker.isDestroyed() ) {
return;
}
marker.startScaleAnimation( 1.2f, 1, 1.2f, 1, 100, new LinearInterpolator(), null );
}
} );
}, delay );
}
}

View File

@@ -13,8 +13,6 @@ enum class EventTypeEnum(
val poiTypeSrcVr: Int = R.drawable.v2x_icon_live_logo,
val content: String = "", val tts: String = ""
) {
//加油站
GAS_STATION("10001", "加油站", content = "加油站附近", tts = "加油站"),
//交通检查
TRAFFIC_CHECK(
@@ -28,12 +26,6 @@ enum class EventTypeEnum(
"前方封路", "道路封路"
),
//商场打折
SHOP_DISCOUNT("10004", ""),
//4S店
FOURS_4S("10005", ""),
//施工
FOURS_ROAD_WORK(
"10006", "道路施工", "前方施工", R.drawable.icon_warning_v2x_road_construction,
@@ -52,9 +44,6 @@ enum class EventTypeEnum(
"前方道路积水", "道路积水"
),
//超市打折
FOURS_SHOP_FREE("10009", ""),
//浓雾
FOURS_FOG(
"10010", "出现浓雾", "浓雾预警", R.drawable.v2x_icon_nongwu_vr,
@@ -67,9 +56,6 @@ enum class EventTypeEnum(
"前方路面结冰", "路面结冰"
),
//停车场
FOURS_PARKING("10012", "停车场", "停车场", content = "停车场附近", tts = "停车场"),
//事故
FOURS_ACCIDENT(
"10013", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
@@ -106,9 +92,6 @@ enum class EventTypeEnum(
"前方交通事故", "交通事故"
),
//身边
FOURS_NEALY("10014", "身边事件"),
//实时路况
FOURS_LIVING("10015", "实时路况"),
@@ -139,13 +122,6 @@ enum class EventTypeEnum(
// 违章停车
ALERT_ILLEGAL_PARK("99992"),
// TODO 这里目前是演示DEMO会用到想着是打算商用先这么处理的
// 取快递
ALERT_TRAFFIC_EXPRESS("99995"),
// 顺风车
ALERT_TRAFFIC_TAXI("99994"),
TYPE_USECASE_ID_EBW(
ObuConstants.USE_CASE_ID.EBW.toString(),
"紧急制动预警",
@@ -385,24 +361,18 @@ enum class EventTypeEnum(
}
// 如果获取不到,那么就用本地默认的
return when (poiType) {
GAS_STATION.poiType -> GAS_STATION.poiTypeStr
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeStr
ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeStr
SHOP_DISCOUNT.poiType -> SHOP_DISCOUNT.poiTypeStr
FOURS_4S.poiType -> FOURS_4S.poiTypeStr
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeStr
FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeStr
FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeStr
FOURS_SHOP_FREE.poiType -> FOURS_SHOP_FREE.poiTypeStr
FOURS_FOG.poiType -> FOURS_FOG.poiTypeStr
FOURS_ICE.poiType -> FOURS_ICE.poiTypeStr
FOURS_PARKING.poiType -> FOURS_PARKING.poiTypeStr
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType,
FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType,
FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.poiTypeStr
FOURS_NEALY.poiType -> FOURS_NEALY.poiTypeStr
FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeStr
else -> "其它道路事件"
@@ -412,24 +382,18 @@ enum class EventTypeEnum(
@JvmStatic
fun getPoiTypeStrVr(poiType: String): String {
return when (poiType) {
GAS_STATION.poiType -> GAS_STATION.poiTypeStrVr
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeStrVr
ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeStrVr
SHOP_DISCOUNT.poiType -> SHOP_DISCOUNT.poiTypeStrVr
FOURS_4S.poiType -> FOURS_4S.poiTypeStrVr
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeStrVr
FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeStrVr
FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeStrVr
FOURS_SHOP_FREE.poiType -> FOURS_SHOP_FREE.poiTypeStrVr
FOURS_FOG.poiType -> FOURS_FOG.poiTypeStrVr
FOURS_ICE.poiType -> FOURS_ICE.poiTypeStrVr
FOURS_PARKING.poiType -> FOURS_PARKING.poiTypeStrVr
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType,
FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType,
FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.poiTypeStrVr
FOURS_NEALY.poiType -> FOURS_NEALY.poiTypeStrVr
FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeStrVr
else -> "其它道路事件"
}
@@ -440,20 +404,16 @@ enum class EventTypeEnum(
return when (poiType) {
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeSrcVr
ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeSrcVr
FOURS_4S.poiType -> FOURS_4S.poiTypeSrcVr
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeSrcVr
FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeSrcVr
FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeSrcVr
FOURS_SHOP_FREE.poiType -> FOURS_SHOP_FREE.poiTypeSrcVr
FOURS_FOG.poiType -> FOURS_FOG.poiTypeSrcVr
FOURS_ICE.poiType -> FOURS_ICE.poiTypeSrcVr
FOURS_PARKING.poiType -> FOURS_PARKING.poiTypeSrcVr
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType,
FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType,
FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.poiTypeSrcVr
FOURS_NEALY.poiType -> FOURS_NEALY.poiTypeSrcVr
FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeSrcVr
else -> R.drawable.v2x_icon_live_logo
}
@@ -465,8 +425,7 @@ enum class EventTypeEnum(
@JvmStatic
fun getPoiTypeBg(poiType: String, isVrMode: Boolean): Int {
return when (poiType) {
FOURS_PARKING.poiType, GAS_STATION.poiType -> R.drawable.bg_v2x_event_type_blue
FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType, FOURS_NEALY.poiType -> if (isVrMode) R.drawable.bg_v2x_event_type_orange_vr else R.drawable.bg_v2x_event_type_orange
FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType-> if (isVrMode) R.drawable.bg_v2x_event_type_orange_vr else R.drawable.bg_v2x_event_type_orange
TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType,
FOURS_PONDING.poiType, FOURS_FOG.poiType, FOURS_ICE.poiType, FOURS_ACCIDENT.poiType,
FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType,
@@ -480,9 +439,7 @@ enum class EventTypeEnum(
@JvmStatic
fun getPoiTypeBgForShareItem(poiType: String): Int {
return when (poiType) {
FOURS_PARKING.poiType, GAS_STATION.poiType ->
R.drawable.bg_v2x_event_type_blue
FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType, FOURS_NEALY.poiType ->
FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType ->
R.drawable.bg_v2x_event_type_orange
TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType,
FOURS_ROAD_WORK.poiType, FOURS_PONDING.poiType,
@@ -531,8 +488,6 @@ enum class EventTypeEnum(
@JvmStatic
fun getTts(poiType: String?): String {
return when (poiType) {
FOURS_PARKING.poiType -> FOURS_PARKING.tts
GAS_STATION.poiType -> GAS_STATION.tts
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.tts
ROAD_CLOSED.poiType -> ROAD_CLOSED.tts
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.tts
@@ -549,8 +504,6 @@ enum class EventTypeEnum(
@JvmStatic
fun getTtsWithFeedback(poiType: String?): String {
return when (poiType) {
FOURS_PARKING.poiType -> "有停车场"
GAS_STATION.poiType -> "有加油站"
TRAFFIC_CHECK.poiType -> "交通检查"
ROAD_CLOSED.poiType -> "封路"
FOURS_ROAD_WORK.poiType -> "施工"
@@ -567,8 +520,6 @@ enum class EventTypeEnum(
@JvmStatic
fun getAlarmContent(poiType: String?): String {
return when (poiType) {
FOURS_PARKING.poiType -> FOURS_PARKING.content
GAS_STATION.poiType -> GAS_STATION.content
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.content
ROAD_CLOSED.poiType -> ROAD_CLOSED.content
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.content
@@ -720,14 +671,6 @@ enum class EventTypeEnum(
ALERT_CAR_TROUBLE_WARNING.poiType -> {
R.drawable.icon_car_red
}
// 取快递
ALERT_TRAFFIC_EXPRESS.poiType -> {
R.drawable.v_to_x_marker_express
}
// 顺风车
ALERT_TRAFFIC_TAXI.poiType -> {
R.drawable.v_to_x_marker_taxi
}
else -> 0
}
}

View File

@@ -22,7 +22,7 @@ import java.util.Map;
public class CloudPoiManager {
private static final String TAG = "CloudPoiManager";
private Map<String, PoiWrapper> poiWrapper = new ArrayMap<>();
private final Map<String, PoiWrapper> poiWrapper = new ArrayMap<>();
private static CloudPoiManager instance = null;
public static CloudPoiManager getInstance() {
@@ -38,30 +38,20 @@ public class CloudPoiManager {
public void generateDefault() {
if (poiWrapper.isEmpty()) {
poiWrapper.put(EventTypeEnum.GAS_STATION.getPoiType(), new PoiWrapper(EventTypeEnum.GAS_STATION.getPoiType(), R.drawable.module_common_icon_map_marker_refuel,
R.drawable.module_common_icon_map_marker_refuel, "加油站"));
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.SHOP_DISCOUNT.getPoiType(), new PoiWrapper(EventTypeEnum.SHOP_DISCOUNT.getPoiType(),
R.drawable.module_common_icon_map_marker_shop_discount, R.drawable.module_common_icon_map_marker_shop_discount, "商场打折"));
poiWrapper.put(EventTypeEnum.FOURS_4S.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_4S.getPoiType(),
R.drawable.module_common_icon_map_marker_4s, R.drawable.module_common_icon_map_marker_4s, "4S店"));
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.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_SHOP_FREE.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_SHOP_FREE.getPoiType(),
R.drawable.module_common_icon_map_marker_shop, R.drawable.module_common_icon_map_marker_shop, "超时打折"));
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_PARKING.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_PARKING.getPoiType(),
R.drawable.module_common_ic_rc_parking2, R.drawable.module_common_ic_rc_parking2, "停车场"));
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(),
@@ -74,8 +64,6 @@ public class CloudPoiManager {
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_NEALY.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_NEALY.getPoiType(),
R.drawable.module_common_icon_map_marker_shear_news, R.drawable.module_common_icon_map_marker_shear_news, "身边"));
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(),