Merge remote-tracking branch 'origin/dev_merge_shunyi_vr_map' into dev_merge_shunyi_vr_map

# Conflicts:
#	libraries/map-custom/build.gradle
#	modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/BaseNaviInfoView.java
This commit is contained in:
wangcongtao
2020-12-13 11:06:21 +08:00
117 changed files with 2217 additions and 1155 deletions

View File

@@ -1,5 +1,7 @@
package com.mogo.module.v2x;
import com.mogo.module.common.MogoApisHandler;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
@@ -8,6 +10,8 @@ package com.mogo.module.v2x;
* version: 1.0
*/
public class V2XConst {
public static final String T_SCENARIO_HISTORY = "t_search_poi";
/**
* V2X面板名称
*/

View File

@@ -19,7 +19,6 @@ import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.MogoMarkersHandler;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.uicontroller.EnumMapUI;
@@ -37,7 +36,6 @@ import com.mogo.module.v2x.network.V2XRefreshCallback;
import com.mogo.module.v2x.receiver.SceneBroadcastReceiver;
import com.mogo.module.v2x.scenario.impl.V2XScenarioManager;
import com.mogo.module.v2x.scenario.scene.livecar.V2XVoiceCallLiveBiz;
import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario;
import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkWindow;
import com.mogo.module.v2x.utils.FatigueDrivingUtils;
import com.mogo.module.v2x.utils.TimeUtils;
@@ -52,12 +50,9 @@ import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.mogo.utils.storage.SharedPrefsMgr;
import static com.mogo.module.v2x.VideoInitKt.initVideo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
import static com.mogo.module.v2x.VideoInitKt.initVideo;
/**
* author : donghongyu
@@ -237,12 +232,12 @@ public class V2XModuleProvider implements
@Override
public boolean onMarkerClicked(IMogoMarker marker) {
Log.d(TAG,"onMarkerClicked2222");
Log.d(TAG, "onMarkerClicked2222");
//点击的marker的具体数据
MarkerExploreWay exploreWay = extractFromMarker(marker);
MarkerExploreWayItem item = exploreWay.getItems().get(0);
MarkerExploreWayItem item = exploreWay.getItems().get(0);
String path = item.getUrl();
if (path.contains(".mp4")){
if (path.contains(".mp4")) {
initVideo();
}
@@ -285,9 +280,9 @@ public class V2XModuleProvider implements
Logger.d(V2XConst.MODULE_NAME,
"V2X===违章停车:onMarkerClicked=" + markerExploreWay);
((V2XIllegalParkWindow) V2XIllegalParkScenario.getInstance()
.getV2XWindow())
.show(markerExploreWay, false);
//直接展示弹窗
V2XIllegalParkWindow parkScenario = new V2XIllegalParkWindow();
parkScenario.show(markerExploreWay, false);
} catch (Exception e) {
e.printStackTrace();
}

View File

@@ -14,6 +14,7 @@ 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.V2XRoadEventVH;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import java.util.List;
@@ -28,8 +29,12 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
private List<V2XEventShowEntity> itemList;
public V2XRoadEventAdapter(List<V2XEventShowEntity> itemList) {
// 当前展示条目绑定的window
private IV2XWindow mV2XWindow;
public V2XRoadEventAdapter(List<V2XEventShowEntity> itemList, IV2XWindow v2XWindow) {
this.itemList = itemList;
this.mV2XWindow = v2XWindow;
}
@NonNull
@@ -39,31 +44,31 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
switch (viewType) {
// 直播
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING:
holder = new V2XLiveVideoVH(parent);
holder = new V2XLiveVideoVH(parent, mV2XWindow);
break;
//道路事件详情
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
holder = new V2XRoadEventVH(parent);
holder = new V2XRoadEventVH(parent, mV2XWindow);
break;
//违章停车
case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
holder = new V2XIllegalParkVH(parent);
holder = new V2XIllegalParkVH(parent, mV2XWindow);
break;
//推送展示
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
holder = new V2XPushEventVH(parent);
holder = new V2XPushEventVH(parent, mV2XWindow);
break;
//疲劳驾驶
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
holder = new V2XFatigueDrivingVH(parent);
holder = new V2XFatigueDrivingVH(parent, mV2XWindow);
break;
//他人故障求助
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
holder = new V2XOtherSeekHelpVH(parent);
holder = new V2XOtherSeekHelpVH(parent, mV2XWindow);
break;
//道路事件UGC
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
holder = new V2XEventUgcVH(parent);
holder = new V2XEventUgcVH(parent, mV2XWindow);
break;
}
return holder;

View File

@@ -107,7 +107,7 @@ public class V2XShareEventAdapter extends RecyclerView.Adapter<RecyclerView.View
if (poitype != null) {
((shareItemViewHolder) holder).caseStyleTextView.setText(EventTypeUtils.getPoiTypeStr(poitype));
((shareItemViewHolder) holder).caseStyleTextView.setBackgroundResource(EventTypeUtils.getPoiTypeBg(poitype));
((shareItemViewHolder) holder).caseStyleTextView.setBackgroundResource(EventTypeUtils.getPoiTypeBgForShareItem(poitype));
}
if (address != null) {

View File

@@ -17,6 +17,7 @@ import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.V2XEventZanData;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.ChartingUtil;
import com.mogo.module.v2x.utils.RoadConditionUtils;
import com.mogo.module.v2x.utils.TimeUtils;
@@ -43,10 +44,13 @@ public abstract class V2XBaseViewHolder<T>
private static final String TAG = "V2XBaseViewHolder";
private ICarsChattingProvider mCarsChattingProvider;
public V2XBaseViewHolder(@NonNull View itemView) {
super(itemView);
}
// 当前展示条目绑定的window
protected IV2XWindow mV2XWindow;
public V2XBaseViewHolder(@NonNull View itemView, IV2XWindow v2XWindow) {
super(itemView);
mV2XWindow = v2XWindow;
}
/**
* 填充View视图
@@ -58,7 +62,13 @@ public abstract class V2XBaseViewHolder<T>
/**
* 延迟关闭窗体视图
*/
public abstract void delayedCloseWindow();
public void delayedCloseWindow() {
itemView.post(() -> {
if (mV2XWindow != null) {
mV2XWindow.close();
}
});
}
/**
* 点赞
@@ -105,7 +115,7 @@ public abstract class V2XBaseViewHolder<T>
String name = noveltyInfo.getUserInfo().getUserName();
mogoDriverInfo.setUserName(name != null ? name : "");
mogoDriverInfo.setUserHead(noveltyInfo.getUserInfo().getUserHead());
if ( mCarsChattingProvider != null ) {
if (mCarsChattingProvider != null) {
mCarsChattingProvider.showUserWindow(MODULE_NAME, mogoDriverInfo, this.itemView.getContext());
}

View File

@@ -16,7 +16,7 @@ import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.scene.ugc.V2XEventUgcScenario;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.EventTypeUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
@@ -59,9 +59,10 @@ public class V2XEventUgcVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private V2XRoadEventEntity mV2XRoadEventEntity;
private V2XEventShowEntity mV2XEventShowEntity;
public V2XEventUgcVH(ViewGroup viewGroup) {
public V2XEventUgcVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_event_ugc, viewGroup, false));
.inflate(R.layout.item_v2x_event_ugc, viewGroup, false)
, v2XWindow);
ivEventTypeIcon = itemView.findViewById(R.id.ivEventTypeIcon);
tvEventUgcTitle = itemView.findViewById(R.id.tvEventUgcTitle);
ivEventReportTrue = itemView.findViewById(R.id.ivEventReportTrue);
@@ -197,12 +198,4 @@ public class V2XEventUgcVH extends V2XBaseViewHolder<V2XEventShowEntity> {
delayedCloseWindow();
}
/**
* 延迟关闭窗体
*/
@Override
public void delayedCloseWindow() {
itemView.postDelayed(() -> V2XEventUgcScenario.getInstance().close(), 1000);
}
}

View File

