优化了V2X的UI适配
2
.idea/misc.xml
generated
@@ -4,7 +4,7 @@
|
||||
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
|
||||
<groovy codeStyle="LEGACY" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,210 @@
|
||||
package com.mogo.module.v2x.adapter.holder;
|
||||
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
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.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.utils.ChartingUtil;
|
||||
import com.mogo.module.v2x.utils.RoadConditionUtils;
|
||||
import com.mogo.module.v2x.utils.ToastUtils;
|
||||
import com.mogo.module.v2x.utils.TrackUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
/**
|
||||
* V2X展示视图公用的实现
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public abstract class V2XBaseViewHolder
|
||||
extends RecyclerView.ViewHolder
|
||||
implements IMogoNaviListener {
|
||||
|
||||
public V2XBaseViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
/**
|
||||
* 延迟关闭窗体视图
|
||||
*/
|
||||
public abstract void delayedCloseWindow();
|
||||
|
||||
/**
|
||||
* 点赞
|
||||
*/
|
||||
public void triggerZan(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已点赞", null);
|
||||
showTip("已点赞");
|
||||
if (noveltyInfo != null) {
|
||||
V2XServiceManager.getV2XMarkerService()
|
||||
.getV2XRefreshModel()
|
||||
.giveLikeLiveVideo(null, noveltyInfo.getSn());
|
||||
|
||||
TrackUtils.trackV2xRoadEvent(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getSn(),
|
||||
V2XConst.V2X_ROAD_ZAN);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 打电话
|
||||
*/
|
||||
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();
|
||||
ToastUtils.showShort("用户信息异常");
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况错误
|
||||
*/
|
||||
public void triggerReportErr(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
RoadConditionUtils.sendDataErrorReceiverInfo(
|
||||
noveltyInfo.getPoiType(),
|
||||
noveltyInfo.getInfoId(),
|
||||
"1");
|
||||
|
||||
TrackUtils.trackV2xRoadEvent(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getSn(),
|
||||
V2XConst.V2X_ROAD_REPORT_ERROR);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ToastUtils.showShort("路况信息异常");
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况正确
|
||||
*/
|
||||
public void triggerReportTrue(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
RoadConditionUtils.sendDataErrorReceiverInfo(
|
||||
noveltyInfo.getPoiType(),
|
||||
noveltyInfo.getInfoId(),
|
||||
"2");
|
||||
|
||||
TrackUtils.trackV2xRoadEvent(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getSn(),
|
||||
V2XConst.V2X_ROAD_REPORT_RIGHT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ToastUtils.showShort("路况信息异常");
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航规划路线
|
||||
*/
|
||||
public void triggerStartNavi(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
MogoLatLng endPoint = new MogoLatLng(
|
||||
noveltyInfo.getLocation().getLat(),
|
||||
noveltyInfo.getLocation().getLon());
|
||||
|
||||
V2XServiceManager.getNavi().naviTo(endPoint);
|
||||
V2XServiceManager.getMogoRegisterCenter().unregisterMogoNaviListener(MODULE_NAME);
|
||||
V2XServiceManager.getMogoRegisterCenter().registerMogoNaviListener(MODULE_NAME, this);
|
||||
|
||||
TrackUtils.trackV2xRoadEvent(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getSn(),
|
||||
V2XConst.V2X_ROAD_NAVI);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ToastUtils.showShort("路况信息异常");
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示自定义 Toast
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public void showTip(String msg) {
|
||||
ToastUtils.setGravity(Gravity.CENTER, 0, 0);
|
||||
View toastView = LayoutInflater.from(V2XServiceManager.getContext()).inflate(R.layout.toast_view, null);
|
||||
TextView msgView = toastView.findViewById(R.id.tvFeedbackContent);
|
||||
msgView.setText(msg);
|
||||
ToastUtils.showCustomShort(toastView);
|
||||
}
|
||||
|
||||
@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() {
|
||||
V2XServiceManager.getNavi().startNavi(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onoCalculateFailed() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic(MogoTraffic traffic) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,44 +1,19 @@
|
||||
package com.mogo.module.v2x.adapter.holder;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.common.entity.MarkerCarInfo;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerUserInfo;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XLiveCarInfoEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.common.entity.V2XLiveCarInfoEntity;
|
||||
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.road.V2XRoadEventScenario;
|
||||
import com.mogo.module.v2x.utils.ChartingUtil;
|
||||
import com.mogo.module.v2x.utils.ToastUtils;
|
||||
import com.mogo.module.v2x.utils.TrackUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.module.v2x.view.V2XLiveGSYVideoView;
|
||||
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.logger.Logger;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -47,15 +22,11 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
* desc : 直播类型的卡片
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XLiveVideoVH extends RecyclerView.ViewHolder {
|
||||
public class V2XLiveVideoVH extends V2XBaseViewHolder {
|
||||
|
||||
private V2XLiveGSYVideoView videoPlayer;
|
||||
private MogoImageView ivReportHead;
|
||||
|
||||
// 控制按钮
|
||||
private ImageView ivRoadCallChart;
|
||||
private ImageView ivRoadEventLike;
|
||||
|
||||
// 上传事件的用户信息
|
||||
private MarkerUserInfo mUserInfo = new MarkerUserInfo();
|
||||
// 直播车机数据
|
||||
@@ -63,55 +34,10 @@ public class V2XLiveVideoVH extends RecyclerView.ViewHolder {
|
||||
// 预警的道路事件数据
|
||||
private V2XRoadEventEntity mV2XRoadEventEntity;
|
||||
|
||||
// 拨打车聊聊语音回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackCallListener = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
if (mUserInfo != null && !TextUtils.isEmpty(mUserInfo.getSn())) {
|
||||
roadCallChart();
|
||||
}
|
||||
}
|
||||
};
|
||||
// 点赞语音回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackLickListener = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
if (mV2XLiveCarEntity != null) {
|
||||
handlerZan(mV2XLiveCarEntity.getSn());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public V2XLiveVideoVH(ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_live_video, viewGroup, false));
|
||||
videoPlayer = itemView.findViewById(R.id.videoPlayer);
|
||||
ivReportHead = itemView.findViewById(R.id.ivReportHead);
|
||||
|
||||
ivRoadCallChart = itemView.findViewById(R.id.ivRoadCallChart);
|
||||
ivRoadEventLike = itemView.findViewById(R.id.ivRoadEventLike);
|
||||
|
||||
// 设置视图状态监听
|
||||
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
|
||||
@Override
|
||||
public void onViewAttachedToWindow(View v) {
|
||||
//Logger.w(MODULE_NAME, "列表View V2XLiveVideoVH 触发 onViewAttachedToWindow");
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING,
|
||||
v2XVoiceCallbackCallListener)
|
||||
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN,
|
||||
v2XVoiceCallbackLickListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP,
|
||||
v2XVoiceCallbackCallListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP,
|
||||
v2XVoiceCallbackLickListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(View v) {
|
||||
//Logger.w(MODULE_NAME, "列表View V2XLiveVideoVH 触发 onViewDetachedFromWindow");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void initView(V2XEventShowEntity v2XLiveCarEntity) {
|
||||
@@ -126,119 +52,12 @@ public class V2XLiveVideoVH extends RecyclerView.ViewHolder {
|
||||
MarkerCarInfo.CarLiveInfo carLiveInfo = new MarkerCarInfo.CarLiveInfo();
|
||||
carLiveInfo.setVideoSn(v2XLiveCarEntity.getSn());
|
||||
videoPlayer.setCarLiveInfo(carLiveInfo);
|
||||
|
||||
ivRoadEventLike.setVisibility(VISIBLE);
|
||||
|
||||
ivRoadCallChart.setOnClickListener(v -> {
|
||||
ivRoadCallChart.setVisibility(GONE);
|
||||
roadCallChart();
|
||||
});
|
||||
ivRoadEventLike.setOnClickListener(v -> {
|
||||
handlerZan(v2XLiveCarEntity.getSn());
|
||||
});
|
||||
|
||||
requestUserInfo(v2XLiveCarEntity);
|
||||
}
|
||||
|
||||
private void roadCallChart() {
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
ChartingUtil.callChatting(mUserInfo, location);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求用户信息
|
||||
*
|
||||
* @param v2XLiveCarEntity 直播信息
|
||||
*/
|
||||
private void requestUserInfo(V2XLiveCarInfoEntity v2XLiveCarEntity) {
|
||||
Logger.d(MODULE_NAME, "上报事件的用户SN:" + v2XLiveCarEntity.getSn());
|
||||
TrackUtils.trackV2xRoadEvent(mV2XRoadEventEntity.getNoveltyInfo().getInfoId(), v2XLiveCarEntity.getSn(), V2XConst.V2X_ROAD_VIDEO);
|
||||
// 获取道路事件周边的直播车机
|
||||
if (!TextUtils.isEmpty(v2XLiveCarEntity.getSn())) {
|
||||
V2XServiceManager
|
||||
.getV2XRefreshModel()
|
||||
.queryUserInfoBySn(
|
||||
v2XLiveCarEntity.getSn(),
|
||||
new V2XRefreshCallback<V2XUserInfoRes>() {
|
||||
@Override
|
||||
public void onSuccess(V2XUserInfoRes result) {
|
||||
//Logger.d(MODULE_NAME, "上报事件的用户:" + result);
|
||||
if (result != null &&
|
||||
result.getResult() != null &&
|
||||
result.getResult().getInfo() != null) {
|
||||
V2XUserInfoRes.Result.Info infoBean = result.getResult().getInfo();
|
||||
if (mUserInfo == null) {
|
||||
mUserInfo = new MarkerUserInfo();
|
||||
}
|
||||
mUserInfo.setSn(infoBean.getSn());
|
||||
try {
|
||||
if (!TextUtils.isEmpty(infoBean.getCardIdAge())) {
|
||||
mUserInfo.setAge(Integer.parseInt(infoBean.getCardIdAge()));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mUserInfo.setUserName(infoBean.getUserNickName());
|
||||
mUserInfo.setUserHead(infoBean.getHeadImgUrl());
|
||||
mUserInfo.setGender(infoBean.getCardIdSex());
|
||||
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
||||
// 判断是否可以打电话
|
||||
ChartingUtil.isCanCall(b -> {
|
||||
if (b) {
|
||||
// 判断是否可以打电话
|
||||
ChartingUtil.isOnLine(mUserInfo.getSn(), b1 -> {
|
||||
if (b1) {
|
||||
ivRoadCallChart.setVisibility(VISIBLE);
|
||||
} else {
|
||||
ivRoadCallChart.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ivRoadCallChart.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
if (!TextUtils.isEmpty(mUserInfo.getUserHead())) {
|
||||
V2XServiceManager.getImageLoader()
|
||||
.displayImage(mUserInfo.getUserHead(), ivReportHead);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String msg) {
|
||||
ivRoadCallChart.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void handlerZan(String sn) {
|
||||
try {
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已点赞", null);
|
||||
showTip("已点赞");
|
||||
V2XServiceManager.getV2XMarkerService()
|
||||
.getV2XRefreshModel()
|
||||
.giveLikeLiveVideo(null, sn);
|
||||
ivReportHead.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
V2XRoadEventScenario.getInstance().close();
|
||||
}
|
||||
}, 2000);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void showTip(String msg) {
|
||||
ToastUtils.setGravity(Gravity.CENTER, 0, 0);
|
||||
View toastView = LayoutInflater.from(V2XServiceManager.getContext()).inflate(R.layout.toast_view, null);
|
||||
TextView msgView = toastView.findViewById(R.id.tvFeedbackContent);
|
||||
msgView.setText(msg);
|
||||
ToastUtils.showCustomShort(toastView);
|
||||
@Override
|
||||
public void delayedCloseWindow() {
|
||||
ivReportHead.postDelayed(() -> V2XRoadEventScenario.getInstance().close(), 2000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,30 +1,19 @@
|
||||
package com.mogo.module.v2x.adapter.holder;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
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.MarkerUserInfo;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.scenario.scene.push.V2XPushEventScenario;
|
||||
import com.mogo.module.v2x.utils.ChartingUtil;
|
||||
import com.mogo.module.v2x.utils.ToastUtils;
|
||||
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;
|
||||
@@ -40,7 +29,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
* desc : TODO 这里是前瞻演示需求,推送的消息,
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XPushEventDetailVH extends RecyclerView.ViewHolder implements IMogoNaviListener {
|
||||
public class V2XPushEventDetailVH extends V2XBaseViewHolder {
|
||||
private MogoImageView ivImg;
|
||||
private MogoImageView ivReportHead;
|
||||
|
||||
@@ -55,28 +44,25 @@ public class V2XPushEventDetailVH extends RecyclerView.ViewHolder implements IMo
|
||||
private MarkerUserInfo mUserInfo = new MarkerUserInfo();
|
||||
|
||||
private V2XPushMessageEntity mV2XRoadEventEntity;
|
||||
private MarkerExploreWay mNoveltyInfo;
|
||||
|
||||
// 语音控制导航
|
||||
private V2XVoiceCallbackListener mNaviCb = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
startNavi();
|
||||
}
|
||||
};
|
||||
private V2XVoiceCallbackListener mNaviCb = (command, intent) -> triggerStartNavi(mNoveltyInfo);
|
||||
// 语音控制拨打电话
|
||||
private V2XVoiceCallbackListener mCallChartingCb = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
roadCallChart();
|
||||
private V2XVoiceCallbackListener mCallChartingCb = (command, intent) -> {
|
||||
try {
|
||||
mUserInfo.setSn(mV2XRoadEventEntity.getSn());
|
||||
mUserInfo.setUserHead(mV2XRoadEventEntity.getHeadImgUrl());
|
||||
mUserInfo.setUserName("蘑菇用户");
|
||||
mUserInfo.setGender("男");
|
||||
mUserInfo.setAge(30);
|
||||
triggerCallChart(mNoveltyInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
};
|
||||
// 点赞语音回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackLickListener = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
handlerZan();
|
||||
}
|
||||
};
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackLickListener = (command, intent) -> triggerZan(mNoveltyInfo);
|
||||
|
||||
public V2XPushEventDetailVH(ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
@@ -91,24 +77,20 @@ public class V2XPushEventDetailVH extends RecyclerView.ViewHolder implements IMo
|
||||
ivRoadEventLike = itemView.findViewById(R.id.ivRoadEventLike);
|
||||
|
||||
ivRoadEventNav.getParent().getParent().requestDisallowInterceptTouchEvent(true);
|
||||
ivRoadEventNav.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startNavi();
|
||||
}
|
||||
});
|
||||
ivRoadCallChart.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
roadCallChart();
|
||||
}
|
||||
});
|
||||
ivRoadEventLike.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
handlerZan();
|
||||
ivRoadEventNav.setOnClickListener(v -> triggerStartNavi(mNoveltyInfo));
|
||||
ivRoadCallChart.setOnClickListener(v -> {
|
||||
try {
|
||||
mUserInfo.setSn(mV2XRoadEventEntity.getSn());
|
||||
mUserInfo.setUserHead(mV2XRoadEventEntity.getHeadImgUrl());
|
||||
mUserInfo.setUserName("蘑菇用户");
|
||||
mUserInfo.setGender("男");
|
||||
mUserInfo.setAge(30);
|
||||
triggerCallChart(mNoveltyInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
ivRoadEventLike.setOnClickListener(v -> triggerZan(mNoveltyInfo));
|
||||
|
||||
// 设置视图状态监听
|
||||
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
|
||||
@@ -153,6 +135,14 @@ public class V2XPushEventDetailVH extends RecyclerView.ViewHolder implements IMo
|
||||
|
||||
public void initView(V2XPushMessageEntity v2XRoadEventEntity) {
|
||||
mV2XRoadEventEntity = v2XRoadEventEntity;
|
||||
mNoveltyInfo = new MarkerExploreWay();
|
||||
mNoveltyInfo.setSn(mV2XRoadEventEntity.getSn());
|
||||
mNoveltyInfo.setInfoId(mV2XRoadEventEntity.getSceneId());
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(mV2XRoadEventEntity.getLat());
|
||||
location.setLon(mV2XRoadEventEntity.getLon());
|
||||
mNoveltyInfo.setLocation(location);
|
||||
|
||||
if (!TextUtils.isEmpty(v2XRoadEventEntity.getMsgImgUrl())) {
|
||||
V2XServiceManager.getImageLoader()
|
||||
.displayImage(v2XRoadEventEntity.getMsgImgUrl(), ivImg);
|
||||
@@ -170,7 +160,6 @@ public class V2XPushEventDetailVH extends RecyclerView.ViewHolder implements IMo
|
||||
ivRoadReportTrue.setVisibility(View.GONE);
|
||||
ivRoadReportErr.setVisibility(View.GONE);
|
||||
ivRoadEventLike.setVisibility(View.GONE);
|
||||
|
||||
break;
|
||||
|
||||
case "100017"://政府公告
|
||||
@@ -179,119 +168,16 @@ public class V2XPushEventDetailVH extends RecyclerView.ViewHolder implements IMo
|
||||
ivRoadEventNav.setVisibility(View.GONE);
|
||||
ivRoadReportTrue.setVisibility(View.GONE);
|
||||
ivRoadReportErr.setVisibility(View.GONE);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 打电话
|
||||
*/
|
||||
private void roadCallChart() {
|
||||
Logger.w(MODULE_NAME, "正在拨打电话。。。。");
|
||||
if (mV2XRoadEventEntity != null) {
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLon(mV2XRoadEventEntity.getLon());
|
||||
location.setLat(mV2XRoadEventEntity.getLat());
|
||||
mUserInfo.setSn(mV2XRoadEventEntity.getSn());
|
||||
mUserInfo.setUserHead(mV2XRoadEventEntity.getHeadImgUrl());
|
||||
mUserInfo.setUserName("蘑菇用户");
|
||||
mUserInfo.setGender("男");
|
||||
mUserInfo.setAge(30);
|
||||
ChartingUtil.callChatting(mUserInfo, location);
|
||||
delayedCloseWindow();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 点赞
|
||||
*/
|
||||
private void handlerZan() {
|
||||
try {
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已点赞", null);
|
||||
showTip("已点赞");
|
||||
if (mV2XRoadEventEntity != null) {
|
||||
V2XServiceManager.getV2XMarkerService()
|
||||
.getV2XRefreshModel()
|
||||
.giveLikeLiveVideo(null, mV2XRoadEventEntity.getSn());
|
||||
}
|
||||
delayedCloseWindow();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 延迟关闭窗体
|
||||
*/
|
||||
private void delayedCloseWindow() {
|
||||
itemView.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
V2XPushEventScenario.getInstance().close();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航规划路线
|
||||
*/
|
||||
private void startNavi() {
|
||||
if (mV2XRoadEventEntity != null) {
|
||||
MogoLatLng endPoint = new MogoLatLng(mV2XRoadEventEntity.getLat(), mV2XRoadEventEntity.getLon());
|
||||
V2XServiceManager.getNavi().naviTo(endPoint);
|
||||
V2XServiceManager.getMogoRegisterCenter().unregisterMogoNaviListener(MODULE_NAME);
|
||||
V2XServiceManager.getMogoRegisterCenter().registerMogoNaviListener(MODULE_NAME, this);
|
||||
delayedCloseWindow();
|
||||
}
|
||||
}
|
||||
|
||||
private void showTip(String msg) {
|
||||
ToastUtils.setGravity(Gravity.CENTER, 0, 0);
|
||||
View toastView = LayoutInflater.from(V2XServiceManager.getContext()).inflate(R.layout.toast_view, null);
|
||||
TextView msgView = toastView.findViewById(R.id.tvFeedbackContent);
|
||||
msgView.setText(msg);
|
||||
ToastUtils.showCustomShort(toastView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
V2XServiceManager.getNavi().startNavi(true);
|
||||
public void delayedCloseWindow() {
|
||||
itemView.postDelayed(() -> V2XPushEventScenario.getInstance().close(), 1000);
|
||||
}
|
||||
|
||||
@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 onoCalculateFailed() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic(MogoTraffic traffic) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,39 +2,29 @@ package com.mogo.module.v2x.adapter.holder;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerUserInfo;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
|
||||
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.entity.V2XWindowTypeEnum;
|
||||
import com.mogo.module.v2x.R;
|
||||
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.utils.ChartingUtil;
|
||||
import com.mogo.module.v2x.utils.EventTypeUtils;
|
||||
import com.mogo.module.v2x.utils.RoadConditionUtils;
|
||||
import com.mogo.module.v2x.utils.ToastUtils;
|
||||
import com.mogo.module.v2x.utils.TrackUtils;
|
||||
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;
|
||||
@@ -46,9 +36,7 @@ import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
@@ -61,7 +49,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
* desc : 道路事件详情
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XRoadEventDetailVH extends RecyclerView.ViewHolder {
|
||||
public class V2XRoadEventDetailVH extends V2XBaseViewHolder {
|
||||
private MogoImageView ivEventImg;
|
||||
private MogoImageView ivReportHead;
|
||||
private ImageView ivEventPlay;
|
||||
@@ -79,7 +67,7 @@ public class V2XRoadEventDetailVH extends RecyclerView.ViewHolder {
|
||||
|
||||
|
||||
// 上传事件的用户信息
|
||||
private MarkerUserInfo mUserInfo = new MarkerUserInfo();
|
||||
private MarkerUserInfo mUserInfo;
|
||||
// 当前的新鲜事儿信息
|
||||
private MarkerExploreWay mNoveltyInfo;
|
||||
private V2XRoadEventEntity mV2XRoadEventEntity;
|
||||
@@ -89,28 +77,28 @@ public class V2XRoadEventDetailVH extends RecyclerView.ViewHolder {
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackCallListener = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
roadCallChart(mNoveltyInfo);
|
||||
triggerCallChart(mNoveltyInfo);
|
||||
}
|
||||
};
|
||||
// 点赞语音回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackLickListener = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
handlerZan(mNoveltyInfo);
|
||||
triggerZan(mNoveltyInfo);
|
||||
}
|
||||
};
|
||||
// 反馈"正确"语音回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackReportTrueListener = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
roadReportTrue(mNoveltyInfo);
|
||||
triggerReportTrue(mNoveltyInfo);
|
||||
}
|
||||
};
|
||||
// 反馈"错误"语音回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackReportErrorListener = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
roadReportErr(mNoveltyInfo);
|
||||
triggerReportErr(mNoveltyInfo);
|
||||
}
|
||||
};
|
||||
// 反馈"错误"语音回调
|
||||
@@ -174,12 +162,13 @@ public class V2XRoadEventDetailVH extends RecyclerView.ViewHolder {
|
||||
}
|
||||
mV2XEventShowEntity = v2XEventShowEntity;
|
||||
mV2XRoadEventEntity = v2XEventShowEntity.getV2XRoadEventEntity();
|
||||
|
||||
if (mV2XRoadEventEntity == null) {
|
||||
return;
|
||||
}
|
||||
mNoveltyInfo = mV2XRoadEventEntity.getNoveltyInfo();
|
||||
if (mNoveltyInfo != null) {
|
||||
//Logger.d(MODULE_NAME, "mContentData:" + mContentData);
|
||||
mUserInfo = mNoveltyInfo.getUserInfo();
|
||||
if (!ArrayUtils.isEmpty(mNoveltyInfo.getItems())) {
|
||||
String imgUrl = mNoveltyInfo.getItems().get(0).getThumbnail();
|
||||
if (TextUtils.isEmpty(imgUrl)) {
|
||||
@@ -245,19 +234,18 @@ public class V2XRoadEventDetailVH extends RecyclerView.ViewHolder {
|
||||
}
|
||||
|
||||
ivEventReportTrue.setOnClickListener(v -> {
|
||||
roadReportTrue(mNoveltyInfo);
|
||||
triggerReportTrue(mNoveltyInfo);
|
||||
});
|
||||
ivEventReportErr.setOnClickListener(v -> {
|
||||
roadReportErr(mNoveltyInfo);
|
||||
triggerReportErr(mNoveltyInfo);
|
||||
});
|
||||
ivEventCallChart.setOnClickListener(v -> {
|
||||
ivEventCallChart.setVisibility(GONE);
|
||||
roadCallChart(mNoveltyInfo);
|
||||
triggerCallChart(mNoveltyInfo);
|
||||
});
|
||||
ivEventZan.setOnClickListener(v -> {
|
||||
handlerZan(mNoveltyInfo);
|
||||
triggerZan(mNoveltyInfo);
|
||||
});
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -294,6 +282,11 @@ public class V2XRoadEventDetailVH extends RecyclerView.ViewHolder {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 为了给车聊聊更多的信息需要重新查询一次
|
||||
*
|
||||
* @param noveltyInfo
|
||||
*/
|
||||
private void requestUserInfo(MarkerExploreWay noveltyInfo) {
|
||||
Logger.d(MODULE_NAME, "上报事件的用户SN:" + noveltyInfo.getSn());
|
||||
// 获取道路事件周边的直播车机
|
||||
@@ -322,6 +315,9 @@ public class V2XRoadEventDetailVH extends RecyclerView.ViewHolder {
|
||||
mUserInfo.setUserHead(infoBean.getHeadImgUrl());
|
||||
mUserInfo.setGender(infoBean.getCardIdSex());
|
||||
|
||||
// 重新设置用户信息
|
||||
mNoveltyInfo.setUserInfo(mUserInfo);
|
||||
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
||||
// 判断是否可以打电话
|
||||
ChartingUtil.isCanCall(b -> {
|
||||
@@ -350,86 +346,17 @@ public class V2XRoadEventDetailVH extends RecyclerView.ViewHolder {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 打电话
|
||||
*/
|
||||
private void roadCallChart(MarkerExploreWay noveltyInfo) {
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
mUserInfo.setSn(noveltyInfo.getSn());
|
||||
ChartingUtil.callChatting(mUserInfo, location);
|
||||
TrackUtils.trackV2xRoadEvent(noveltyInfo.getInfoId(), noveltyInfo.getUserInfo().getSn(), V2XConst.V2X_ROAD_CHAT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况错误
|
||||
*/
|
||||
private void roadReportErr(MarkerExploreWay noveltyInfo) {
|
||||
if (noveltyInfo != null) {
|
||||
RoadConditionUtils.sendDataErrorReceiverInfo(
|
||||
noveltyInfo.getPoiType(),
|
||||
noveltyInfo.getInfoId(),
|
||||
"1");
|
||||
|
||||
TrackUtils.trackV2xRoadEvent(noveltyInfo.getInfoId(), noveltyInfo.getUserInfo().getSn(), V2XConst.V2X_ROAD_REPORT_ERROR);
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况正确
|
||||
*/
|
||||
private void roadReportTrue(MarkerExploreWay noveltyInfo) {
|
||||
if (noveltyInfo != null) {
|
||||
RoadConditionUtils.sendDataErrorReceiverInfo(
|
||||
noveltyInfo.getPoiType(),
|
||||
noveltyInfo.getInfoId(),
|
||||
"2");
|
||||
TrackUtils.trackV2xRoadEvent(noveltyInfo.getInfoId(), noveltyInfo.getUserInfo().getSn(), V2XConst.V2X_ROAD_REPORT_RIGHT);
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 点赞
|
||||
*/
|
||||
private void handlerZan(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已点赞", null);
|
||||
showTip("已点赞");
|
||||
if (noveltyInfo != null) {
|
||||
V2XServiceManager.getV2XMarkerService()
|
||||
.getV2XRefreshModel()
|
||||
.giveLikeLiveVideo(null, noveltyInfo.getSn());
|
||||
}
|
||||
delayedCloseWindow();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
TrackUtils.trackV2xRoadEvent(noveltyInfo.getInfoId(), noveltyInfo.getUserInfo().getSn(), V2XConst.V2X_ROAD_ZAN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 延迟关闭窗体
|
||||
*/
|
||||
private void delayedCloseWindow() {
|
||||
itemView.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// 移除窗体
|
||||
V2XServiceManager
|
||||
.getIMogoWindowManager()
|
||||
.removeView(V2XRoadEventScenario.getInstance().getV2XWindow().getView());
|
||||
V2XRoadEventScenario.getInstance().close();
|
||||
}
|
||||
@Override
|
||||
public void delayedCloseWindow() {
|
||||
itemView.postDelayed(() -> {
|
||||
// 移除窗体
|
||||
V2XServiceManager
|
||||
.getIMogoWindowManager()
|
||||
.removeView(V2XRoadEventScenario.getInstance().getV2XWindow().getView());
|
||||
V2XRoadEventScenario.getInstance().close();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
private void showTip(String msg) {
|
||||
ToastUtils.setGravity(Gravity.CENTER, 0, 0);
|
||||
View toastView = LayoutInflater.from(V2XServiceManager.getContext()).inflate(R.layout.toast_view, null);
|
||||
TextView msgView = toastView.findViewById(R.id.tvFeedbackContent);
|
||||
msgView.setText(msg);
|
||||
ToastUtils.showCustomShort(toastView);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,12 +93,12 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
mV2XScenario = V2XIllegalParkScenario.getInstance();
|
||||
break;
|
||||
default:
|
||||
Logger.e(MODULE_NAME, "当前V2X消息类型未定义。");
|
||||
ToastUtils.showLong("当前V2X消息类型未定义。");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 展示最新的消息
|
||||
if (mV2XScenario != null) {
|
||||
mV2XScenario.init(v2XMessageEntity);
|
||||
|
||||
@@ -8,9 +8,9 @@ import android.view.View;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||
import com.mogo.module.v2x.view.TextureVideoView;
|
||||
@@ -58,36 +58,38 @@ public class V2XAnimationWindow extends ConstraintLayout implements IV2XWindow<V
|
||||
*/
|
||||
@Override
|
||||
public void show(V2XPushMessageEntity entity) {
|
||||
Uri videoURI = null;
|
||||
Uri videoUri = null;
|
||||
switch (entity.getSceneId()) {
|
||||
// 前车紧急制动告警
|
||||
case "100005":
|
||||
videoURI = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_emergency_braking);
|
||||
videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_emergency_braking);
|
||||
break;
|
||||
// 十字路口碰撞预警
|
||||
case "100006":
|
||||
videoURI = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_left_right_car);
|
||||
videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_left_right_car);
|
||||
break;
|
||||
// 岔路口碰撞预警
|
||||
case "100007":
|
||||
videoURI = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_cut_in_line);
|
||||
videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_cut_in_line);
|
||||
break;
|
||||
// 禁行车道预警
|
||||
case "100008":
|
||||
videoURI = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_current_row_closed);
|
||||
videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_current_row_closed);
|
||||
break;
|
||||
// 应急车辆优先通行
|
||||
case "100012":
|
||||
videoURI = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_emergency_lane);
|
||||
videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_emergency_lane);
|
||||
break;
|
||||
// 闯红灯预警
|
||||
case "100013":
|
||||
videoURI = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_traffic_light_speed_cut);
|
||||
videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_traffic_light_speed_cut);
|
||||
break;
|
||||
default:
|
||||
Logger.e(MODULE_NAME, "未定义的类型:" + entity.getSceneId());
|
||||
}
|
||||
|
||||
if (videoURI != null) {
|
||||
vvCarAnimation.setVideoURI(videoURI);
|
||||
if (videoUri != null) {
|
||||
vvCarAnimation.setVideoURI(videoUri);
|
||||
vvCarAnimation.setOnPreparedListener(mediaPlayer -> {
|
||||
Logger.w(MODULE_NAME, "场景动画准备。。。。。");
|
||||
});
|
||||
|
||||
@@ -13,21 +13,30 @@ import java.util.Map;
|
||||
public class TrackUtils {
|
||||
|
||||
//埋点
|
||||
public static void trackV2xRoadShow(String dbid,String type, String style) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("dbid", dbid);
|
||||
properties.put("type", type);
|
||||
properties.put("lng", V2XStatusManager.getInstance().getLocation().getLongitude());
|
||||
properties.put("lat", V2XStatusManager.getInstance().getLocation().getLatitude());
|
||||
properties.put("style", style);
|
||||
V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ROAD_SHOW, properties);
|
||||
public static void trackV2xRoadShow(String dbid, String type, String style) {
|
||||
try {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("dbid", dbid);
|
||||
properties.put("type", type);
|
||||
properties.put("lng", V2XStatusManager.getInstance().getLocation().getLongitude());
|
||||
properties.put("lat", V2XStatusManager.getInstance().getLocation().getLatitude());
|
||||
properties.put("style", style);
|
||||
V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ROAD_SHOW, properties);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//道路事件操作埋点 v2x_road_event
|
||||
public static void trackV2xRoadEvent(String dbid, String sn ,String type) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("dbid", dbid);
|
||||
properties.put("sn", sn);
|
||||
properties.put("type", type);
|
||||
V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ROAD_EVET, properties);
|
||||
public static void trackV2xRoadEvent(String dbid, String sn, String type) {
|
||||
try {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("dbid", dbid);
|
||||
properties.put("sn", sn);
|
||||
properties.put("type", type);
|
||||
V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ROAD_EVET, properties);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 715 B After Width: | Height: | Size: 715 B |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 843 B After Width: | Height: | Size: 843 B |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 335 B After Width: | Height: | Size: 335 B |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 508 B After Width: | Height: | Size: 508 B |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 871 B After Width: | Height: | Size: 871 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 705 B After Width: | Height: | Size: 705 B |
|
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 218 B |
|
Before Width: | Height: | Size: 649 B After Width: | Height: | Size: 649 B |
|
Before Width: | Height: | Size: 465 B After Width: | Height: | Size: 465 B |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 482 B After Width: | Height: | Size: 482 B |
|
Before Width: | Height: | Size: 273 B After Width: | Height: | Size: 273 B |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 422 KiB After Width: | Height: | Size: 422 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 512 KiB After Width: | Height: | Size: 512 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |