new#基于目的地预判的道路事件提醒、路线推荐
This commit is contained in:
@@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class V2XRecommendRouteEntity {
|
public class V2XRecommendRouteEntity {
|
||||||
private List<Double> toPoint;
|
private List<Double> toPoint;
|
||||||
|
private String formatAddress;
|
||||||
|
|
||||||
public List<Double> getToPoint() {
|
public List<Double> getToPoint() {
|
||||||
return toPoint;
|
return toPoint;
|
||||||
@@ -16,4 +17,12 @@ public class V2XRecommendRouteEntity {
|
|||||||
public void setToPoint(List<Double> toPoint) {
|
public void setToPoint(List<Double> toPoint) {
|
||||||
this.toPoint = toPoint;
|
this.toPoint = toPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFormatAddress() {
|
||||||
|
return formatAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormatAddress(String formatAddress) {
|
||||||
|
this.formatAddress = formatAddress;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,16 @@
|
|||||||
package com.mogo.module.v2x.adapter.holder;
|
package com.mogo.module.v2x.adapter.holder;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.mogo.map.location.MogoLocation;
|
|
||||||
import com.mogo.map.search.geo.IMogoGeoSearchListener;
|
|
||||||
import com.mogo.map.search.geo.MogoGeocodeResult;
|
|
||||||
import com.mogo.map.search.geo.MogoRegeocodeResult;
|
|
||||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||||
import com.mogo.module.common.entity.MarkerLocation;
|
import com.mogo.module.common.entity.MarkerLocation;
|
||||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||||
import com.mogo.module.v2x.R;
|
import com.mogo.module.v2x.R;
|
||||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||||
import com.mogo.module.v2x.utils.LocationUtils;
|
|
||||||
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
|
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
|
||||||
import com.mogo.module.v2x.voice.V2XVoiceConstants;
|
import com.mogo.module.v2x.voice.V2XVoiceConstants;
|
||||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||||
@@ -48,32 +41,11 @@ public class V2XRecommendRouteVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
|||||||
markerLocation.setLat(v2XEventShowEntity.getV2XRecommendRouteEntity().getToPoint().get(1));
|
markerLocation.setLat(v2XEventShowEntity.getV2XRecommendRouteEntity().getToPoint().get(1));
|
||||||
mNoveltyInfo = new MarkerExploreWay();
|
mNoveltyInfo = new MarkerExploreWay();
|
||||||
mNoveltyInfo.setLocation(markerLocation);
|
mNoveltyInfo.setLocation(markerLocation);
|
||||||
MogoLocation mogoLocation = new MogoLocation();
|
mTvAddress.setText("前往 " + v2XEventShowEntity.getV2XRecommendRouteEntity().getFormatAddress());
|
||||||
mogoLocation.setLongitude(v2XEventShowEntity.getV2XRecommendRouteEntity().getToPoint().get(0));
|
|
||||||
mogoLocation.setLatitude(v2XEventShowEntity.getV2XRecommendRouteEntity().getToPoint().get(1));
|
|
||||||
getLocationInfo(mogoLocation);
|
|
||||||
registerUnwakeNavi();
|
registerUnwakeNavi();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取定位相关信息
|
|
||||||
*/
|
|
||||||
private void getLocationInfo(MogoLocation location) {
|
|
||||||
// 定位当前位置是否是高速
|
|
||||||
LocationUtils.geoCodeSearch(location, new IMogoGeoSearchListener() {
|
|
||||||
@Override
|
|
||||||
public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) {
|
|
||||||
mTvAddress.setText("前往 " + regeocodeResult.getRegeocodeAddress().getFormatAddress());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onGeocodeSearched(MogoGeocodeResult geocodeResult) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private V2XVoiceCallbackListener mStartNavi = (command, intent) -> {
|
private V2XVoiceCallbackListener mStartNavi = (command, intent) -> {
|
||||||
try {
|
try {
|
||||||
triggerStartNavi(mNoveltyInfo);
|
triggerStartNavi(mNoveltyInfo);
|
||||||
@@ -87,6 +59,7 @@ public class V2XRecommendRouteVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
|||||||
try {
|
try {
|
||||||
//取消导航
|
//取消导航
|
||||||
unRegisterUnwakeNavi();
|
unRegisterUnwakeNavi();
|
||||||
|
delayedCloseWindow();
|
||||||
Log.d("V2XRecommendRouteVH", "cancleNavi ------");
|
Log.d("V2XRecommendRouteVH", "cancleNavi ------");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -30,20 +30,18 @@ public class V2XRoadDataRes extends BaseData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class ResultDTO {
|
public static class ResultDTO {
|
||||||
|
private String formatAddress;
|
||||||
private List<Double> fromPoint;
|
private List<Double> fromPoint;
|
||||||
private List<Double> topPoint;
|
private List<Double> topPoint;
|
||||||
private List<PoiDataDTO> poiData;
|
private List<PoiDataDTO> poiData;
|
||||||
private List<IllegalParkingDataDTO> illegalParkingData;
|
private List<IllegalParkingDataDTO> illegalParkingData;
|
||||||
|
|
||||||
@Override
|
public String getFormatAddress() {
|
||||||
public String toString() {
|
return formatAddress;
|
||||||
return "ResultDTO{" +
|
}
|
||||||
"fromPoint=" + fromPoint +
|
|
||||||
", topPoint=" + topPoint +
|
public void setFormatAddress(String formatAddress) {
|
||||||
", poiData=" + poiData +
|
this.formatAddress = formatAddress;
|
||||||
", illegalParkingData=" + illegalParkingData +
|
|
||||||
'}';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Double> getFromPoint() {
|
public List<Double> getFromPoint() {
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ import com.mogo.commons.network.SubscribeImpl;
|
|||||||
import com.mogo.commons.network.Utils;
|
import com.mogo.commons.network.Utils;
|
||||||
import com.mogo.map.MogoLatLng;
|
import com.mogo.map.MogoLatLng;
|
||||||
import com.mogo.map.location.MogoLocation;
|
import com.mogo.map.location.MogoLocation;
|
||||||
|
import com.mogo.map.search.geo.IMogoGeoSearchListener;
|
||||||
|
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.MarkerResponse;
|
||||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||||
import com.mogo.module.common.entity.V2XRecommendRouteEntity;
|
import com.mogo.module.common.entity.V2XRecommendRouteEntity;
|
||||||
@@ -30,6 +33,7 @@ import com.mogo.module.v2x.entity.net.V2XRoadDataRes;
|
|||||||
import com.mogo.module.v2x.entity.net.V2XSeekHelpRes;
|
import com.mogo.module.v2x.entity.net.V2XSeekHelpRes;
|
||||||
import com.mogo.module.v2x.entity.net.V2XStrategyPushRes;
|
import com.mogo.module.v2x.entity.net.V2XStrategyPushRes;
|
||||||
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
|
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
|
||||||
|
import com.mogo.module.v2x.utils.LocationUtils;
|
||||||
import com.mogo.module.v2x.utils.V2XUtils;
|
import com.mogo.module.v2x.utils.V2XUtils;
|
||||||
import com.mogo.service.MogoServicePaths;
|
import com.mogo.service.MogoServicePaths;
|
||||||
import com.mogo.service.network.IMogoNetwork;
|
import com.mogo.service.network.IMogoNetwork;
|
||||||
@@ -40,6 +44,8 @@ import com.mogo.utils.network.utils.GsonUtil;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.annotations.NonNull;
|
||||||
|
import io.reactivex.functions.Function;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
|
|
||||||
@@ -676,28 +682,47 @@ public class V2XRefreshModel {
|
|||||||
@Override
|
@Override
|
||||||
public void onNext(V2XRoadDataRes v2XRoadDataRes) {
|
public void onNext(V2XRoadDataRes v2XRoadDataRes) {
|
||||||
super.onNext(v2XRoadDataRes);
|
super.onNext(v2XRoadDataRes);
|
||||||
if (v2XRoadDataRes == null || v2XRoadDataRes.getResult() == null) {
|
if (v2XRoadDataRes == null
|
||||||
|
|| v2XRoadDataRes.getResult() == null
|
||||||
|
|| v2XRoadDataRes.getResult().getTopPoint() == null
|
||||||
|
|| v2XRoadDataRes.getResult().getTopPoint().isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (v2XRoadDataRes.getResult().getPoiData() != null && v2XRoadDataRes.getResult().getPoiData().size() > 0) {
|
MogoLocation mogoLocation = new MogoLocation();
|
||||||
V2XRecommendRouteEntity v2XRecommendRouteEntity = new V2XRecommendRouteEntity();
|
mogoLocation.setLongitude(v2XRoadDataRes.getResult().getTopPoint().get(0));
|
||||||
v2XRecommendRouteEntity.setToPoint(v2XRoadDataRes.getResult().getTopPoint());
|
mogoLocation.setLatitude(v2XRoadDataRes.getResult().getTopPoint().get(1));
|
||||||
V2XMessageEntity<V2XRecommendRouteEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
LocationUtils.geoCodeSearch(mogoLocation, new IMogoGeoSearchListener() {
|
||||||
// 控制类型
|
@Override
|
||||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE);
|
public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) {
|
||||||
// 设置数据
|
String province = regeocodeResult.getRegeocodeAddress().getProvince();
|
||||||
v2xMessageEntity.setContent(v2XRecommendRouteEntity);
|
String city = regeocodeResult.getRegeocodeAddress().getCity();
|
||||||
// 控制展示状态
|
v2XRoadDataRes.getResult().setFormatAddress(regeocodeResult.getRegeocodeAddress().getFormatAddress().replaceAll(province, "").replaceAll(city, ""));
|
||||||
v2xMessageEntity.setShowState(true);
|
sendBroadcast(v2XRoadDataRes);
|
||||||
|
}
|
||||||
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) {
|
|
||||||
// TODO: 2020/12/30
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendBroadcast(V2XRoadDataRes v2XRoadDataRes) {
|
||||||
|
if (v2XRoadDataRes.getResult().getPoiData() != null && v2XRoadDataRes.getResult().getPoiData().size() > 0) {
|
||||||
|
V2XRecommendRouteEntity v2XRecommendRouteEntity = new V2XRecommendRouteEntity();
|
||||||
|
v2XRecommendRouteEntity.setToPoint(v2XRoadDataRes.getResult().getTopPoint());
|
||||||
|
v2XRecommendRouteEntity.setFormatAddress(v2XRoadDataRes.getResult().getFormatAddress());
|
||||||
|
V2XMessageEntity<V2XRecommendRouteEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||||
|
// 控制类型
|
||||||
|
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE);
|
||||||
|
// 设置数据
|
||||||
|
v2xMessageEntity.setContent(v2XRecommendRouteEntity);
|
||||||
|
// 控制展示状态
|
||||||
|
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) {
|
||||||
|
// TODO: 2020/12/30
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user