@@ -14,7 +14,7 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.service.Utils;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.scenario.scene.fatigue.V2XFatigueDrivingScenario;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.LocationUtils;
import com.mogo.module.v2x.utils.SpanUtils;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
@@ -39,15 +39,16 @@ public class V2XFatigueDrivingVH extends V2XBaseViewHolder<V2XEventShowEntity> {
// 语音控制导航
private V2XVoiceCallbackListener mNaviCb = (command, intent) -> triggerStartNavi(mNoveltyInfo);
public V2XFatigueDrivingVH(ViewGroup viewGroup) {
public V2XFatigueDrivingVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_fatigue_driving, viewGroup, false));
.inflate(R.layout.item_v2x_fatigue_driving, viewGroup, false)
, v2XWindow);
mTvAddress = itemView.findViewById(R.id.tvAddress);
mTvAddressDistance = itemView.findViewById(R.id.tvAddressDistance);
mIvToNav = itemView.findViewById(R.id.ivToNav);
mIvClose = itemView.findViewById(R.id.ivClose);
mIvToNav.setOnClickListener(v -> triggerStartNavi(mNoveltyInfo));
mIvClose.setOnClickListener(v -> V2XFatigueDrivingScenario.getInstance().close());
mIvClose.setOnClickListener(v -> delayedCloseWindow());
// 设置视图状态监听
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@@ -106,12 +107,5 @@ public class V2XFatigueDrivingVH extends V2XBaseViewHolder<V2XEventShowEntity> {
.create();
}
/**
* 延迟关闭窗体
*/
@Override
public void delayedCloseWindow() {
itemView.postDelayed(() -> V2XFatigueDrivingScenario.getInstance().close(), 1000);
}
}

View File

@@ -0,0 +1,260 @@
package com.mogo.module.v2x.adapter.holder;
import android.util.Log;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.voice.AIAssist;
import com.mogo.map.MogoLatLng;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.navi.MogoTraffic;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.V2XEventZanData;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.ChartingUtil;
import com.mogo.module.v2x.utils.RoadConditionUtils;
import com.mogo.module.v2x.utils.TimeUtils;
import com.mogo.module.v2x.utils.TrackUtils;
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;
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
import com.zhidao.carchattingprovider.ICarsChattingProvider;
import com.zhidao.carchattingprovider.MogoDriverInfo;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* 出行动态
*
* @author donghongyu
*/
public abstract class V2XHistoryBaseViewHolder<T>
extends RecyclerView.ViewHolder
implements IMogoNaviListener {
private static final String TAG = "V2XBaseViewHolder";
private ICarsChattingProvider mCarsChattingProvider;
public V2XHistoryBaseViewHolder(@NonNull View itemView) {
super(itemView);
}
/**
* 填充View视图
*
* @param viewData 与视图绑定的数据
*/
public abstract void initView(T viewData);
/**
* 延迟关闭窗体视图
*/
public void delayedCloseWindow() {
}
/**
* 点赞
*/
public void triggerZan(MarkerExploreWay noveltyInfo) {
try {
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已点赞", null);
showTip("已点赞");
if (noveltyInfo != null) {
// 调用网络API接口
V2XServiceManager.getV2XMarkerService()
.getV2XRefreshModel()
.giveLikeLiveVideo(null, noveltyInfo.getSn());
V2XEventZanData v2XEventZanData = new V2XEventZanData();
v2XEventZanData.setEventId(noveltyInfo.getInfoId());
v2XEventZanData.setTriggerTime(TimeUtils.getNowMills());
V2XSQLiteUtils.saveEventZanLocalStory(v2XEventZanData);
// 上报数据统计
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
noveltyInfo.getSn(),
V2XConst.V2X_ROAD_ZAN);
}
} catch (Exception e) {
e.printStackTrace();
}
delayedCloseWindow();
}
public void triggerIVReportHead(MarkerExploreWay noveltyInfo) {
Log.d(TAG, "点击头像" + mCarsChattingProvider);
try {
mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation();
MogoDriverInfo mogoDriverInfo = new MogoDriverInfo();
int ageNumber = noveltyInfo.getUserInfo().getAgeNumber();
mogoDriverInfo.setAge(ageNumber);
String gender = noveltyInfo.getUserInfo().getGender();
mogoDriverInfo.setGender(gender);
String sn = noveltyInfo.getUserInfo().getSn();
mogoDriverInfo.setSn(sn != null ? sn : "");
String name = noveltyInfo.getUserInfo().getUserName();
mogoDriverInfo.setUserName(name != null ? name : "");
mogoDriverInfo.setUserHead(noveltyInfo.getUserInfo().getUserHead());
if (mCarsChattingProvider != null) {
mCarsChattingProvider.showUserWindow(MODULE_NAME, mogoDriverInfo, this.itemView.getContext());
}
} catch (Exception e) {
Log.d(TAG, "点击头像发生错误--triggerIVReportHead" + e);
e.printStackTrace();
}
}
/**
* 打电话
*/
public void triggerCallChart(MarkerExploreWay noveltyInfo) {
try {
MarkerLocation location = new MarkerLocation();
location.setLat(noveltyInfo.getLocation().getLat());
location.setLon(noveltyInfo.getLocation().getLon());
ChartingUtil.callChatting(noveltyInfo.getUserInfo(), location);
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
noveltyInfo.getSn(),
V2XConst.V2X_ROAD_CHAT);
} catch (Exception e) {
e.printStackTrace();
TipToast.tip("用户信息异常");
}
delayedCloseWindow();
}
/**
* 反馈路况错误
*/
public void triggerReportErr(MarkerExploreWay noveltyInfo) {
try {
RoadConditionUtils.sendShareReceiverInfo(
noveltyInfo.getInfoId(),
noveltyInfo.getPoiType(),
3);
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
noveltyInfo.getSn(),
V2XConst.V2X_ROAD_REPORT_ERROR);
} catch (Exception e) {
e.printStackTrace();
TipToast.tip("路况信息异常");
}
delayedCloseWindow();
}
/**
* 反馈路况正确
*/
public void triggerReportTrue(MarkerExploreWay noveltyInfo) {
try {
RoadConditionUtils.sendShareReceiverInfo(
noveltyInfo.getInfoId(),
noveltyInfo.getPoiType(),
2);
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
noveltyInfo.getSn(),
V2XConst.V2X_ROAD_REPORT_RIGHT);
} catch (Exception e) {
e.printStackTrace();
TipToast.tip("路况信息异常");
}
delayedCloseWindow();
}
/**
* 导航规划路线
*/
public void triggerStartNavi(MarkerExploreWay noveltyInfo) {
try {
V2XServiceManager.getMogoRegisterCenter().registerMogoNaviListener(MODULE_NAME, this);
MogoLatLng endPoint = new MogoLatLng(
noveltyInfo.getLocation().getLat(),
noveltyInfo.getLocation().getLon());
V2XServiceManager.getNavi().naviTo(endPoint);
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
noveltyInfo.getSn(),
V2XConst.V2X_ROAD_NAVI);
} catch (Exception e) {
e.printStackTrace();
TipToast.tip("路况信息异常");
}
delayedCloseWindow();
}
/**
* 显示自定义 Toast
*
* @param msg
*/
public void showTip(String msg) {
TipToast.tip(msg);
}
@Override
public void onInitNaviFailure() {
}
@Override
public void onInitNaviSuccess() {
}
@Override
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
}
@Override
public void onStartNavi() {
}
@Override
public void onStopNavi() {
}
@Override
public void onCalculateSuccess() {
Logger.w(TAG, "onCalculateSuccess");
V2XServiceManager.getNavi().startNavi(true);
V2XServiceManager.getMogoRegisterCenter().unregisterMogoNaviListener(MODULE_NAME);
}
@Override
public void onoCalculateFailed() {
}
@Override
public void onUpdateTraffic(MogoTraffic traffic) {
}
}

View File

