new#优化代码
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* created by wujifei on 2020/12/24 15:33
|
||||
* describe:基于目的地预判的道路事件
|
||||
*/
|
||||
public class V2XRecommendRouteEntity {
|
||||
private List<Double> toPoint; //目的地坐标
|
||||
private String formatAddress; //目的地地址
|
||||
private String tts; //播报内容
|
||||
|
||||
public List<Double> getToPoint() {
|
||||
return toPoint;
|
||||
}
|
||||
|
||||
public void setToPoint(List<Double> toPoint) {
|
||||
this.toPoint = toPoint;
|
||||
}
|
||||
|
||||
public String getFormatAddress() {
|
||||
return formatAddress;
|
||||
}
|
||||
|
||||
public void setFormatAddress(String formatAddress) {
|
||||
this.formatAddress = formatAddress;
|
||||
}
|
||||
|
||||
public String getTts() {
|
||||
tts = "主人,我发现前往" + formatAddress + "沿途有拥堵,推荐你导航最优路线,现在开启导航吗?";
|
||||
return tts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.module.common.entity
|
||||
|
||||
/**
|
||||
* created by wujifei on 2020/12/24 15:33
|
||||
* describe:基于目的地预判的道路事件
|
||||
*/
|
||||
data class V2XRecommendRouteEntity(
|
||||
var toPoint: List<Double>,//目的地坐标
|
||||
var formatAddress: String//目的地地址
|
||||
) {
|
||||
var tts: String? = null //播报内容
|
||||
get() {
|
||||
field = "主人,我发现前往" + formatAddress + "沿途有拥堵,推荐你导航最优路线,现在开启导航吗?"
|
||||
return field
|
||||
}
|
||||
private set
|
||||
}
|
||||
@@ -62,12 +62,12 @@ class V2XRecommendRouteVH(viewGroup: ViewGroup, v2XWindow: IV2XWindow<*>) : V2XB
|
||||
override fun initView(viewData: V2XEventShowEntity?) {
|
||||
viewData?.let {
|
||||
val markerLocation = MarkerLocation()
|
||||
markerLocation.lon = it.getV2XRecommendRouteEntity().getToPoint().get(0)
|
||||
markerLocation.lat = it.getV2XRecommendRouteEntity().getToPoint().get(1)
|
||||
markerLocation.lon = it.getV2XRecommendRouteEntity().toPoint.get(0)
|
||||
markerLocation.lat = it.getV2XRecommendRouteEntity().toPoint.get(1)
|
||||
mNoveltyInfo = MarkerExploreWay()
|
||||
mNoveltyInfo?.setLocation(markerLocation)
|
||||
mTvAddress!!.text = "前往 ${it.getV2XRecommendRouteEntity().getFormatAddress()}"
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(it.getV2XRecommendRouteEntity().getTts(), VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, null)
|
||||
mTvAddress!!.text = "前往 ${it.getV2XRecommendRouteEntity().formatAddress}"
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(it.getV2XRecommendRouteEntity().tts, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, null)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.mogo.map.search.geo.MogoGeocodeResult;
|
||||
import com.mogo.map.search.geo.MogoRegeocodeResult;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XRecommendRouteEntity;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.network.RefreshBody;
|
||||
@@ -714,22 +715,30 @@ public class V2XRefreshModel {
|
||||
}
|
||||
|
||||
private void sendBroadcast(V2XRoadDataRes v2XRoadDataRes) {
|
||||
boolean isSendRecommendRoute = false;
|
||||
if (v2XRoadDataRes.getResult().getPoiData() != null && v2XRoadDataRes.getResult().getPoiData().size() > 0) {
|
||||
V2XRecommendRouteEntity v2XRecommendRouteEntity = new V2XRecommendRouteEntity();
|
||||
v2XRecommendRouteEntity.setToPoint(v2XRoadDataRes.getResult().getTopPoint());
|
||||
v2XRecommendRouteEntity.setFormatAddress(v2XRoadDataRes.getResult().getFormatAddress());
|
||||
for (V2XRoadDataRes.ResultDTO.PoiDataDTO poiDataDTO : v2XRoadDataRes.getResult().getPoiData()) {
|
||||
if (!V2XPoiTypeEnum.FOURS_LIVING.equals(poiDataDTO.getPoiType())) {
|
||||
isSendRecommendRoute = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isSendRecommendRoute) {
|
||||
V2XMessageEntity<V2XRecommendRouteEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE);
|
||||
// 设置数据
|
||||
v2xMessageEntity.setContent(v2XRecommendRouteEntity);
|
||||
v2xMessageEntity.setContent(new V2XRecommendRouteEntity(v2XRoadDataRes.getResult().getTopPoint(), v2XRoadDataRes.getResult().getFormatAddress()));
|
||||
// 控制展示状态
|
||||
v2xMessageEntity.setShowState(true);
|
||||
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity);
|
||||
LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
|
||||
} else if (v2XRoadDataRes.getResult().getIllegalParkingData() != null && v2XRoadDataRes.getResult().getIllegalParkingData().size() > 0) {
|
||||
}
|
||||
|
||||
if (!isSendRecommendRoute && v2XRoadDataRes.getResult().getIllegalParkingData() != null && v2XRoadDataRes.getResult().getIllegalParkingData().size() > 0) {
|
||||
// TODO: 2020/12/30
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
private Button mBtnTriggerCallUserInfo;
|
||||
private Button mBtnTriggerEventUgc;
|
||||
private Button mBtnTriggerTrafficSearch;
|
||||
private Button mBtnTriggerPrejectedRoadEvent;
|
||||
private Button mBtnTriggerRecommendRouteEvent;
|
||||
private Button nBtnTriggerVR;
|
||||
|
||||
private Button btnTriggerRearVIPCarTip,
|
||||
@@ -118,7 +118,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
mBtnTriggerEventUgc = findViewById(R.id.btnTriggerEventUgc);
|
||||
mBtnTriggerCallUserInfo = findViewById(R.id.btnTriggerCallUserInfo);
|
||||
mBtnTriggerTrafficSearch = findViewById(R.id.btnTriggerTrafficSearch);
|
||||
mBtnTriggerPrejectedRoadEvent = findViewById(R.id.btnTriggerPrejectedRoadEvent);
|
||||
mBtnTriggerRecommendRouteEvent = findViewById(R.id.btnTriggerRecommendRouteEvent);
|
||||
nBtnTriggerVR = findViewById(R.id.btnTriggerVR);
|
||||
|
||||
switch (showType) {
|
||||
@@ -279,7 +279,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
|
||||
mBtnTriggerTrafficSearch.setOnClickListener(v -> V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus());
|
||||
|
||||
mBtnTriggerPrejectedRoadEvent.setOnClickListener(view -> {
|
||||
mBtnTriggerRecommendRouteEvent.setOnClickListener(view -> {
|
||||
V2XServiceManager.getV2XRefreshModel().queryRoadData("ZD802C1938L10797");
|
||||
});
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTriggerPrejectedRoadEvent"
|
||||
android:id="@+id/btnTriggerRecommendRouteEvent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
|
||||
Reference in New Issue
Block a user