new#基于目的地预判的道路事件提醒、路线推荐
This commit is contained in:
@@ -8,6 +8,7 @@ import java.util.List;
|
||||
*/
|
||||
public class V2XRecommendRouteEntity {
|
||||
private List<Double> toPoint;
|
||||
private String formatAddress;
|
||||
|
||||
public List<Double> getToPoint() {
|
||||
return toPoint;
|
||||
@@ -16,4 +17,12 @@ public class V2XRecommendRouteEntity {
|
||||
public void setToPoint(List<Double> 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;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
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.MarkerLocation;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
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.V2XVoiceConstants;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
@@ -48,32 +41,11 @@ public class V2XRecommendRouteVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
markerLocation.setLat(v2XEventShowEntity.getV2XRecommendRouteEntity().getToPoint().get(1));
|
||||
mNoveltyInfo = new MarkerExploreWay();
|
||||
mNoveltyInfo.setLocation(markerLocation);
|
||||
MogoLocation mogoLocation = new MogoLocation();
|
||||
mogoLocation.setLongitude(v2XEventShowEntity.getV2XRecommendRouteEntity().getToPoint().get(0));
|
||||
mogoLocation.setLatitude(v2XEventShowEntity.getV2XRecommendRouteEntity().getToPoint().get(1));
|
||||
getLocationInfo(mogoLocation);
|
||||
mTvAddress.setText("前往 " + v2XEventShowEntity.getV2XRecommendRouteEntity().getFormatAddress());
|
||||
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) -> {
|
||||
try {
|
||||
triggerStartNavi(mNoveltyInfo);
|
||||
@@ -87,6 +59,7 @@ public class V2XRecommendRouteVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
try {
|
||||
//取消导航
|
||||
unRegisterUnwakeNavi();
|
||||
delayedCloseWindow();
|
||||
Log.d("V2XRecommendRouteVH", "cancleNavi ------");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -30,20 +30,18 @@ public class V2XRoadDataRes extends BaseData {
|
||||
}
|
||||
|
||||
public static class ResultDTO {
|
||||
|
||||
private String formatAddress;
|
||||
private List<Double> fromPoint;
|
||||
private List<Double> topPoint;
|
||||
private List<PoiDataDTO> poiData;
|
||||
private List<IllegalParkingDataDTO> illegalParkingData;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResultDTO{" +
|
||||
"fromPoint=" + fromPoint +
|
||||
", topPoint=" + topPoint +
|
||||
", poiData=" + poiData +
|
||||
", illegalParkingData=" + illegalParkingData +
|
||||
'}';
|
||||
public String getFormatAddress() {
|
||||
return formatAddress;
|
||||
}
|
||||
|
||||
public void setFormatAddress(String formatAddress) {
|
||||
this.formatAddress = formatAddress;
|
||||
}
|
||||
|
||||
public List<Double> getFromPoint() {
|
||||
|
||||
@@ -14,6 +14,9 @@ import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
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.V2XMessageEntity;
|
||||
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.V2XStrategyPushRes;
|
||||
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.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
@@ -40,6 +44,8 @@ import com.mogo.utils.network.utils.GsonUtil;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
@@ -676,28 +682,47 @@ public class V2XRefreshModel {
|
||||
@Override
|
||||
public void onNext(V2XRoadDataRes 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;
|
||||
}
|
||||
if (v2XRoadDataRes.getResult().getPoiData() != null && v2XRoadDataRes.getResult().getPoiData().size() > 0) {
|
||||
V2XRecommendRouteEntity v2XRecommendRouteEntity = new V2XRecommendRouteEntity();
|
||||
v2XRecommendRouteEntity.setToPoint(v2XRoadDataRes.getResult().getTopPoint());
|
||||
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
|
||||
}
|
||||
MogoLocation mogoLocation = new MogoLocation();
|
||||
mogoLocation.setLongitude(v2XRoadDataRes.getResult().getTopPoint().get(0));
|
||||
mogoLocation.setLatitude(v2XRoadDataRes.getResult().getTopPoint().get(1));
|
||||
LocationUtils.geoCodeSearch(mogoLocation, new IMogoGeoSearchListener() {
|
||||
@Override
|
||||
public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) {
|
||||
String province = regeocodeResult.getRegeocodeAddress().getProvince();
|
||||
String city = regeocodeResult.getRegeocodeAddress().getCity();
|
||||
v2XRoadDataRes.getResult().setFormatAddress(regeocodeResult.getRegeocodeAddress().getFormatAddress().replaceAll(province, "").replaceAll(city, ""));
|
||||
sendBroadcast(v2XRoadDataRes);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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