Merge branch 'dev_1.1.9' of http://gitlab.zhidaoauto.com/ecos/yycp-service/Launcher into dev_1.1.9
This commit is contained in:
@@ -133,4 +133,5 @@ public class V2XConst {
|
||||
* 绿波车速marker
|
||||
*/
|
||||
public static final String V2X_OPTIMAL_SPEED_MARKER = "V2X_OPTIMAL_SPEED_MARKER";
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.mogo.module.v2x.adapter.holder.V2XIllegalParkVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XLiveVideoVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XOtherSeekHelpVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XPushEventVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XRecommendRouteVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XRoadEventVH;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||
|
||||
@@ -70,6 +71,10 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
|
||||
holder = new V2XEventUgcVH(parent, mV2XWindow);
|
||||
break;
|
||||
//线路推荐
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE:
|
||||
holder = new V2XRecommendRouteVH(parent, mV2XWindow);
|
||||
break;
|
||||
}
|
||||
return holder;
|
||||
}
|
||||
@@ -97,6 +102,9 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
if (holder instanceof V2XOtherSeekHelpVH) {
|
||||
((V2XOtherSeekHelpVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
if (holder instanceof V2XRecommendRouteVH) {
|
||||
((V2XRecommendRouteVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.mogo.module.v2x.adapter.holder
|
||||
|
||||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.commons.voice.VoicePreemptType
|
||||
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.V2XUtils
|
||||
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener
|
||||
import com.mogo.module.v2x.voice.V2XVoiceConstants
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager.registerUnWakeVoice
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager.unRegisterUnWakeVoice
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
/**
|
||||
* created by wujifei on 2020/12/31 16:10
|
||||
* describe:
|
||||
*/
|
||||
class V2XRecommendRouteVH(viewGroup: ViewGroup, v2XWindow: IV2XWindow<*>) : V2XBaseViewHolder<V2XEventShowEntity>(
|
||||
LayoutInflater.from(viewGroup.context).inflate(R.layout.item_v2x_recommend_route, viewGroup, false), v2XWindow), V2XVoiceCallbackListener {
|
||||
private var mTvAddress: TextView? = null
|
||||
private var mIvToNav: ImageView? = null
|
||||
private var mIvClose: ImageView? = null
|
||||
private var mNoveltyInfo: MarkerExploreWay? = null
|
||||
private val mainScope = MainScope()
|
||||
|
||||
init {
|
||||
mTvAddress = itemView.findViewById<TextView>(R.id.tvAddress)
|
||||
mIvToNav = itemView.findViewById<ImageView>(R.id.ivToNav)
|
||||
mIvClose = itemView.findViewById<ImageView>(R.id.ivClose)
|
||||
mIvToNav?.setOnClickListener { triggerStartNavi(mNoveltyInfo) }
|
||||
mIvClose?.setOnClickListener { delayedCloseWindow() }
|
||||
itemView.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
|
||||
override fun onViewAttachedToWindow(view: View) {
|
||||
registerUnwakeNavi()
|
||||
mainScope.launch {
|
||||
delay(1000 * 20)
|
||||
delayedCloseWindow()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewDetachedFromWindow(view: View) {
|
||||
unRegisterUnwakeNavi()
|
||||
AIAssist.getInstance(V2XUtils.getApp()).breakOffSpeak()
|
||||
mainScope.cancel()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
override fun initView(viewData: V2XEventShowEntity?) {
|
||||
viewData?.let {
|
||||
val markerLocation = MarkerLocation()
|
||||
markerLocation.lon = it.getV2XRecommendRouteEntity().toPoint.get(0)
|
||||
markerLocation.lat = it.getV2XRecommendRouteEntity().toPoint.get(1)
|
||||
mNoveltyInfo = MarkerExploreWay()
|
||||
mNoveltyInfo?.setLocation(markerLocation)
|
||||
mTvAddress!!.text = "前往 ${it.getV2XRecommendRouteEntity().formatAddress}"
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(it.getV2XRecommendRouteEntity().tts, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, null)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onCallback(command: String?, intent: Intent?) {
|
||||
when (command) {
|
||||
V2XVoiceConstants.V2X_CONFIRM_ACTION -> triggerStartNavi(mNoveltyInfo)
|
||||
V2XVoiceConstants.V2X_CANCLE_ACTION -> delayedCloseWindow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun registerUnwakeNavi() {
|
||||
registerUnWakeVoice(V2XVoiceConstants.V2X_CONFIRM_ACTION, this)
|
||||
registerUnWakeVoice(V2XVoiceConstants.V2X_CANCLE_ACTION, this)
|
||||
}
|
||||
|
||||
private fun unRegisterUnwakeNavi() {
|
||||
unRegisterUnWakeVoice(V2XVoiceConstants.V2X_CONFIRM_ACTION)
|
||||
unRegisterUnWakeVoice(V2XVoiceConstants.V2X_CANCLE_ACTION)
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.v2x.adapter.holder;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
@@ -10,11 +11,13 @@ import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.common.animation.BezierAnimationView;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
@@ -23,6 +26,7 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XLiveCarInfoEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
|
||||
@@ -81,7 +85,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
private HeartLikeView ivEventZan;
|
||||
|
||||
private ViewGroup mViewGroup;
|
||||
|
||||
private WindowManagerView mWindowManagerView;
|
||||
|
||||
// 上传事件的用户信息
|
||||
private MarkerUserInfo mUserInfo;
|
||||
@@ -312,7 +316,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 展示事件的图片/视频资源
|
||||
* */
|
||||
@@ -364,6 +368,53 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
}
|
||||
}
|
||||
|
||||
private void bezierAnimation(int[] loc) {
|
||||
if (mWindowManagerView == null) {
|
||||
Log.d(TAG, "bezierAnimation:null");
|
||||
mWindowManagerView = new WindowManagerView.Builder(mContext.getApplicationContext())
|
||||
.contentView(R.layout.module_common_bezier_layout)
|
||||
.size(WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
WindowManager.LayoutParams.WRAP_CONTENT)
|
||||
.position(loc[0], loc[1])
|
||||
.gravity(Gravity.TOP | Gravity.LEFT)
|
||||
.showInWindowManager();
|
||||
}
|
||||
try {
|
||||
if (mWindowManagerView.isShowing()) {
|
||||
return;
|
||||
}
|
||||
mWindowManagerView.show();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
BezierAnimationView bezierAnimationView = mWindowManagerView.findViewById(R.id.bezier_view);
|
||||
bezierAnimationView.bezierAnimationStart();
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// mWindowManagerView.dismiss();
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
}
|
||||
|
||||
public int[] getLocation(View v) {
|
||||
int[] loc = new int[4];
|
||||
int[] location = new int[2];
|
||||
v.getLocationOnScreen(location);
|
||||
loc[0] = location[0];
|
||||
loc[1] = location[1];
|
||||
int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||
int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||
v.measure(w, h);
|
||||
|
||||
loc[2] = v.getMeasuredWidth();
|
||||
loc[3] = v.getMeasuredHeight();
|
||||
|
||||
//base = computeWH();
|
||||
return loc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 为了给车聊聊更多的信息需要重新查询一次
|
||||
*
|
||||
|
||||
@@ -249,7 +249,7 @@ public class V2XAlarmServer {
|
||||
LocationUtils.geoCodeSearch(location, new IMogoGeoSearchListener() {
|
||||
@Override
|
||||
public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) {
|
||||
//Logger.i(MODULE_NAME, "根据经纬度查询结果为:" + regeocodeResult.getRegeocodeAddress().getFormatAddress());
|
||||
Logger.i(MODULE_NAME, "根据经纬度查询结果为:" + regeocodeResult.getRegeocodeAddress().getFormatAddress());
|
||||
String keyword = "停车场";
|
||||
boolean isHighWay = false;
|
||||
if (regeocodeResult == null || regeocodeResult.getRegeocodeAddress() == null ||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -12,17 +12,21 @@ import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
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.V2XPrejectedRoadEventEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRecommendRouteEntity;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.network.RefreshBody;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.alarm.V2XAlarmServer;
|
||||
import com.mogo.module.v2x.entity.net.V2XDemoUserInfoRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XLiveCarBroadcastReq;
|
||||
import com.mogo.module.v2x.entity.net.V2XLiveCarRes;
|
||||
@@ -32,7 +36,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.TimeUtils;
|
||||
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;
|
||||
@@ -42,14 +46,13 @@ import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
|
||||
|
||||
/**
|
||||
@@ -684,32 +687,85 @@ public class V2XRefreshModel {
|
||||
@Override
|
||||
public void onNext(V2XRoadDataRes v2XRoadDataRes) {
|
||||
super.onNext(v2XRoadDataRes);
|
||||
Logger.d("queryRoadData:onSuccess", v2XRoadDataRes.toString());
|
||||
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) {
|
||||
V2XPrejectedRoadEventEntity v2XPrejectedRoadEventEntity = new V2XPrejectedRoadEventEntity();
|
||||
V2XMessageEntity<V2XPrejectedRoadEventEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PREJECTED_ROAD_WARNING);
|
||||
// 设置数据
|
||||
v2xMessageEntity.setContent(v2XPrejectedRoadEventEntity);
|
||||
// 控制展示状态
|
||||
v2xMessageEntity.setShowState(true);
|
||||
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) {
|
||||
if (regeocodeResult == null || regeocodeResult.getRegeocodeAddress() == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String province = regeocodeResult.getRegeocodeAddress().getProvince();
|
||||
String city = regeocodeResult.getRegeocodeAddress().getCity();
|
||||
v2XRoadDataRes.getResult().setFormatAddress(regeocodeResult.getRegeocodeAddress().getFormatAddress().replaceAll(province, "").replaceAll(city, ""));
|
||||
sendBroadcast(v2XRoadDataRes);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity);
|
||||
LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d("queryRoadData:onError", e.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void sendBroadcast(V2XRoadDataRes v2XRoadDataRes) {
|
||||
boolean isSendRecommendRoute = false;
|
||||
if (v2XRoadDataRes.getResult().getPoiData() != null && v2XRoadDataRes.getResult().getPoiData().size() > 0) {
|
||||
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(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);
|
||||
}
|
||||
|
||||
if (!isSendRecommendRoute && v2XRoadDataRes.getResult().getIllegalParkingData() != null && v2XRoadDataRes.getResult().getIllegalParkingData().size() > 0) {
|
||||
try {
|
||||
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = new V2XMessageEntity<>();
|
||||
v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_PARKING);
|
||||
// 设置数据
|
||||
V2XRoadDataRes.ResultDTO.IllegalParkingDataDTO parkingDataDTO = v2XRoadDataRes.getResult().getIllegalParkingData().get(0);
|
||||
V2XPushMessageEntity pushMessageEntity = new V2XPushMessageEntity();
|
||||
pushMessageEntity.setAddress(parkingDataDTO.getAddr());
|
||||
pushMessageEntity.setAlarmContent("停车场推荐");
|
||||
pushMessageEntity.setLat(parkingDataDTO.getLat());
|
||||
pushMessageEntity.setLon(parkingDataDTO.getLon());
|
||||
String tts = "主人,我发现" + v2XRoadDataRes.getResult().getFormatAddress() + "停车容易违章,推荐你导航到附近停车场,开始导航吗?";
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(tts);
|
||||
pushMessageEntity.setExpireTime(20000);
|
||||
// 控制展示状态
|
||||
v2XMessageEntity.setContent(pushMessageEntity);
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.v2x.scenario.impl;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
@@ -9,7 +10,7 @@ import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.scenario.IV2XScenarioManager;
|
||||
import com.mogo.module.v2x.scenario.scene.animation.V2XAnimationScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.destination.V2XPrejectedRoadEventScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.destination.V2XRecommendRouteScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.fatigue.V2XFatigueDrivingScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.help.V2XCarForHelpScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.livecar.V2XPushLiveCarScenario;
|
||||
@@ -24,6 +25,7 @@ import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_PARKING;
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
/**
|
||||
@@ -73,7 +75,8 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
|
||||
mV2XScenario = new V2XSeekHelpScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING :
|
||||
case ALERT_RECOMMEND_PARKING :
|
||||
mV2XScenario = new V2XFatigueDrivingScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
|
||||
@@ -92,13 +95,13 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
mV2XScenario = new V2XIllegalParkScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
|
||||
mV2XScenario = new V2XEventUgcScenario();
|
||||
mV2XScenario = V2XServiceManager.getMoGoStatusManager().isVrMode() ? null : new V2XEventUgcScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW:
|
||||
mV2XScenario = new V2XVoiceCallLiveScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PREJECTED_ROAD_WARNING:
|
||||
mV2XScenario = new V2XPrejectedRoadEventScenario();
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE:
|
||||
mV2XScenario = new V2XRecommendRouteScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW:
|
||||
mV2XScenario = new V2XPushVREventScenario();
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.mogo.module.v2x.scenario.scene.destination
|
||||
|
||||
import com.mogo.module.common.entity.V2XMessageEntity
|
||||
import com.mogo.module.common.entity.V2XPrejectedRoadEventEntity
|
||||
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario
|
||||
|
||||
/**
|
||||
* created by wujifei on 2020/12/25 14:15
|
||||
* describe:基于目的地预判的道路事件场景
|
||||
*/
|
||||
class V2XPrejectedRoadEventScenario : AbsV2XScenario<V2XPrejectedRoadEventEntity>() {
|
||||
|
||||
init {
|
||||
v2XWindow = V2XPrejectedRoadEventWindow()
|
||||
}
|
||||
|
||||
override fun init(v2XMessageEntity: V2XMessageEntity<V2XPrejectedRoadEventEntity>?) {
|
||||
v2XMessageEntity?.content.let {
|
||||
if (v2XMessageEntity!!.isShowState) {
|
||||
if (!isSameScenario(v2XMessageEntity)) {
|
||||
// 更新要提醒的数据
|
||||
setV2XMessageEntity(v2XMessageEntity)
|
||||
show()
|
||||
} else {
|
||||
// 更新要提醒的数据
|
||||
setV2XMessageEntity(v2XMessageEntity)
|
||||
}
|
||||
} else {
|
||||
close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun show() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun showWindow() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun closeWindow() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun showButton() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun closeButton() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun drawPOI() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun clearPOI() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.mogo.module.v2x.scenario.scene.destination;
|
||||
|
||||
/**
|
||||
* 基于目的地违章高发情况的停车推荐
|
||||
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48958095
|
||||
*/
|
||||
public class V2XRecommendParkingLotScenario {
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.mogo.module.v2x.scenario.scene.destination
|
||||
|
||||
import android.view.ViewGroup
|
||||
import com.mogo.module.common.entity.V2XMessageEntity
|
||||
import com.mogo.module.common.entity.V2XRecommendRouteEntity
|
||||
import com.mogo.module.v2x.R
|
||||
import com.mogo.module.v2x.V2XServiceManager
|
||||
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario
|
||||
import com.mogo.module.v2x.utils.V2XUtils
|
||||
|
||||
/**
|
||||
* created by wujifei on 2020/12/29 17:57
|
||||
* describe:基于目的地预判的道路事件提醒、路线推荐
|
||||
*/
|
||||
class V2XRecommendRouteScenario : AbsV2XScenario<V2XRecommendRouteEntity>() {
|
||||
|
||||
init {
|
||||
v2XWindow = V2XRecommendRouteWindow()
|
||||
}
|
||||
|
||||
override fun init(v2XMessageEntity: V2XMessageEntity<V2XRecommendRouteEntity>?) {
|
||||
v2XMessageEntity?.content?.let {
|
||||
if (v2XMessageEntity!!.isShowState) {
|
||||
if (!isSameScenario(v2XMessageEntity)) {
|
||||
setV2XMessageEntity(v2XMessageEntity)
|
||||
show()
|
||||
} else {
|
||||
setV2XMessageEntity(v2XMessageEntity)
|
||||
}
|
||||
} else {
|
||||
close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun show() {
|
||||
if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume) {
|
||||
showWindow()
|
||||
}
|
||||
}
|
||||
|
||||
override fun showWindow() {
|
||||
v2XWindow?.let {
|
||||
val layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
V2XUtils.getApp().resources.getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground).toInt())
|
||||
V2XServiceManager.getMogoTopViewManager().addView(it.view, layoutParams)
|
||||
it.show(v2XMessageEntity.content)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun closeWindow() {
|
||||
v2XWindow?.let {
|
||||
it.close()
|
||||
}
|
||||
}
|
||||
|
||||
override fun showButton() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun closeButton() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun drawPOI() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun clearPOI() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,34 +4,33 @@ import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.PagerSnapHelper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity
|
||||
import com.mogo.module.common.entity.V2XMessageEntity
|
||||
import com.mogo.module.common.entity.V2XRecommendRouteEntity
|
||||
import com.mogo.module.v2x.R
|
||||
import com.mogo.module.v2x.V2XServiceManager
|
||||
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter
|
||||
import com.mogo.module.v2x.listener.V2XWindowStatusListener
|
||||
import com.mogo.module.v2x.scenario.scene.V2XBasWindow
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* created by wujifei on 2020/12/25 11:45
|
||||
* describe:基于目的地预判的道路事件场景弹窗
|
||||
*/
|
||||
class V2XPrejectedRoadEventWindow @JvmOverloads constructor(
|
||||
class V2XRecommendRouteWindow @JvmOverloads constructor(
|
||||
context: Context = V2XServiceManager.getContext(),
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0) : V2XBasWindow(context, attrs, defStyleAttr), IV2XWindow<V2XRoadEventEntity?> {
|
||||
private var rvPrejectedRoadEventList: RecyclerView? = null
|
||||
private var btnCloseWindow: ImageView? = null
|
||||
defStyleAttr: Int = 0) : V2XBasWindow(context, attrs, defStyleAttr), IV2XWindow<V2XRecommendRouteEntity?> {
|
||||
|
||||
private var rvRoadEventList: RecyclerView? = null
|
||||
private var mV2XRoadEventAdapter: V2XRoadEventAdapter? = null
|
||||
|
||||
// 列表展示
|
||||
private val mItemList: List<V2XEventShowEntity> = ArrayList()
|
||||
private var mV2XRoadEventAdapter: V2XRoadEventAdapter? = null
|
||||
private val mItemList = mutableListOf<V2XEventShowEntity>()
|
||||
|
||||
init {
|
||||
initView(context)
|
||||
@@ -39,17 +38,15 @@ class V2XPrejectedRoadEventWindow @JvmOverloads constructor(
|
||||
|
||||
private fun initView(context: Context) {
|
||||
// 填充布局
|
||||
LayoutInflater.from(context).inflate(R.layout.window_prejected_road_event_detail, this)
|
||||
rvPrejectedRoadEventList = findViewById<View>(R.id.rvPrejectedRoadEventList) as RecyclerView
|
||||
btnCloseWindow = findViewById<View>(R.id.btnCloseWindow) as ImageView
|
||||
btnCloseWindow!!.setOnClickListener { close() }
|
||||
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this)
|
||||
rvRoadEventList = findViewById(R.id.rvRoadEventList);
|
||||
mV2XRoadEventAdapter = V2XRoadEventAdapter(mItemList, this)
|
||||
rvPrejectedRoadEventList!!.adapter = mV2XRoadEventAdapter
|
||||
rvRoadEventList?.setAdapter(mV2XRoadEventAdapter)
|
||||
// 设置切换样式
|
||||
PagerSnapHelper().attachToRecyclerView(rvPrejectedRoadEventList)
|
||||
PagerSnapHelper().attachToRecyclerView(rvRoadEventList)
|
||||
// 配置列表朝向
|
||||
val layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
||||
rvPrejectedRoadEventList!!.layoutManager = layoutManager
|
||||
rvRoadEventList?.setLayoutManager(layoutManager)
|
||||
}
|
||||
|
||||
|
||||
@@ -62,10 +59,20 @@ class V2XPrejectedRoadEventWindow @JvmOverloads constructor(
|
||||
return this
|
||||
}
|
||||
|
||||
override fun setWindowStatusListener(listener: V2XWindowStatusListener) {}
|
||||
override fun setWindowStatusListener(listener: V2XWindowStatusListener) {
|
||||
|
||||
}
|
||||
|
||||
override fun show(entity: V2XRoadEventEntity?) {
|
||||
TODO("Not yet implemented")
|
||||
override fun show(entity: V2XRecommendRouteEntity?) {
|
||||
entity.let {
|
||||
// 清空数据
|
||||
mItemList.clear()
|
||||
val v2XEventShowEntity = V2XEventShowEntity()
|
||||
v2XEventShowEntity.v2XRecommendRouteEntity = entity
|
||||
v2XEventShowEntity.viewType = V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE
|
||||
mItemList.add(v2XEventShowEntity)
|
||||
// 刷新列表
|
||||
mV2XRoadEventAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,8 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 5:37 PM
|
||||
* desc : 疲劳驾驶场景
|
||||
* desc : 疲劳驾驶/目的地停车场推荐场景
|
||||
* 目的地停车场他推荐:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48958095
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XFatigueDrivingScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
|
||||
|
||||
@@ -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,8 +279,8 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
|
||||
mBtnTriggerTrafficSearch.setOnClickListener(v -> V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus());
|
||||
|
||||
mBtnTriggerPrejectedRoadEvent.setOnClickListener(view -> {
|
||||
V2XServiceManager.getV2XRefreshModel().queryRoadData("XTCAA83540301871");
|
||||
mBtnTriggerRecommendRouteEvent.setOnClickListener(view -> {
|
||||
V2XServiceManager.getV2XRefreshModel().queryRoadData("ZD802C1938L10797");
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
@@ -283,6 +283,13 @@ public class V2XVoiceConstants {
|
||||
public static final String COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP";
|
||||
public static final String[] COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP_WORDS = {"没注意", "没看到", "没有施工","无施工", "很正常", "取消", "关闭"};
|
||||
|
||||
//免唤醒词
|
||||
public static final String V2X_CONFIRM_ACTION = "V2X_CONFIRM_ACTION";
|
||||
public static final String[] UNWAKE_NAVI_CONFIRM = {"开始导航", "开启导航", "好的", "开始", "导航", "确定", "确认", "好"};
|
||||
|
||||
public static final String V2X_CANCLE_ACTION = "V2X_CANCLE_ACTION";
|
||||
public static final String[] UNWAKE_NAVI_CANCLE = {"取消", "关闭", "不要", "不导航"};
|
||||
|
||||
|
||||
static {
|
||||
// 免唤醒 默认
|
||||
@@ -321,6 +328,9 @@ public class V2XVoiceConstants {
|
||||
sVoiceCmds.put(COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_YES_UN_WAKEUP, COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_YES_UN_WAKEUP_WORDS);
|
||||
sVoiceCmds.put(COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP, COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP_WORDS);
|
||||
|
||||
sVoiceCmds.put(V2X_CONFIRM_ACTION, UNWAKE_NAVI_CONFIRM);
|
||||
sVoiceCmds.put(V2X_CANCLE_ACTION, UNWAKE_NAVI_CANCLE);
|
||||
|
||||
|
||||
//2020-6-24 顺义演示需求添加,现合并至launcher 更新时间:2020-08-25
|
||||
sVoiceCmds.put(COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP, COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP_WORDS);
|
||||
|
||||
Reference in New Issue
Block a user