完成了周边事件的基础功能。还差数据通讯的功能

This commit is contained in:
董宏宇
2020-08-11 18:46:40 +08:00
parent 18aa31f304
commit d8f38dd90d
8 changed files with 289 additions and 148 deletions

View File

@@ -118,6 +118,16 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
@Override
public void initView(V2XEventShowEntity v2XEventShowEntity) {
mV2XPushMessageEntity = v2XEventShowEntity.getV2XPushMessageEntity();
try {
MarkerLocation markerLocation = new MarkerLocation();
markerLocation.setLon(mV2XPushMessageEntity.getLon());
markerLocation.setLat(mV2XPushMessageEntity.getLat());
mNoveltyInfo = new MarkerExploreWay();
mNoveltyInfo.setLocation(markerLocation);
} catch (Exception e) {
e.printStackTrace();
}
// 只有自研车机才会 有车聊聊通话
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
// 判断是否可以打电话
@@ -143,7 +153,7 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
mUserInfo.setUserHead(mV2XPushMessageEntity.getHeadImgUrl());
mUserInfo.setUserName(mV2XPushMessageEntity.getDisplayName());
mUserInfo.setGender(mV2XPushMessageEntity.getSex());
mUserInfo.setAge(30);
mUserInfo.setAge(mV2XPushMessageEntity.getAge());
mNoveltyInfo.setUserInfo(mUserInfo);
triggerCallChart(mNoveltyInfo);
} catch (Exception e) {
@@ -152,16 +162,6 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
}
});
}
try {
MarkerLocation markerLocation = new MarkerLocation();
markerLocation.setLon(mV2XPushMessageEntity.getLon());
markerLocation.setLat(mV2XPushMessageEntity.getLat());
mNoveltyInfo = new MarkerExploreWay();
mNoveltyInfo.setLocation(markerLocation);
} catch (Exception e) {
e.printStackTrace();
}
try {
if (!TextUtils.isEmpty(mV2XPushMessageEntity.getHeadImgUrl())) {
V2XServiceManager.getImageLoader()

View File

@@ -40,43 +40,47 @@ public class V2XScenarioHistoryIllegalParkVH extends V2XBaseViewHolder<V2XHistor
public V2XScenarioHistoryIllegalParkVH(@NonNull ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_scennario_history, viewGroup, false));
mTvAddress = (TextView) itemView.findViewById(R.id.tvAddress);
mTvIllegalNum = (TextView) itemView.findViewById(R.id.tvIllegalNum);
mTvAddress = itemView.findViewById(R.id.tvAddress);
mTvIllegalNum = itemView.findViewById(R.id.tvIllegalNum);
mTagEventType = (TextView) itemView.findViewById(R.id.tagEventType);
mTagEventEvaluate = (TextView) itemView.findViewById(R.id.tagEventEvaluate);
mTagEventType = itemView.findViewById(R.id.tagEventType);
mTagEventEvaluate = itemView.findViewById(R.id.tagEventEvaluate);
mLlIllegalParkingLike = (HeartLikeView) itemView.findViewById(R.id.llIllegalParkingLike);
mLlIllegalParkingUnLike = (HeartUnLikeView) itemView.findViewById(R.id.llIllegalParkingUnLike);
mLlIllegalParkingLike = itemView.findViewById(R.id.llIllegalParkingLike);
mLlIllegalParkingUnLike = itemView.findViewById(R.id.llIllegalParkingUnLike);
}
@Override
public void initView(V2XHistoryScenarioData viewData) {
mOldScenarioData = viewData;
mExploreWay = GsonUtil.objectFromJson(viewData.getEventJsonData(), MarkerExploreWay.class);
mTvAddress.setText(mExploreWay.getAddr());
try {
mTvIllegalNum.setText("违章人数:" + (int) mExploreWay.getItems().get(0).getIllegalCount());
mOldScenarioData = viewData;
mExploreWay = GsonUtil.objectFromJson(viewData.getEventJsonData(), MarkerExploreWay.class);
mTvAddress.setText(mExploreWay.getAddr());
try {
mTvIllegalNum.setText("违章人数:" + (int) mExploreWay.getItems().get(0).getIllegalCount());
} catch (Exception e) {
e.printStackTrace();
}
if (!viewData.isDispose()) {
hideControlButton(View.VISIBLE);
} else {
hideControlButton(View.GONE);
}
mLlIllegalParkingLike.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈有用");
roadReportTrue();
});
mLlIllegalParkingUnLike.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈无用");
roadReportErr();
});
} catch (Exception e) {
e.printStackTrace();
}
if (!viewData.isDispose()) {
hideControlButton(View.VISIBLE);
} else {
hideControlButton(View.GONE);
}
mLlIllegalParkingLike.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈有用");
roadReportTrue();
});
mLlIllegalParkingUnLike.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈无用");
roadReportErr();
});
}
void hideControlButton(int gone) {
@@ -87,14 +91,18 @@ public class V2XScenarioHistoryIllegalParkVH extends V2XBaseViewHolder<V2XHistor
@Override
public void delayedCloseWindow() {
hideControlButton(View.GONE);
// 进行数据库存储
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
v2XHistoryScenarioData.setDispose(true);
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData);
try {
hideControlButton(View.GONE);
// 进行数据库存储
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
v2XHistoryScenarioData.setDispose(true);
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData);
} catch (Exception e) {
e.printStackTrace();
}
}
/**

View File

@@ -1,30 +1,174 @@
package com.mogo.module.v2x.adapter.holder;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerUserInfo;
import com.mogo.module.common.entity.V2XHistoryScenarioData;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.fragment.V2XEventPanelFragment;
import com.mogo.module.v2x.utils.ChartingUtil;
import com.mogo.module.v2x.utils.SpanUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.imageloader.MogoImageView;
import com.mogo.utils.network.utils.GsonUtil;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
/**
* 出行动态中的他人故障求助
*
* @author donghongyu
*/
public class V2XScenarioHistoryOtherSeekHelpVH extends V2XBaseViewHolder<V2XHistoryScenarioData> {
private TextView mTagEventType;
private TextView mTagEventEvaluate;
private MogoImageView mIvFaultHelpHead;
private TextView mTvFaultHelpName;
private TextView mTvFaultHelpEventTime;
private TextView mTvFaultHelpDistance;
private ImageView mIvFaultHelpEventCall;
private ImageView mIvFaultHelpEventNavi;
private MarkerExploreWay mNoveltyInfo;
// 上传事件的用户信息
private MarkerUserInfo mUserInfo = new MarkerUserInfo();
private V2XHistoryScenarioData mOldScenarioData;
public V2XScenarioHistoryOtherSeekHelpVH(@NonNull ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_scennario_history_other_help, viewGroup, false));
mTagEventType = itemView.findViewById(R.id.tagEventType);
mTagEventEvaluate = itemView.findViewById(R.id.tagEventEvaluate);
mIvFaultHelpHead = itemView.findViewById(R.id.ivFaultHelpHead);
mTvFaultHelpName = itemView.findViewById(R.id.tvFaultHelpName);
mTvFaultHelpEventTime = itemView.findViewById(R.id.tvFaultHelpEventTime);
mTvFaultHelpDistance = itemView.findViewById(R.id.tvFaultHelpDistance);
mIvFaultHelpEventCall = itemView.findViewById(R.id.ivFaultHelpEventCall);
mIvFaultHelpEventNavi = itemView.findViewById(R.id.ivFaultHelpEventNavi);
}
@Override
public void initView(V2XHistoryScenarioData viewData) {
try {
mOldScenarioData = viewData;
V2XPushMessageEntity xPushMessageEntity = GsonUtil.objectFromJson(viewData.getEventJsonData(), V2XPushMessageEntity.class);
if (!viewData.isDispose()) {
hideControlButton(View.VISIBLE);
} else {
hideControlButton(View.GONE);
}
mTvFaultHelpName.setText(xPushMessageEntity.getDisplayName());
if (!TextUtils.isEmpty(xPushMessageEntity.getHeadImgUrl())) {
V2XServiceManager.getImageLoader()
.displayImage(xPushMessageEntity.getHeadImgUrl(), mIvFaultHelpHead);
}
SpanUtils.with(mTvFaultHelpDistance)
.append("" + (int) xPushMessageEntity.getDistance())
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
.append("m")
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
.create();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA);
String eventTime = String.format("%s发布求助信息",
sdf.format(new Date(xPushMessageEntity.getCreateTime())));
mTvFaultHelpEventTime.setText(eventTime);
try {
MarkerLocation markerLocation = new MarkerLocation();
markerLocation.setLon(xPushMessageEntity.getLon());
markerLocation.setLat(xPushMessageEntity.getLat());
mNoveltyInfo = new MarkerExploreWay();
mNoveltyInfo.setLocation(markerLocation);
} catch (Exception e) {
e.printStackTrace();
}
mIvFaultHelpEventNavi.setOnClickListener(v -> {
triggerStartNavi(mNoveltyInfo);
});
// 只有自研车机才会 有车聊聊通话
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
// 判断是否可以打电话
ChartingUtil.isCanCall(b -> {
if (b) {
// 判断是否可以打电话
ChartingUtil.isOnLine(xPushMessageEntity.getSn(), b1 -> {
if (b1) {
mIvFaultHelpEventCall.setVisibility(VISIBLE);
} else {
mIvFaultHelpEventCall.setVisibility(GONE);
}
});
} else {
mIvFaultHelpEventCall.setVisibility(GONE);
}
});
mIvFaultHelpEventCall.setOnClickListener(v -> {
if (!V2XUtils.isFastClick()) {
try {
mUserInfo.setSn(xPushMessageEntity.getSn());
mUserInfo.setUserHead(xPushMessageEntity.getHeadImgUrl());
mUserInfo.setUserName(xPushMessageEntity.getDisplayName());
mUserInfo.setGender(xPushMessageEntity.getSex());
mUserInfo.setAge(xPushMessageEntity.getAge());
mNoveltyInfo.setUserInfo(mUserInfo);
triggerCallChart(mNoveltyInfo);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void delayedCloseWindow() {
try {
hideControlButton(View.GONE);
// 进行数据库存储
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
v2XHistoryScenarioData.setDispose(true);
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData);
V2XEventPanelFragment.Companion.getInstance().hidePanel();
} catch (Exception e) {
e.printStackTrace();
}
}
void hideControlButton(int gone) {
mTagEventEvaluate.setVisibility(gone);
}
}

View File

@@ -42,47 +42,51 @@ public class V2XScenarioHistoryRoadEventVH extends V2XBaseViewHolder<V2XHistoryS
public V2XScenarioHistoryRoadEventVH(@NonNull ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_scennario_history, viewGroup, false));
mTvAddress = (TextView) itemView.findViewById(R.id.tvAddress);
mTvIllegalNum = (TextView) itemView.findViewById(R.id.tvIllegalNum);
mIvIconP = (ImageView) itemView.findViewById(R.id.ivIconP);
mTagEventType = (TextView) itemView.findViewById(R.id.tagEventType);
mTagEventEvaluate = (TextView) itemView.findViewById(R.id.tagEventEvaluate);
mTvAddress = itemView.findViewById(R.id.tvAddress);
mTvIllegalNum = itemView.findViewById(R.id.tvIllegalNum);
mIvIconP = itemView.findViewById(R.id.ivIconP);
mTagEventType = itemView.findViewById(R.id.tagEventType);
mTagEventEvaluate = itemView.findViewById(R.id.tagEventEvaluate);
mLlIllegalParkingLike = (HeartLikeView) itemView.findViewById(R.id.llIllegalParkingLike);
mLlIllegalParkingUnLike = (HeartUnLikeView) itemView.findViewById(R.id.llIllegalParkingUnLike);
mLlIllegalParkingLike = itemView.findViewById(R.id.llIllegalParkingLike);
mLlIllegalParkingUnLike = itemView.findViewById(R.id.llIllegalParkingUnLike);
}
@Override
public void initView(V2XHistoryScenarioData viewData) {
mOldScenarioData = viewData;
mExploreWay = GsonUtil.objectFromJson(viewData.getEventJsonData(), MarkerExploreWay.class);
mIvIconP.setVisibility(View.GONE);
mTvAddress.setText(mExploreWay.getAddr());
mTagEventType.setText(EventTypeUtils.getPoiTypeStr(mExploreWay.getPoiType()));
try {
mTvIllegalNum.setText(mExploreWay.getUserInfo().getUserName() + " 的分享 时间:" +
TimeUtils.millis2String(mExploreWay.getGenerateTime(), "MM月dd日 HH:mm"));
mOldScenarioData = viewData;
mExploreWay = GsonUtil.objectFromJson(viewData.getEventJsonData(), MarkerExploreWay.class);
mIvIconP.setVisibility(View.GONE);
mTvAddress.setText(mExploreWay.getAddr());
mTagEventType.setText(EventTypeUtils.getPoiTypeStr(mExploreWay.getPoiType()));
try {
mTvIllegalNum.setText(mExploreWay.getUserInfo().getUserName() + " 的分享 时间:" +
TimeUtils.millis2String(mExploreWay.getGenerateTime(), "MM月dd日 HH:mm"));
} catch (Exception e) {
e.printStackTrace();
}
if (!viewData.isDispose()) {
hideControlButton(View.VISIBLE);
} else {
hideControlButton(View.GONE);
}
mLlIllegalParkingLike.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈有用");
roadReportTrue();
});
mLlIllegalParkingUnLike.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈无用");
roadReportErr();
});
} catch (Exception e) {
e.printStackTrace();
}
if (!viewData.isDispose()) {
hideControlButton(View.VISIBLE);
} else {
hideControlButton(View.GONE);
}
mLlIllegalParkingLike.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈有用");
roadReportTrue();
});
mLlIllegalParkingUnLike.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈无用");
roadReportErr();
});
}
void hideControlButton(int gone) {
@@ -93,14 +97,18 @@ public class V2XScenarioHistoryRoadEventVH extends V2XBaseViewHolder<V2XHistoryS
@Override
public void delayedCloseWindow() {
hideControlButton(View.GONE);
// 进行数据库存储
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
v2XHistoryScenarioData.setDispose(true);
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData,v2XHistoryScenarioData);
try {
hideControlButton(View.GONE);
// 进行数据库存储
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
v2XHistoryScenarioData.setDispose(true);
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData,v2XHistoryScenarioData);
} catch (Exception e) {
e.printStackTrace();
}
}
/**

View File

@@ -7,7 +7,6 @@ import androidx.annotation.Nullable;
import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
import com.mogo.commons.voice.VoicePreemptType;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XHistoryScenarioData;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.V2XConst;
@@ -34,7 +33,7 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
protected String TAG = "AbsV2XScenario";
private IV2XWindow mV2XWindow;
private IV2XButton mV2XButton;
private IV2XMarker<T> mV2XMarker;
private IV2XMarker mV2XMarker;
private IMoGoV2XStatusManager mV2XStatusManager;
private V2XMessageEntity<T> mV2XMessageEntity;
@@ -67,7 +66,7 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
this.mV2XWindow = mV2XWindow;
}
public IV2XMarker<T> getV2XMarker() {
public IV2XMarker getV2XMarker() {
return mV2XMarker;
}
@@ -105,7 +104,7 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
*
* @param markerExploreWay 要存储的场景
*/
public void saveLocalStory(int scenarioType ,MarkerExploreWay markerExploreWay) {
public void saveLocalStory(int scenarioType, Object markerExploreWay) {
try {
// 进行数据库存储
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();

View File

@@ -4,7 +4,6 @@ import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.module.common.entity.V2XHistoryScenarioData;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.scenario.IV2XScenarioManager;
@@ -16,8 +15,6 @@ import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario;
import com.mogo.module.v2x.scenario.scene.push.V2XPushEventScenario;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario;
import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpScenario;
import com.mogo.module.v2x.utils.TimeUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
@@ -78,7 +75,6 @@ public class V2XScenarioManager implements IV2XScenarioManager {
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
mV2XScenario = V2XSeekHelpScenario.getInstance();
saveLocalStory(v2XMessageEntity);
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
mV2XScenario = V2XFatigueDrivingScenario.getInstance();
@@ -114,23 +110,4 @@ public class V2XScenarioManager implements IV2XScenarioManager {
});
}
}
/**
* 存储本地数据
*
* @param v2XMessageEntity 要存储的场景
*/
void saveLocalStory(V2XMessageEntity v2XMessageEntity) {
try {
// 进行数据库存储
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
v2XHistoryScenarioData.setScenarioType(v2XMessageEntity.getType());
v2XHistoryScenarioData.setTriggerTime(TimeUtils.getNowMills());
v2XHistoryScenarioData.setDispose(false);
v2XHistoryScenarioData.setEventJsonData(GsonUtil.jsonFromObject(v2XMessageEntity.getContent()));
V2XSQLiteUtils.getScenarioHistoryDao().insert(v2XHistoryScenarioData);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -5,9 +5,9 @@ import android.view.ViewGroup;
import androidx.annotation.Nullable;
import com.mogo.commons.voice.AIAssist;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
@@ -50,25 +50,45 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
}
private List<V2XMarkerEntity> mMarkerEntity;
private V2XPushMessageEntity mV2XPushMessageEntity;
@Override
public void init(@Nullable V2XMessageEntity<List<V2XMarkerEntity>> v2XMessageEntity) {
setV2XMessageEntity(v2XMessageEntity);
try {
setV2XMessageEntity(v2XMessageEntity);
// 广播给ADAS和Launcher卡片
V2XRoadEventEntity eventEntity = new V2XRoadEventEntity();
eventEntity.setPoiType(V2XPoiTypeEnum.ALERT_CAR_TROUBLE_WARNING + "");
eventEntity.setExpireTime(30000);
eventEntity.setTts("发现其他车主的求助信息");
eventEntity.setAlarmContent("其他车主求助");
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), eventEntity);
// 广播给ADAS和Launcher卡片
V2XRoadEventEntity eventEntity = new V2XRoadEventEntity();
eventEntity.setPoiType(V2XPoiTypeEnum.ALERT_CAR_TROUBLE_WARNING + "");
eventEntity.setExpireTime(30000);
eventEntity.setTts("发现其他车主的求助信息");
eventEntity.setAlarmContent("其他车主求助");
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), eventEntity);
if (V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
if (getV2XMessageEntity() != null &&
!V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpWindowShow()) {
mMarkerEntity = getV2XMessageEntity().getContent();
show();
mMarkerEntity = getV2XMessageEntity().getContent();
V2XMarkerEntity markerEntity = mMarkerEntity.get(0);
mV2XPushMessageEntity = new V2XPushMessageEntity();
mV2XPushMessageEntity.setLon(markerEntity.getLon());
mV2XPushMessageEntity.setLat(markerEntity.getLat());
mV2XPushMessageEntity.setDisplayName(markerEntity.getUserInfo().getDisplayName());
mV2XPushMessageEntity.setHeadImgUrl(markerEntity.getUserInfo().getHeadImgUrl());
mV2XPushMessageEntity.setSex(markerEntity.getUserInfo().getSex());
mV2XPushMessageEntity.setSn(markerEntity.getUserInfo().getSn());
mV2XPushMessageEntity.setCreateTime(markerEntity.getCreateTime());
mV2XPushMessageEntity.setDistance(markerEntity.getDistance());
mV2XPushMessageEntity.setExpireTime(20000);
saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING, mV2XPushMessageEntity);
if (V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
if (getV2XMessageEntity() != null &&
!V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpWindowShow()) {
show();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -89,7 +109,7 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
V2XServiceManager
.getMogoTopViewManager()
.addView(getV2XWindow().getView(), layoutParams, this);
getV2XWindow().show(mMarkerEntity);
getV2XWindow().show(mV2XPushMessageEntity);
}
}

View File

@@ -18,7 +18,6 @@ import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.utils.logger.Logger;
@@ -35,7 +34,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : 他人发起的故障求助
* version: 1.0
*/
public class V2XSeekHelpWindow extends ConstraintLayout implements IV2XWindow<List<V2XMarkerEntity>> {
public class V2XSeekHelpWindow extends ConstraintLayout implements IV2XWindow<V2XPushMessageEntity> {
private static final String TAG = "V2XSeekHelpWindow";
// 展示列表
@@ -96,32 +95,18 @@ public class V2XSeekHelpWindow extends ConstraintLayout implements IV2XWindow<Li
}
@Override
public void show(List<V2XMarkerEntity> entityList) {
if (entityList != null && !entityList.isEmpty()) {
V2XMarkerEntity markerEntity = entityList.get(0);
mV2XPushMessageEntity = new V2XPushMessageEntity();
mV2XPushMessageEntity.setLon(markerEntity.getLon());
mV2XPushMessageEntity.setLat(markerEntity.getLat());
mV2XPushMessageEntity.setDisplayName(markerEntity.getUserInfo().getDisplayName());
mV2XPushMessageEntity.setHeadImgUrl(markerEntity.getUserInfo().getHeadImgUrl());
mV2XPushMessageEntity.setSex(markerEntity.getUserInfo().getSex());
mV2XPushMessageEntity.setSn(markerEntity.getUserInfo().getSn());
mV2XPushMessageEntity.setCreateTime(markerEntity.getCreateTime());
mV2XPushMessageEntity.setDistance(markerEntity.getDistance());
mV2XPushMessageEntity.setExpireTime(20000);
public void show(V2XPushMessageEntity xPushMessageEntity) {
if (xPushMessageEntity != null) {
mV2XPushMessageEntity = xPushMessageEntity;
// 清空数据
mItemList.clear();
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
v2XEventShowEntity.setV2XPushMessageEntity(mV2XPushMessageEntity);
v2XEventShowEntity.setV2XPushMessageEntity(xPushMessageEntity);
v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING);
mItemList.add(v2XEventShowEntity);
// 刷新列表
mV2XRoadEventAdapter.notifyDataSetChanged();
countDownV2XEvent();
}
}