[Upload]
删除旧版本的push功能代码 Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.impl;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_PARKING;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.IV2XScenarioManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.animation.V2XAnimationScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.fatigue.V2XFatigueDrivingScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.help.V2XCarForHelpScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar.V2XPushLiveCarScenario;
|
||||
@@ -17,19 +21,16 @@ import com.mogo.eagle.core.function.v2x.events.scenario.scene.route.V2XOptimalRo
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.seek.V2XSeekHelpScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.ugc.V2XEventUgcScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.warning.V2XFrontWarningScenario;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.scenario.scene.destination.V2XRecommendRouteScenario;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_PARKING;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -89,9 +90,6 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
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;
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.animation;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.ADASUtils;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoWindowManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 5:37 PM
|
||||
* desc : 场景动画的场景展示,目前这里仅在演示DEMO中使用
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XAnimationScenario extends AbsV2XScenario<V2XPushMessageEntity> {
|
||||
|
||||
public V2XAnimationScenario() {
|
||||
setV2XWindow(new V2XAnimationWindow());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
|
||||
boolean isMainPageOnResume = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isMainPageOnResume = statusManager.isMainPageOnResume();
|
||||
}
|
||||
if (!isSameScenario(v2XMessageEntity)
|
||||
&& isMainPageOnResume) {
|
||||
boolean isV2XAnimationShow = false;
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
isV2XAnimationShow = v2xStatus.isV2XAnimationShow();
|
||||
}
|
||||
if (isV2XAnimationShow) {
|
||||
close();
|
||||
}
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
show();
|
||||
} else {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
Logger.w(V2XConst.MODULE_NAME, "要处理的场景已经存在,丢弃这次初始化");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
showWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().setWindowStatusListener(new V2XWindowStatusListener() {
|
||||
@Override
|
||||
public void onViewShow() {
|
||||
ADASUtils.broadcastToADAS(BridgeApi.INSTANCE.context(), getV2XMessageEntity().getContent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewClose() {
|
||||
closeWindow();
|
||||
clearPOI();
|
||||
}
|
||||
});
|
||||
getV2XWindow().show(getV2XMessageEntity().getContent());
|
||||
|
||||
IMogoWindowManager windowManager = BridgeApi.INSTANCE.windowManager();
|
||||
if (windowManager != null) {
|
||||
windowManager.addView(getV2XWindow().getView(), 0, 0, false);
|
||||
}
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setV2XAnimationWindowShow(TAG, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().close();
|
||||
}
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setV2XAnimationWindowShow(TAG, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
setV2XMessageEntity(null);
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().clearPOI();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.animation;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.eagle.core.widget.TextureVideoView;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/24 11:34 AM
|
||||
* desc : TODO 前瞻演示功能场景动画
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XAnimationWindow extends ConstraintLayout implements IV2XWindow<V2XPushMessageEntity> {
|
||||
// 弹窗状态监听
|
||||
private V2XWindowStatusListener mV2XWindowStatusListener;
|
||||
private TextureVideoView vvCarAnimation;
|
||||
|
||||
public V2XAnimationWindow() {
|
||||
this(BridgeApi.INSTANCE.context(), null);
|
||||
}
|
||||
|
||||
public V2XAnimationWindow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XAnimationWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XAnimationWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public void initView(Context context) {
|
||||
Logger.w(MODULE_NAME, "初始化场景动画View。。。。。");
|
||||
LayoutInflater.from(context).inflate(R.layout.window_animation, this);
|
||||
vvCarAnimation = findViewById(R.id.vvCarAnimation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示道路事件详情Windows
|
||||
*/
|
||||
@Override
|
||||
public void show(V2XPushMessageEntity entity) {
|
||||
Uri videoUri = null;
|
||||
String tts = null;
|
||||
switch (entity.getSceneId()) {
|
||||
// 前车紧急制动告警
|
||||
case "100005":
|
||||
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);
|
||||
tts = "注意路口车辆";
|
||||
break;
|
||||
// 岔路口碰撞预警
|
||||
case "100007":
|
||||
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);
|
||||
break;
|
||||
// 应急车辆优先通行
|
||||
case "100012":
|
||||
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);
|
||||
break;
|
||||
default:
|
||||
Logger.e(MODULE_NAME, "未定义的类型:" + entity.getSceneId());
|
||||
}
|
||||
String path = "https://v.youku.com/v_show/id_XNjAzNzI3MDA0.html";
|
||||
|
||||
if (videoUri != null) {
|
||||
// vvCarAnimation.setVideoPath(path);
|
||||
vvCarAnimation.setVideoURI(videoUri);
|
||||
vvCarAnimation.setOnPreparedListener(mediaPlayer -> {
|
||||
Logger.w(MODULE_NAME, "场景动画准备。。。。。");
|
||||
});
|
||||
vvCarAnimation.setOnCompletionListener(mediaPlayer -> {
|
||||
Logger.w(MODULE_NAME, "动画播放结束...");
|
||||
if (mV2XWindowStatusListener != null) {
|
||||
mV2XWindowStatusListener.onViewClose();
|
||||
}
|
||||
});
|
||||
vvCarAnimation.start();
|
||||
Logger.w(MODULE_NAME, "开始播放动画。。。。。");
|
||||
if (mV2XWindowStatusListener != null) {
|
||||
mV2XWindowStatusListener.onViewShow();
|
||||
}
|
||||
}
|
||||
if (tts != null) {
|
||||
AIAssist.getInstance(BridgeApi.INSTANCE.context()).speakTTSVoice(tts);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
//移除窗体
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeView(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
if (vvCarAnimation != null) {
|
||||
vvCarAnimation.stopPlayback();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
this.mV2XWindowStatusListener = listener;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user