@@ -1,10 +1,13 @@
package com.mogo.module.v2x.adapter.holder;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XHistoryScenarioData;
@@ -12,7 +15,7 @@ import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.RoadConditionUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.module.v2x.view.HeartLikeView;
@@ -45,9 +48,12 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private V2XVoiceCallbackListener v2XVoiceCallbackYouYongListener = (command, intent) -> roadReportTrue();
private V2XVoiceCallbackListener v2XVoiceCallbackMeiYongListener = (command, intent) -> roadReportErr();
public V2XIllegalParkVH(ViewGroup viewGroup) {
public V2XIllegalParkVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_illegal_parking, viewGroup, false));
.inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
R.layout.item_v2x_illegal_parking_vr :
R.layout.item_v2x_illegal_parking, viewGroup, false)
, v2XWindow);
mAddressTv = itemView.findViewById(R.id.tvAddress);
mIllegalNumTv = itemView.findViewById(R.id.tvIllegalNum);
@@ -105,11 +111,12 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder<V2XEventShowEntity> {
*/
@Override
public void delayedCloseWindow() {
V2XHistoryScenarioData v2XHistoryScenarioData =new V2XHistoryScenarioData();
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
v2XHistoryScenarioData.setScenarioType(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING);
v2XHistoryScenarioData.setEventJsonData(GsonUtil.jsonFromObject(mExploreWay));
v2XHistoryScenarioData.setEventJsonDataHashCode(mExploreWay.hashCode());
V2XSQLiteUtils.updateScenarioHistoryDataIsDispose(v2XHistoryScenarioData);
itemView.postDelayed(() -> V2XIllegalParkScenario.getInstance().close(), 1000);
super.delayedCloseWindow();
}
/**

View File

@@ -11,6 +11,7 @@ import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.TrackUtils;
import com.mogo.module.v2x.view.V2XLiveGSYVideoView;
import com.mogo.service.imageloader.MogoImageView;
@@ -21,6 +22,7 @@ import com.mogo.service.imageloader.MogoImageView;
* date : 2020/3/11 4:35 PM
* desc : 直播类型的卡片
* version: 1.0
*
* @author donghongyu
*/
public class V2XLiveVideoVH extends V2XBaseViewHolder<V2XEventShowEntity> {
@@ -35,8 +37,8 @@ public class V2XLiveVideoVH extends V2XBaseViewHolder<V2XEventShowEntity> {
// 预警的道路事件数据
private V2XRoadEventEntity mV2XRoadEventEntity;
public V2XLiveVideoVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_live_video, viewGroup, false));
public V2XLiveVideoVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
super(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_live_video, viewGroup, false), v2XWindow);
videoPlayer = itemView.findViewById(R.id.videoPlayer);
ivReportHead = itemView.findViewById(R.id.ivReportHead);
}
@@ -57,9 +59,4 @@ public class V2XLiveVideoVH extends V2XBaseViewHolder<V2XEventShowEntity> {
TrackUtils.trackV2xRoadEvent(mV2XRoadEventEntity.getNoveltyInfo().getInfoId(), v2XLiveCarEntity.getSn(), V2XConst.V2X_ROAD_VIDEO);
}
@Override
public void delayedCloseWindow() {
ivReportHead.postDelayed(() -> V2XRoadEventScenario.getInstance().close(), 2000);
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.module.v2x.adapter.holder;
import android.content.Context;
import android.content.res.Resources;
import android.text.TextUtils;
import android.view.LayoutInflater;
@@ -8,6 +9,8 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
@@ -16,7 +19,7 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpScenario;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.ChartingUtil;
import com.mogo.module.v2x.utils.SpanUtils;
import com.mogo.module.v2x.utils.V2XUtils;
@@ -24,6 +27,7 @@ import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.imageloader.MogoImageView;
import com.mogo.utils.glide.GlideRoundedCornersTransform;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -42,6 +46,7 @@ import static android.view.View.VISIBLE;
*/
public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private Context mContext;
private MogoImageView ivHead;
private TextView tvName;
private TextView tvDistance;
@@ -68,9 +73,13 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
// 查看车辆信息
private V2XVoiceCallbackListener mVoiceOpenCarInfoLis = ((command, intent) -> triggerIVReportHead(mNoveltyInfo));
public V2XOtherSeekHelpVH(ViewGroup viewGroup) {
public V2XOtherSeekHelpVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_fault_help, viewGroup, false));
.inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
R.layout.item_v2x_fault_help_vr :
R.layout.item_v2x_fault_help, viewGroup, false)
, v2XWindow);
mContext = viewGroup.getContext();
ivHead = itemView.findViewById(R.id.ivFaultHelpHead);
tvName = itemView.findViewById(R.id.tvFaultHelpName);
tvDistance = itemView.findViewById(R.id.tvFaultHelpDistance);
@@ -177,8 +186,13 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
}
try {
if (!TextUtils.isEmpty(mV2XPushMessageEntity.getHeadImgUrl())) {
V2XServiceManager.getImageLoader()
.displayImage(mV2XPushMessageEntity.getHeadImgUrl(), ivHead);
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
Glide.with(mContext).load(mV2XPushMessageEntity.getHeadImgUrl()).apply(RequestOptions.bitmapTransform(
new GlideRoundedCornersTransform(20, GlideRoundedCornersTransform.CornerType.LEFT))).into(ivHead);
} else {
V2XServiceManager.getImageLoader()
.displayImage(mV2XPushMessageEntity.getHeadImgUrl(), ivHead);
}
}
tvName.setText(mV2XPushMessageEntity.getDisplayName());
@@ -194,7 +208,9 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
.append("" + (int) mV2XPushMessageEntity.getDistance())
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
.append("")
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
.setFontSize((int) itemView.getResources().getDimension(
V2XServiceManager.getMoGoStatusManager().isVrMode() ?
R.dimen.module_v2x_event_distance_title_vr : R.dimen.module_v2x_event_distance_title))
.create();
}
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA);
@@ -207,12 +223,4 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
}
}
/**
* 延迟关闭窗体
*/
@Override
public void delayedCloseWindow() {
itemView.postDelayed(() -> V2XSeekHelpScenario.getInstance().close(), 1000);
}
}

View File

@@ -13,7 +13,7 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.scene.push.V2XPushEventScenario;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
@@ -27,6 +27,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* date : 2020/3/11 4:35 PM
* desc : TODO 这里是前瞻演示需求,推送的消息,
* version: 1.0
*
* @author donghongyu
*/
public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
@@ -65,9 +66,10 @@ public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
// 点赞语音回调
private V2XVoiceCallbackListener v2XVoiceCallbackLickListener = (command, intent) -> triggerZan(mNoveltyInfo);
public V2XPushEventVH(ViewGroup viewGroup) {
public V2XPushEventVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_push_event_detail, viewGroup, false));
.inflate(R.layout.item_v2x_push_event_detail, viewGroup, false)
, v2XWindow);
ivImg = itemView.findViewById(R.id.ivImg);
ivReportHead = itemView.findViewById(R.id.ivReportHead);
@@ -178,12 +180,4 @@ public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
}
}
/**
* 延迟关闭窗体
*/
@Override
public void delayedCloseWindow() {
itemView.postDelayed(() -> V2XPushEventScenario.getInstance().close(), 1000);
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.module.v2x.adapter.holder;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
@@ -9,8 +10,9 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerUserInfo;
import com.mogo.module.common.entity.V2XEventShowEntity;
@@ -22,9 +24,9 @@ import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
import com.mogo.module.v2x.network.V2XRefreshCallback;
import com.mogo.module.v2x.scenario.scene.livecar.V2XRoadLiveCarScenario;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventWindow;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadVideoCarScenario;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.ChartingUtil;
import com.mogo.module.v2x.utils.EventTypeUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
@@ -35,6 +37,7 @@ import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.imageloader.MogoImageView;
import com.mogo.utils.ArrayUtils;
import com.mogo.utils.DateTimeUtils;
import com.mogo.utils.glide.GlideRoundedCornersTransform;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
@@ -57,6 +60,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private static final String TAG = "V2XRoadEventVH";
private Context mContext;
private MogoImageView ivEventImg;
private MogoImageView ivReportHead;
private ImageView ivEventPlay;
@@ -138,11 +142,12 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
ivEventReportErr = itemView.findViewById(R.id.ivEventReportErr);
}
public V2XRoadEventVH(ViewGroup viewGroup) {
super(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ?
LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail, viewGroup, false) :
LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail_vr, viewGroup, false)
);
public V2XRoadEventVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
super(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail_vr, viewGroup, false) :
LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail, viewGroup, false)
, v2XWindow);
mContext = viewGroup.getContext();
init(itemView);
// 设置视图状态监听
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@@ -205,8 +210,13 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
imgUrl = mNoveltyInfo.getItems().get(0).getUrl();
}
if (!TextUtils.isEmpty(imgUrl)) {
V2XServiceManager.getImageLoader()
.displayImage(imgUrl, ivEventImg);
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
Glide.with(mContext).load(imgUrl).apply(RequestOptions.bitmapTransform(
new GlideRoundedCornersTransform(20, GlideRoundedCornersTransform.CornerType.LEFT))).into(ivEventImg);
} else {
V2XServiceManager.getImageLoader()
.displayImage(imgUrl, ivEventImg);
}
}
if (url.contains(".mp4")) {
ivEventImg.setOnClickListener(v -> {
@@ -339,8 +349,11 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
V2XRoadLiveCarScenario.getInstance().init(v2XMessageEntity);
// 打开直播后,窗口倒计时暂停关闭,直播被关闭后继续倒计时
V2XRoadEventWindow window = (V2XRoadEventWindow) V2XRoadEventScenario.getInstance().getV2XWindow();
window.stopCountDown();
if (mV2XWindow != null) {
if (mV2XWindow instanceof V2XRoadEventWindow) {
((V2XRoadEventWindow) mV2XWindow).stopCountDown();
}
}
}
}
@@ -413,18 +426,18 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
});
}
}
/**
* 延迟关闭窗体
*/
@Override
public void delayedCloseWindow() {
itemView.postDelayed(() -> {
// 移除窗体
V2XServiceManager
.getIMogoWindowManager()
.removeView(V2XRoadEventScenario.getInstance().getV2XWindow().getView());
V2XRoadEventScenario.getInstance().close();
}, 1000);
}
//
// /**
// * 延迟关闭窗体
// */
// @Override
// public void delayedCloseWindow() {
//// itemView.postDelayed(() -> {
//// // 移除窗体
//// V2XServiceManager
//// .getIMogoWindowManager()
//// .removeView(V2XRoadEventScenario.getInstance().getV2XWindow().getView());
//// V2XRoadEventScenario.getInstance().close();
//// }, 1000);
// }
}

View File

@@ -5,8 +5,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XHistoryScenarioData;
import com.mogo.module.v2x.R;
@@ -23,7 +21,7 @@ import com.mogo.utils.network.utils.GsonUtil;
*
* @author donghongyu
*/
public class V2XScenarioHistoryIllegalParkVH extends V2XBaseViewHolder<V2XHistoryScenarioData> {
public class V2XScenarioHistoryIllegalParkVH extends V2XHistoryBaseViewHolder<V2XHistoryScenarioData> {
private TextView mTvAddress;
private TextView mTvIllegalNum;
@@ -37,7 +35,7 @@ public class V2XScenarioHistoryIllegalParkVH extends V2XBaseViewHolder<V2XHistor
private V2XHistoryScenarioData mOldScenarioData;
public V2XScenarioHistoryIllegalParkVH(@NonNull ViewGroup viewGroup) {
public V2XScenarioHistoryIllegalParkVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_scennario_history, viewGroup, false));
mTvAddress = itemView.findViewById(R.id.tvAddress);
@@ -98,6 +96,7 @@ public class V2XScenarioHistoryIllegalParkVH extends V2XBaseViewHolder<V2XHistor
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
v2XHistoryScenarioData.setEventJsonDataHashCode(mOldScenarioData.getEventJsonDataHashCode());
v2XHistoryScenarioData.setDispose(true);
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData);
mOldScenarioData.setDispose(true);

View File

@@ -7,8 +7,6 @@ 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;
@@ -37,7 +35,7 @@ import static android.view.View.VISIBLE;
*
* @author donghongyu
*/
public class V2XScenarioHistoryOtherSeekHelpVH extends V2XBaseViewHolder<V2XHistoryScenarioData> {
public class V2XScenarioHistoryOtherSeekHelpVH extends V2XHistoryBaseViewHolder<V2XHistoryScenarioData> {
private TextView mTagEventType;
private TextView mTagEventEvaluate;
@@ -54,7 +52,7 @@ public class V2XScenarioHistoryOtherSeekHelpVH extends V2XBaseViewHolder<V2XHist
private V2XHistoryScenarioData mOldScenarioData;
public V2XScenarioHistoryOtherSeekHelpVH(@NonNull ViewGroup viewGroup) {
public V2XScenarioHistoryOtherSeekHelpVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_scennario_history_other_help, viewGroup, false));
mTagEventType = itemView.findViewById(R.id.tagEventType);
@@ -170,6 +168,7 @@ public class V2XScenarioHistoryOtherSeekHelpVH extends V2XBaseViewHolder<V2XHist
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
v2XHistoryScenarioData.setEventJsonDataHashCode(mOldScenarioData.getEventJsonDataHashCode());
v2XHistoryScenarioData.setDispose(true);
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData);
mOldScenarioData.setDispose(true);

View File

@@ -6,8 +6,6 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XHistoryScenarioData;
import com.mogo.module.v2x.R;
@@ -26,7 +24,7 @@ import com.mogo.utils.network.utils.GsonUtil;
*
* @author donghongyu
*/
public class V2XScenarioHistoryRoadEventVH extends V2XBaseViewHolder<V2XHistoryScenarioData> {
public class V2XScenarioHistoryRoadEventVH extends V2XHistoryBaseViewHolder<V2XHistoryScenarioData> {
private TextView mTvAddress;
private TextView mTvIllegalNum;
private ImageView mIvIconP;
@@ -39,7 +37,7 @@ public class V2XScenarioHistoryRoadEventVH extends V2XBaseViewHolder<V2XHistoryS
private MarkerExploreWay mExploreWay;
private V2XHistoryScenarioData mOldScenarioData;
public V2XScenarioHistoryRoadEventVH(@NonNull ViewGroup viewGroup) {
public V2XScenarioHistoryRoadEventVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_scennario_history, viewGroup, false));
mTvAddress = itemView.findViewById(R.id.tvAddress);
@@ -104,6 +102,7 @@ public class V2XScenarioHistoryRoadEventVH extends V2XBaseViewHolder<V2XHistoryS
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
v2XHistoryScenarioData.setEventJsonDataHashCode(mOldScenarioData.getEventJsonDataHashCode());
v2XHistoryScenarioData.setDispose(true);
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData);

View File

@@ -178,7 +178,7 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
//如果poiType是道路拥堵则调用接口查询拥堵状态
String poiType = v2XRoadEventEntity.getPoiType();
if(poiType != null && poiType.equals(FOURS_BLOCK_UP)){
if (poiType != null && poiType.equals(FOURS_BLOCK_UP)) {
V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus();
}
}
@@ -320,11 +320,11 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
/**
* 存储本地数据
*
* @param markerExploreWay 要存储的场景
* @param v2XRoadEventEntity 要存储的场景
*/
public void saveLocalStory(int scenarioType, Object markerExploreWay) {
public void saveLocalStory(int scenarioType, MarkerExploreWay v2XRoadEventEntity) {
try {
V2XSQLiteUtils.saveLocalStory(scenarioType,markerExploreWay);
V2XSQLiteUtils.saveLocalStory(scenarioType, v2XRoadEventEntity, v2XRoadEventEntity.hashCode());
} catch (Exception e) {
e.printStackTrace();
}

View File

@@ -7,20 +7,14 @@ 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.V2XHistoryScenarioData;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.manager.IMoGoV2XStatusManager;
import com.mogo.module.v2x.scenario.IV2XScenario;
import com.mogo.module.v2x.scenario.view.IV2XButton;
import com.mogo.module.v2x.scenario.view.IV2XMarker;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
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.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
/**
* author : donghongyu
@@ -34,11 +28,9 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
private IV2XWindow mV2XWindow;
private IV2XButton mV2XButton;
private IV2XMarker mV2XMarker;
private IMoGoV2XStatusManager mV2XStatusManager;
private V2XMessageEntity<T> mV2XMessageEntity;
protected AbsV2XScenario() {
this.mV2XStatusManager = V2XServiceManager.getMoGoV2XStatusManager();
}
public abstract void init(@Nullable V2XMessageEntity<T> v2XMessageEntity);
@@ -50,6 +42,16 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
clearPOI();
}
/**
* 释放资源
*/
public void release() {
mV2XMessageEntity = null;
mV2XWindow = null;
mV2XButton = null;
mV2XMarker = null;
}
@Override
public void speakTTSVoice(@Nullable String msg, IMogoVoiceCmdCallBack callBack) {
if (!TextUtils.isEmpty(msg)) {
@@ -97,18 +99,4 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
}
return mV2XMessageEntity.equals(v2XMessageEntity);
}
/**
* 存储本地数据
*
* @param markerExploreWay 要存储的场景
*/
public void saveLocalStory(int scenarioType, Object markerExploreWay) {
try {
V2XSQLiteUtils.saveLocalStory(scenarioType,markerExploreWay);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -22,9 +22,6 @@ import com.mogo.module.v2x.scenario.scene.ugc.V2XEventUgcScenario;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import java.util.HashMap;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -37,8 +34,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XScenarioManager implements IV2XScenarioManager {
private static V2XScenarioManager mV2XScenarioManager;
private AbsV2XScenario mV2XScenario;
private HashMap<Integer, AbsV2XScenario> mV2XScenarioSet = new HashMap<>();
private AbsV2XScenario mV2XScenario = null;
private V2XScenarioManager() {
}
@@ -64,55 +60,50 @@ public class V2XScenarioManager implements IV2XScenarioManager {
V2XUtils.runOnUiThread(() -> {
// 提取之前存储的场景
if (v2XMessageEntity != null) {
// 广播给应用内部其它模块
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
mV2XScenario = mV2XScenarioSet.get(v2XMessageEntity.getType());
// 如果没有拿到之前的,根据类型分发
if (mV2XScenario == null) {
switch (v2XMessageEntity.getType()) {
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
mV2XScenario = V2XRoadEventScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
mV2XScenario = V2XSeekHelpScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
mV2XScenario = V2XFatigueDrivingScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
mV2XScenario = V2XPushEventScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING:
mV2XScenario = V2XPushLiveCarScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_ANIMATION_WARNING:
mV2XScenario = V2XAnimationScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP:
mV2XScenario = V2XCarForHelpScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
mV2XScenario = V2XIllegalParkScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
mV2XScenario = V2XEventUgcScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW:
mV2XScenario = V2XVoiceCallLiveScenario.getInstance();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW:
mV2XScenario = V2XPushVREventScenario.getInstance();
break;
default:
Logger.e(MODULE_NAME, "当前V2X消息类型未定义。");
TipToast.tip("当前V2X消息类型未定义");
return;
}
switch (v2XMessageEntity.getType()) {
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
mV2XScenario = new V2XRoadEventScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
mV2XScenario = new V2XSeekHelpScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
mV2XScenario = new V2XFatigueDrivingScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
mV2XScenario = new V2XPushEventScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING:
mV2XScenario = new V2XPushLiveCarScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_ANIMATION_WARNING:
mV2XScenario = new V2XAnimationScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP:
mV2XScenario = new V2XCarForHelpScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
mV2XScenario = new V2XIllegalParkScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
mV2XScenario = new V2XEventUgcScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW:
mV2XScenario = new V2XVoiceCallLiveScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW:
mV2XScenario = new V2XPushVREventScenario();
break;
default:
mV2XScenario = null;
Logger.e(MODULE_NAME, "当前V2X消息类型未定义。");
TipToast.tip("当前V2X消息类型未定义");
return;
}
// 展示最新的消息
@@ -121,7 +112,6 @@ public class V2XScenarioManager implements IV2XScenarioManager {
hidOtherPanel();
}
mV2XScenario.init(v2XMessageEntity);
mV2XScenarioSet.put(v2XMessageEntity.getType(), mV2XScenario);
}
}
});

View File

@@ -0,0 +1,48 @@
package com.mogo.module.v2x.scenario.scene;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
import com.mogo.utils.logger.Logger;
/**
* @author donghongyu
* @date 12/11/20 10:35 AM
*/
public class V2XBasWindow extends RelativeLayout {
private final String TAG = "V2XBasWindow";
public V2XBasWindow(Context context) {
super(context);
}
public V2XBasWindow(Context context, AttributeSet attrs) {
super(context, attrs);
}
public V2XBasWindow(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
Logger.w(TAG, "onAttachedToWindow……");
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
Logger.w(TAG, "onDetachedFromWindow……");
release();
}
/**
* 这里释放资源
*/
protected void release() {
Logger.w(TAG, "release……");
}
}

View File

@@ -2,10 +2,10 @@ package com.mogo.module.v2x.scenario.scene.animation;
import androidx.annotation.Nullable;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.ADASUtils;
@@ -20,22 +20,8 @@ import com.mogo.utils.logger.Logger;
*/
public class V2XAnimationScenario extends AbsV2XScenario<V2XPushMessageEntity> {
private static V2XAnimationScenario mV2XAnimationScenario;
private V2XAnimationScenario() {
}
public static V2XAnimationScenario getInstance() {
if (mV2XAnimationScenario == null) {
synchronized (V2XAnimationScenario.class) {
if (mV2XAnimationScenario == null) {
mV2XAnimationScenario = new V2XAnimationScenario();
mV2XAnimationScenario.setV2XWindow(new V2XAnimationWindow());
}
}
}
return mV2XAnimationScenario;
public V2XAnimationScenario() {
setV2XWindow(new V2XAnimationWindow());
}
@Override

View File

@@ -6,11 +6,11 @@ import android.view.ViewGroup;
import androidx.annotation.Nullable;
import com.mogo.map.MogoLatLng;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
@@ -30,23 +30,11 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XFatigueDrivingScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
private static V2XFatigueDrivingScenario mV2XTiredScenario;
// 语音控制导航
private V2XVoiceCallbackListener mNaviCb = (command, intent) -> startNavi();
private V2XFatigueDrivingScenario() {
}
public static V2XFatigueDrivingScenario getInstance() {
if (mV2XTiredScenario == null) {
synchronized (V2XFatigueDrivingScenario.class) {
if (mV2XTiredScenario == null) {
mV2XTiredScenario = new V2XFatigueDrivingScenario();
mV2XTiredScenario.setV2XWindow(new V2XFatigueDrivingWindow());
}
}
}
return mV2XTiredScenario;
public V2XFatigueDrivingScenario() {
setV2XWindow(new V2XFatigueDrivingWindow());
}
@Override

View File

@@ -19,6 +19,7 @@ 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 com.mogo.utils.logger.Logger;
@@ -34,7 +35,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : 疲劳驾驶场景Window
* version: 1.0
*/
public class V2XFatigueDrivingWindow extends RelativeLayout
public class V2XFatigueDrivingWindow extends V2XBasWindow
implements IV2XWindow<V2XPushMessageEntity> {
// 展示列表
private RecyclerView mRecyclerView;
@@ -72,7 +73,7 @@ public class V2XFatigueDrivingWindow extends RelativeLayout
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
// 详情列表
mRecyclerView = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList,this);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);

View File

@@ -43,23 +43,12 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
private V2XSeekHelpDialog v2xFaultHelpDialog;
private V2XSeekHelpButton mV2XSeekHelpButton;
private V2XCarForHelpScenario() {
public V2XCarForHelpScenario() {
mV2XSeekHelpButton = new V2XSeekHelpButton();
setV2XButton(mV2XSeekHelpButton);
V2XServiceManager.getMoGoStatusManager().registerStatusChangedListener(TAG, StatusDescriptor.SEEK_HELPING, this);
}
public static V2XCarForHelpScenario getInstance() {
if (mV2XCarForHelpScenario == null) {
synchronized (V2XCarForHelpScenario.class) {
if (mV2XCarForHelpScenario == null) {
mV2XCarForHelpScenario = new V2XCarForHelpScenario();
}
}
}
return mV2XCarForHelpScenario;
}
@Override
public void init(@Nullable V2XMessageEntity<Boolean> v2XMessageEntity) {
// 设置Button的显示

View File

@@ -9,16 +9,12 @@ import androidx.annotation.Nullable;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.ADASUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* author : donghongyu
@@ -29,21 +25,8 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XPushLiveCarScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
private static V2XPushLiveCarScenario mV2XLiveCarScenario;
private V2XPushLiveCarScenario() {
}
public static V2XPushLiveCarScenario getInstance() {
if (mV2XLiveCarScenario == null) {
synchronized (V2XPushLiveCarScenario.class) {
if (mV2XLiveCarScenario == null) {
mV2XLiveCarScenario = new V2XPushLiveCarScenario();
mV2XLiveCarScenario.setV2XWindow(new V2XPushLiveCarWindow());
}
}
}
return mV2XLiveCarScenario;
public V2XPushLiveCarScenario() {
setV2XWindow(new V2XPushLiveCarWindow());
}
@Override

View File

@@ -14,6 +14,7 @@ import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.MarkerUtils;
import com.mogo.module.v2x.view.V2XLiveGSYVideoView;
@@ -29,7 +30,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : TODO 演示使用的推送单车机直播场景
* version: 1.0
*/
public class V2XPushLiveCarWindow extends RelativeLayout implements IV2XWindow<V2XPushMessageEntity> {
public class V2XPushLiveCarWindow extends V2XBasWindow implements IV2XWindow<V2XPushMessageEntity> {
private Context mContext;
private V2XLiveGSYVideoView mV2XLiveGSYVideoView;

View File

@@ -144,8 +144,8 @@ public class V2XRoadLiveCarScenario extends AbsV2XScenario<List<V2XEventShowEnti
// 警报状态true-警报中false-警报结束
V2XServiceManager.getMoGoV2XStatusManager().setRoadLiveCarWindowShow(TAG, false);
// 打开直播后,窗口倒计时暂停关闭,直播被关闭后继续倒计时
V2XRoadEventWindow window = (V2XRoadEventWindow) V2XRoadEventScenario.getInstance().getV2XWindow();
window.startCountDown();
// V2XRoadEventWindow window = (V2XRoadEventWindow) V2XRoadEventScenario.getInstance().getV2XWindow();
// window.startCountDown();
// 重置场景提示的消息
setV2XMessageEntity(null);
// 关闭场景提示

View File

@@ -18,19 +18,16 @@ 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 com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.module.v2x.voice.V2XVoicePagingListener;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import java.util.ArrayList;
import java.util.List;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
@@ -38,7 +35,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : 道路预警中的直播场景
* version: 1.0
*/
public class V2XRoadLiveCarWindow extends RelativeLayout
public class V2XRoadLiveCarWindow extends V2XBasWindow
implements IV2XWindow<List<V2XEventShowEntity>> {
private String TAG = "V2XRoadEventDetailWindow";
private TextView mTvEventStubClose;
@@ -105,7 +102,7 @@ public class V2XRoadLiveCarWindow extends RelativeLayout
close();
});
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);

View File

@@ -107,8 +107,8 @@ public class V2XVoiceCallLiveBiz {
return;
}
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(liveCarSn, null);
V2XVoiceCallLiveScenario.getInstance().setV2XWindow(new V2XVoiceCallLiveCarWindow());
V2XVoiceCallLiveScenario.getInstance().init(v2XMessageEntity);
// V2XVoiceCallLiveScenario.getInstance().setV2XWindow(new V2XVoiceCallLiveCarWindow());
// V2XVoiceCallLiveScenario.getInstance().init(v2XMessageEntity);
}
public void getOpenRoadCameraLive() {
@@ -122,8 +122,8 @@ public class V2XVoiceCallLiveBiz {
if (result != null && result.getResult().getUrl() != null) {
String liveUrl = result.getResult().getUrl();
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(null, liveUrl);
V2XVoiceCallLiveScenario.getInstance().setV2XWindow(new V2XVoiceCrossRoadLiveWindow());
V2XVoiceCallLiveScenario.getInstance().init(v2XMessageEntity);
// V2XVoiceCallLiveScenario.getInstance().setV2XWindow(new V2XVoiceCrossRoadLiveWindow());
// V2XVoiceCallLiveScenario.getInstance().init(v2XMessageEntity);
} else {
Logger.d(MODULE_NAME, "getOpenRoadCameraLive 路口实况直播地址为空");
}

View File

@@ -14,13 +14,14 @@ import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.view.V2XCarLiveVideoView;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
public class V2XVoiceCallLiveCarWindow extends RelativeLayout
public class V2XVoiceCallLiveCarWindow extends V2XBasWindow
implements IV2XWindow<V2XPushMessageEntity> {
private V2XCarLiveVideoView mV2XCarLiveVideoView;

View File

@@ -24,23 +24,10 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XVoiceCallLiveScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
private V2XVoiceCallLiveScenario() {
public V2XVoiceCallLiveScenario() {
}
private static volatile V2XVoiceCallLiveScenario mV2XVoiceCallLiveCarScenario;
public static V2XVoiceCallLiveScenario getInstance() {
if (mV2XVoiceCallLiveCarScenario == null) {
synchronized (V2XVoiceCallLiveScenario.class) {
if (mV2XVoiceCallLiveCarScenario == null) {
mV2XVoiceCallLiveCarScenario = new V2XVoiceCallLiveScenario();
}
}
}
return mV2XVoiceCallLiveCarScenario;
}
@Override
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
if (v2XMessageEntity == null) {

View File

@@ -14,13 +14,14 @@ import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.view.V2XCrossRoadVideoView;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
public class V2XVoiceCrossRoadLiveWindow extends RelativeLayout
public class V2XVoiceCrossRoadLiveWindow extends V2XBasWindow
implements IV2XWindow<V2XPushMessageEntity> {
private V2XCrossRoadVideoView mV2XCrossRoadVideoView;

View File

@@ -12,6 +12,7 @@ import com.mogo.module.v2x.alarm.V2XAlarmServer;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.ADASUtils;
import com.mogo.module.v2x.utils.TrackUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import java.util.ArrayList;
import java.util.List;
@@ -27,19 +28,9 @@ import java.util.List;
public class V2XIllegalParkScenario extends AbsV2XScenario<List<MarkerExploreWay>> {
private static final String TAG = "V2XILLegalParkScenario";
private static V2XIllegalParkScenario mV2XIllegalParkScenario;
public static V2XIllegalParkScenario getInstance() {
if (mV2XIllegalParkScenario == null) {
synchronized (V2XIllegalParkScenario.class) {
if (mV2XIllegalParkScenario == null) {
mV2XIllegalParkScenario = new V2XIllegalParkScenario();
mV2XIllegalParkScenario.setV2XWindow(new V2XIllegalParkWindow());
mV2XIllegalParkScenario.setV2XMarker(new V2XIllegalParkMarker());
}
}
}
return mV2XIllegalParkScenario;
public V2XIllegalParkScenario() {
setV2XWindow(new V2XIllegalParkWindow());
setV2XMarker(new V2XIllegalParkMarker());
}
@Override
@@ -113,4 +104,16 @@ public class V2XIllegalParkScenario extends AbsV2XScenario<List<MarkerExploreWay
public void clearPOI() {
}
/**
* 存储本地数据
*
* @param messageEntity 要存储的场景
*/
private void saveLocalStory(int scenarioType, MarkerExploreWay messageEntity) {
try {
V2XSQLiteUtils.saveLocalStory(scenarioType, messageEntity, messageEntity.hashCode());
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -6,7 +6,6 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -17,13 +16,12 @@ import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
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 com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.List;
@@ -32,7 +30,7 @@ import java.util.List;
* 违章停车
* 弹窗视图
*/
public class V2XIllegalParkWindow extends RelativeLayout implements IV2XWindow<MarkerExploreWay> {
public class V2XIllegalParkWindow extends V2XBasWindow implements IV2XWindow<MarkerExploreWay> {
private static final String TAG = "V2XIllegalParkWindow";
// 展示列表
private RecyclerView mRecyclerView;
@@ -73,7 +71,7 @@ public class V2XIllegalParkWindow extends RelativeLayout implements IV2XWindow<M
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
// 详情列表
mRecyclerView = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);

View File

@@ -27,25 +27,12 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XPushEventScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
private static V2XPushEventScenario mV2XPushEventScenario;
private V2XPushEventScenario() {
public V2XPushEventScenario() {
setV2XMarker(new V2XPushEventMarker());
setV2XWindow(new V2XPushEventWindow());
}
public static V2XPushEventScenario getInstance() {
if (mV2XPushEventScenario == null) {
synchronized (V2XPushEventScenario.class) {
if (mV2XPushEventScenario == null) {
mV2XPushEventScenario = new V2XPushEventScenario();
mV2XPushEventScenario.setV2XMarker(new V2XPushEventMarker());
mV2XPushEventScenario.setV2XWindow(new V2XPushEventWindow());
}
}
}
return mV2XPushEventScenario;
}
@Override
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
Logger.w(MODULE_NAME, "处理推送场景:" + GsonUtil.jsonFromObject(v2XMessageEntity));

View File

@@ -6,7 +6,6 @@ import android.os.Handler;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -20,6 +19,7 @@ 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 com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
@@ -39,7 +39,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* TODO 目前睡前瞻推送使用的消息都在这里展示
* version: 1.0
*/
public class V2XPushEventWindow extends RelativeLayout implements IV2XWindow<V2XPushMessageEntity> {
public class V2XPushEventWindow extends V2XBasWindow implements IV2XWindow<V2XPushMessageEntity> {
private String TAG = "V2XPushEventDetailWindow";
// 展示列表
private RecyclerView mRecyclerView;
@@ -82,7 +82,7 @@ public class V2XPushEventWindow extends RelativeLayout implements IV2XWindow<V2X
LayoutInflater.from(context).inflate(R.layout.window_push_event_detail, this);
// 详情列表
mRecyclerView = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);

View File

@@ -25,25 +25,11 @@ public class V2XPushVREventScenario
implements IMogoTopViewStatusListener {
private String TAG = "V2XPushVREventWindow";
private static V2XPushVREventScenario mV2XPushEventScenario;
private V2XPushVREventScenario() {
public V2XPushVREventScenario() {
setV2XMarker(new V2XPushVREventMarker());
setV2XWindow(new V2XPushVREventWindow());
}
public static V2XPushVREventScenario getInstance() {
if (mV2XPushEventScenario == null) {
synchronized (V2XPushVREventScenario.class) {
if (mV2XPushEventScenario == null) {
mV2XPushEventScenario = new V2XPushVREventScenario();
mV2XPushEventScenario.setV2XMarker(new V2XPushVREventMarker());
mV2XPushEventScenario.setV2XWindow(new V2XPushVREventWindow());
}
}
}
return mV2XPushEventScenario;
}
@Override
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "处理推送VR场景" + GsonUtil.jsonFromObject(v2XMessageEntity));

View File

@@ -29,23 +29,11 @@ import java.util.Map;
*/
public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> implements IMogoTopViewStatusListener {
private static final String TAG = "V2XRoadEventScenario";
private static V2XRoadEventScenario mV2XRoadEventScenario;
private V2XRoadEventScenario() {
}
public static V2XRoadEventScenario getInstance() {
if (mV2XRoadEventScenario == null) {
synchronized (V2XRoadEventScenario.class) {
if (mV2XRoadEventScenario == null) {
mV2XRoadEventScenario = new V2XRoadEventScenario();
mV2XRoadEventScenario.setV2XButton(new V2XRoadEventButton());
mV2XRoadEventScenario.setV2XMarker(new V2XRoadEventMarker());
mV2XRoadEventScenario.setV2XWindow(new V2XRoadEventWindow());
}
}
}
return mV2XRoadEventScenario;
public V2XRoadEventScenario() {
setV2XButton(new V2XRoadEventButton());
setV2XMarker(new V2XRoadEventMarker());
setV2XWindow(new V2XRoadEventWindow());
}
@Override
@@ -201,7 +189,8 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
@Override
public void onViewRemoved(View view) {
//Logger.d(MODULE_NAME, "关闭 Window 动画结束");
Logger.d(V2XConst.MODULE_NAME, "关闭 Window 动画结束");
release();
}
@Override

View File

@@ -6,35 +6,33 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
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.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.v2x.entity.net.V2XLiveCarRes;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.network.V2XRefreshCallback;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.module.v2x.voice.V2XVoicePagingListener;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.List;
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_BLOCK_UP;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* author : donghongyu
@@ -43,7 +41,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : 显示事件的列表
* version: 1.0
*/
public class V2XRoadEventWindow extends RelativeLayout
public class V2XRoadEventWindow extends V2XBasWindow
implements V2XRefreshCallback<V2XLiveCarRes>, IV2XWindow<V2XRoadEventEntity> {
private String TAG = "V2XRoadEventDetailWindow";
// 关闭按钮
@@ -53,11 +51,11 @@ public class V2XRoadEventWindow extends RelativeLayout
// 列表数据适配器
private V2XRoadEventAdapter mV2XRoadEventAdapter;
// 列表展示
private List<V2XEventShowEntity> mItemList = new ArrayList<>();
private final List<V2XEventShowEntity> mItemList = new ArrayList<>();
// 当前展示的位置
private int mCurPosition;
// 处理道路事件30秒倒计时
private Handler handlerV2XEvent = new Handler();
private final Handler handlerV2XEvent = new Handler();
private Runnable runnableV2XEvent;
private int mExpireTime = 20000;
// 关闭弹窗回调
@@ -103,7 +101,8 @@ public class V2XRoadEventWindow extends RelativeLayout
private void initView(Context context) {
//Logger.d(MODULE_NAME, "V2X===初始化道路事件小窗口View。。。。。");
// 填充布局
LayoutInflater.from(context).inflate(R.layout.window_road_event_detail, this);
LayoutInflater.from(context).inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
R.layout.window_road_event_detail_vr : R.layout.window_road_event_detail, this);
// 详情列表
mBtnCloseWindow = findViewById(R.id.btnCloseWindow);
// 详情列表
@@ -116,7 +115,7 @@ public class V2XRoadEventWindow extends RelativeLayout
}
});
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
@@ -205,8 +204,6 @@ public class V2XRoadEventWindow extends RelativeLayout
@Override
public void onSuccess(V2XLiveCarRes result) {
// TODO 这里是测试数据
//result = TestOnLineCarUtils.queryNearbyVehicleLiveByLocation();
//Logger.d(MODULE_NAME, "V2X===事件周边的直播车机:" + result);
try {
if (!mItemList.isEmpty() &&
@@ -299,4 +296,9 @@ public class V2XRoadEventWindow extends RelativeLayout
runnableV2XEvent = null;
}
}
@Override
protected void release() {
super.release();
}
}

View File

@@ -16,6 +16,7 @@ import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.view.SimpleCoverVideoPlayer;
import com.mogo.utils.BitmapHelper;
@@ -31,7 +32,7 @@ import static com.shuyu.gsyvideoplayer.utils.GSYVideoType.SCREEN_MATCH_FULL;
/**
* https://github.com/CarGuo/GSYVideoPlayer/tree/master/doc SimpleCoverVideoPlayer文档
*/
public class V2XRoadVideoWindow extends RelativeLayout implements
public class V2XRoadVideoWindow extends V2XBasWindow implements
IV2XWindow, IDestroyable {
private static final String TAG = "V2XRoadVideoWindow";
@@ -68,7 +69,7 @@ public class V2XRoadVideoWindow extends RelativeLayout implements
}
private void initView(Context context) {
LayoutInflater.from(mContext).inflate(R.layout.window_road_video_layout, this);
LayoutInflater.from(mContext).inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.layout.window_road_video_layout_vr : R.layout.window_road_video_layout, this);
playImageView = this.findViewById(R.id.window_video_play);
thumbnailImage = this.findViewById(R.id.thumbnail_image);
simpleCoverVideoPlayer = this.findViewById(R.id.roadVideoView);

View File

@@ -14,6 +14,7 @@ import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.ADASUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.entrance.IMogoEntranceButtonController;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
@@ -32,22 +33,10 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> implements IMogoTopViewStatusListener {
private volatile static V2XSeekHelpScenario mV2XSeekHelpScenario;
private V2XSeekHelpScenario() {
}
public static V2XSeekHelpScenario getInstance() {
if (mV2XSeekHelpScenario == null) {
synchronized (V2XSeekHelpScenario.class) {
if (mV2XSeekHelpScenario == null) {
mV2XSeekHelpScenario = new V2XSeekHelpScenario();
mV2XSeekHelpScenario.setV2XWindow(new V2XSeekHelpWindow());
mV2XSeekHelpScenario.setV2XMarker(new V2XSeekHelpMarker());
}
}
}
return mV2XSeekHelpScenario;
public V2XSeekHelpScenario() {
setV2XWindow(new V2XSeekHelpWindow());
setV2XMarker(new V2XSeekHelpMarker());
}
private List<V2XMarkerEntity> mMarkerEntity;
@@ -176,4 +165,17 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
setV2XMessageEntity(null);
clearPOI();
}
/**
* 存储本地数据
*
* @param messageEntity 要存储的场景
*/
private void saveLocalStory(int scenarioType, V2XPushMessageEntity messageEntity) {
try {
V2XSQLiteUtils.saveLocalStory(scenarioType, messageEntity, messageEntity.hashCode());
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -19,6 +19,7 @@ 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 com.mogo.utils.logger.Logger;
@@ -34,7 +35,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : 他人发起的故障求助
* version: 1.0
*/
public class V2XSeekHelpWindow extends ConstraintLayout implements IV2XWindow<V2XPushMessageEntity> {
public class V2XSeekHelpWindow extends V2XBasWindow implements IV2XWindow<V2XPushMessageEntity> {
private static final String TAG = "V2XSeekHelpWindow";
// 展示列表
@@ -73,7 +74,7 @@ public class V2XSeekHelpWindow extends ConstraintLayout implements IV2XWindow<V2
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
// 详情列表
mRecyclerView = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
@@ -114,6 +115,11 @@ public class V2XSeekHelpWindow extends ConstraintLayout implements IV2XWindow<V2
@Override
public void close() {
//Logger.d(TAG, "移除window= " + this);
// 停止倒计时
if (handlerV2XEvent != null && runnableV2XEvent != null) {
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
runnableV2XEvent = null;
}
//移除窗体
V2XServiceManager
.getMogoTopViewManager()

View File

@@ -190,6 +190,12 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
// 存储本地,出行动态作展示
saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING,
v2XMessageEntity.getContent().getNoveltyInfo());
});
mBtnTriggerPushEvent.setOnClickListener(v -> {
@@ -334,4 +340,16 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
});
}
/**
* 存储本地数据
*
* @param v2XRoadEventEntity 要存储的场景
*/
public void saveLocalStory(int scenarioType, MarkerExploreWay v2XRoadEventEntity) {
try {
V2XSQLiteUtils.saveLocalStory(scenarioType, v2XRoadEventEntity, v2XRoadEventEntity.hashCode());
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -15,8 +15,6 @@ import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
@@ -28,21 +26,8 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XEventUgcScenario extends AbsV2XScenario<V2XRoadEventEntity> implements IMogoTopViewStatusListener {
private static V2XEventUgcScenario mV2XTiredScenario;
private V2XEventUgcScenario() {
}
public static V2XEventUgcScenario getInstance() {
if (mV2XTiredScenario == null) {
synchronized (V2XEventUgcScenario.class) {
if (mV2XTiredScenario == null) {
mV2XTiredScenario = new V2XEventUgcScenario();
mV2XTiredScenario.setV2XWindow(new V2XEventUgcWindow());
}
}
}
return mV2XTiredScenario;
public V2XEventUgcScenario() {
setV2XWindow(new V2XEventUgcWindow());
}
@Override

View File

@@ -19,6 +19,7 @@ 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 com.mogo.utils.logger.Logger;
@@ -36,7 +37,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443
* version: 1.0
*/
public class V2XEventUgcWindow extends RelativeLayout
public class V2XEventUgcWindow extends V2XBasWindow
implements IV2XWindow<V2XRoadEventEntity> {
// 展示列表
private RecyclerView mRecyclerView;
@@ -74,7 +75,7 @@ public class V2XEventUgcWindow extends RelativeLayout
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
// 详情列表
mRecyclerView = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);

View File

@@ -4,9 +4,11 @@ import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.marker.PoiWrapper;
import com.mogo.module.common.utils.CloudPoiManager;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.utils.logger.Logger;
/**
* @ProjectName: MoGoModulSafeDriving
* @Package: com.mogo.module.v2x.utils
@@ -92,6 +94,37 @@ public class EventTypeUtils {
* @return 背景
*/
public static int getPoiTypeBg(String poiType) {
int strBg;
switch (poiType) {
case V2XPoiTypeEnum.FOURS_PARKING: // 停车场
case V2XPoiTypeEnum.GAS_STATION: // 加油站
strBg = R.drawable.bg_v2x_event_type_blue;
break;
case V2XPoiTypeEnum.FOURS_BLOCK_UP: // 拥堵
case V2XPoiTypeEnum.FOURS_LIVING: // 实时路况
case V2XPoiTypeEnum.FOURS_NEALY: // 身边
strBg = V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.drawable.bg_v2x_event_type_orange_vr : R.drawable.bg_v2x_event_type_orange;
break;
case V2XPoiTypeEnum.TRAFFIC_CHECK:// 交通检查
case V2XPoiTypeEnum.ROAD_CLOSED:// 封路
case V2XPoiTypeEnum.FOURS_ROAD_WORK:// 施工
case V2XPoiTypeEnum.FOURS_PONDING:// 积水
case V2XPoiTypeEnum.FOURS_FOG: // 浓雾
case V2XPoiTypeEnum.FOURS_ICE: // 结冰
case V2XPoiTypeEnum.FOURS_ACCIDENT: // 事故
strBg = V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.drawable.bg_v2x_event_type_red_vr : R.drawable.bg_v2x_event_type_read;
break;
default:
strBg = V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.drawable.bg_v2x_event_type_red_vr : R.drawable.bg_v2x_event_type_read;
break;
}
return strBg;
}
/*
* VR模式下道路类型影响到分享列表 (VR模式暂时没有事件面板,所以可以删除此方法,公用上边的getPoiTypeBg)
* */
public static int getPoiTypeBgForShareItem(String poiType) {
int strBg;
switch (poiType) {
case V2XPoiTypeEnum.FOURS_PARKING: // 停车场
@@ -119,7 +152,6 @@ public class EventTypeUtils {
return strBg;
}
/**
* 判断是否是道路预警事件
*

View File

@@ -135,6 +135,7 @@ public class V2XSQLiteUtils {
newScenarioData.setDispose(true);
newScenarioData.setTriggerTime(TimeUtils.getNowMills());
newScenarioData.setEventJsonData(oldScenarioData.getEventJsonData());
newScenarioData.setEventJsonDataHashCode(oldScenarioData.getEventJsonDataHashCode());
newScenarioData.setScenarioType(oldScenarioData.getScenarioType());
int result = getScenarioHistoryDao().update(oldScenarioData, newScenarioData);
@@ -150,15 +151,19 @@ public class V2XSQLiteUtils {
*
* @param markerExploreWay 要存储的场景
*/
public static void saveLocalStory(int scenarioType, Object markerExploreWay) {
public static void saveLocalStory(int scenarioType, Object markerExploreWay, int hashCode) {
try {
Logger.d(V2XConst.MODULE_NAME, "saveLocalStory" + markerExploreWay);
// 进行数据库存储
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
v2XHistoryScenarioData.setScenarioType(scenarioType);
v2XHistoryScenarioData.setEventJsonData(GsonUtil.jsonFromObject(markerExploreWay));
v2XHistoryScenarioData.setEventJsonDataHashCode(hashCode);
List<V2XHistoryScenarioData> historyScenarioData = getTargetScenarioHistoryData(v2XHistoryScenarioData);
v2XHistoryScenarioData.setEventJsonData(GsonUtil.jsonFromObject(markerExploreWay));
v2XHistoryScenarioData.setTriggerTime(TimeUtils.getNowMills());
v2XHistoryScenarioData.setDispose(false);

View File

@@ -13,6 +13,8 @@ import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
/**
* 红心点赞按钮控件
@@ -44,7 +46,7 @@ public class HeartLikeView extends LinearLayout implements Animator.AnimatorList
inflate(context, R.layout.view_heart_like_gray_back, this);
mIllegalParkingLike = findViewById(R.id.ivLikeForGrayBack);
} else {
inflate(context, R.layout.view_heart_like, this);
inflate(context, V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.layout.view_heart_like_vr : R.layout.view_heart_like, this);
mIllegalParkingLike = findViewById(R.id.ivIllegalParkingLike);
}
@@ -73,6 +75,9 @@ public class HeartLikeView extends LinearLayout implements Animator.AnimatorList
if (mOnClickCallListener != null) {
mOnClickCallListener.onClicked(HeartLikeView.this);
}
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
mIllegalParkingLike.setImageResource(R.drawable.module_common_icon_like_selected_vr);
}
}
@Override

View File

@@ -12,6 +12,8 @@ import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
/**
* 不喜欢按钮控件
@@ -35,7 +37,7 @@ public class HeartUnLikeView extends LinearLayout implements Animator.AnimatorLi
public HeartUnLikeView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
inflate(context, R.layout.view_heart_unlike, this);
inflate(context, V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.layout.view_heart_unlike_vr : R.layout.view_heart_unlike, this);
mIllegalParkingUnLike = findViewById(R.id.ivIllegalParkingUnLike);
setOnClickListener(v -> {
@@ -43,8 +45,7 @@ public class HeartUnLikeView extends LinearLayout implements Animator.AnimatorLi
isAnimator = true;
if (mAnimatorSet == null) {
mAnimatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(getContext(),
R.anim.v2x_unlike_heart_animation);
mAnimatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(getContext(), R.anim.v2x_unlike_heart_animation);
mAnimatorSet.setTarget(mIllegalParkingUnLike);
mAnimatorSet.addListener(this);
}
@@ -64,6 +65,9 @@ public class HeartUnLikeView extends LinearLayout implements Animator.AnimatorLi
if (mOnClickCallListener != null) {
mOnClickCallListener.onClicked(HeartUnLikeView.this);
}
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
mIllegalParkingUnLike.setImageResource(R.drawable.module_common_icon_unlike_selected_vr);
}
}
@Override