add livecar and crossroad func

This commit is contained in:
zhongchao
2021-04-01 10:57:42 +08:00
parent 18b087450c
commit 5b23eb4601
11 changed files with 66 additions and 56 deletions

View File

@@ -30,8 +30,7 @@
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="date" />
<option name="myAdditionalJavadocTags" value="description,since:" />
</inspection_tool>
<inspection_tool class="MarkdownUnresolvedFileReference" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

2
.idea/misc.xml generated
View File

@@ -8,7 +8,7 @@
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="12" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -14,7 +14,6 @@ import com.mogo.module.v2x.entity.net.V2XLiveCrossRoad;
import com.mogo.module.v2x.network.V2XRefreshCallback;
import com.mogo.module.v2x.network.V2XRefreshModel;
import com.mogo.module.v2x.utils.ToastUtils;
import com.mogo.module.v2x.view.V2XCarLiveVideoView;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.statusmanager.StatusDescriptor;
@@ -29,7 +28,7 @@ import static com.mogo.service.statusmanager.StatusDescriptor.MAIN_PAGE_RESUME;
/**
* author : unknown
* desc : TODO 演示使用的语音呼叫查看直播车辆 或者 路口实况 业务模块
* desc : 语音呼叫查看直播车辆 或者 路口实况 业务模块
*/
public class V2XVoiceCallLiveBiz {
@@ -53,16 +52,16 @@ public class V2XVoiceCallLiveBiz {
}
private Context mContext;
private V2XVoiceCallLiveScenario mV2XVoiceCallLiveScenario = new V2XVoiceCallLiveScenario();
private V2XVoiceCallLiveScenario mV2XVoiceCallLiveScenario;
//语音词指令 查看前车视频回调
private V2XVoiceCallbackListener v2XVoiceCallbackFrontLiveCarListener = (command, intent) -> {
private final V2XVoiceCallbackListener v2XVoiceCallbackFrontLiveCarListener = (command, intent) -> {
Logger.d(MODULE_NAME, "语音词指令 查看前车视频回调");
getFrontCarLive();
};
//语音词指令 查看路口实况回调
private V2XVoiceCallbackListener v2XVoiceCallbackOpenRoadCameraListener = (command, intent) -> {
private final V2XVoiceCallbackListener v2XVoiceCallbackOpenRoadCameraListener = (command, intent) -> {
Logger.d(MODULE_NAME, "语音词指令 查看路口实况回调");
AIAssist.getInstance(mContext).speakTTSVoice(mContext.getString(R.string.v2x_voice_see_crossroad_live));
getOpenRoadCameraLive();
@@ -101,30 +100,29 @@ public class V2XVoiceCallLiveBiz {
}
public void getFrontCarLive() {
V2XDemoUserInfoRes.ResultBean.UserListBean.UserInfoBean userInfoBean = V2XDemoManager.getInstance().getV2XDemoUserInfoEntity1().getUserInfo();
String liveCarSn = userInfoBean.getSn();
// V2XDemoUserInfoRes.ResultBean.UserListBean.UserInfoBean userInfoBean = V2XDemoManager.getInstance().getV2XDemoUserInfoEntity1().getUserInfo();
String liveCarSn = "F803EB2046PZD00149";
if (TextUtils.isEmpty(liveCarSn)) {
ToastUtils.showShort("附近没有可直播车机");
Logger.d(MODULE_NAME, "getFrontCarLive : sn is null");
return;
}
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(liveCarSn, null);
mV2XVoiceCallLiveScenario = new V2XVoiceCallLiveScenario();
mV2XVoiceCallLiveScenario.setV2XWindow(new V2XVoiceCallLiveCarWindow());
mV2XVoiceCallLiveScenario.init(v2XMessageEntity);
}
public void getOpenRoadCameraLive() {
// String liveUrl = "rtmp://154.8.189.110:19350/live/10_1";
// V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(null, liveUrl);
// V2XVoiceCallLiveScenario.getInstance().setV2XWindow(new V2XVoiceCrossRoadLiveWindow());
// V2XVoiceCallLiveScenario.getInstance().init(v2XMessageEntity);
V2XRefreshModel.getInstance(mContext).queryCrossRoadsLive(new V2XRefreshCallback<V2XLiveCrossRoad>() {
@Override
public void onSuccess(V2XLiveCrossRoad result) {
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);
mV2XVoiceCallLiveScenario = new V2XVoiceCallLiveScenario();
mV2XVoiceCallLiveScenario.setV2XWindow(new V2XVoiceCrossRoadLiveWindow());
mV2XVoiceCallLiveScenario.init(v2XMessageEntity);
} else {
Logger.d(MODULE_NAME, "getOpenRoadCameraLive 路口实况直播地址为空");
}

View File

@@ -29,7 +29,7 @@ public class V2XVoiceCallLiveCarWindow extends V2XBasWindow
private boolean isVideoPlay = false;
// 处理道路事件30秒倒计时
private Handler handlerV2XEvent = new Handler();
private final Handler handlerV2XEvent = new Handler();
private Runnable runnableV2XEvent;
private static final int COUNT_DOWN_TIMER = 1_000;
private static final int ALL_EXPIRE_TIMER = 1_000 * 30;
@@ -50,7 +50,7 @@ public class V2XVoiceCallLiveCarWindow extends V2XBasWindow
}
private void initView(Context context) {
Logger.w(MODULE_NAME, "V2X===初始化语音呼叫直播视图");
Logger.w(MODULE_NAME, "V2X===初始化语音呼叫直播视图"); //todo 更改样式
LayoutInflater.from(context).inflate(R.layout.window_see_carlive_video, this);
mV2XCarLiveVideoView = findViewById(R.id.videoPlayer);
tvCountDown = findViewById(R.id.tvCountDown);

View File

@@ -12,7 +12,6 @@ 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.V2XUtils;
import com.mogo.module.v2x.view.CarZegoLiveVideoView;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
@@ -21,14 +20,10 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* author : unknown
* desc : TODO 演示使用的语音呼叫查看直播场景,包括车辆直播 或者 路口实况 window区分不同页面window逻辑实现
* desc : 语音呼叫查看直播场景,包括车辆直播 或者 路口实况 window区分不同页面window逻辑实现
*/
public class V2XVoiceCallLiveScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
public V2XVoiceCallLiveScenario() {
setV2XWindow(new V2XVoiceCallLiveCarWindow());
}
@Override
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
if (v2XMessageEntity == null) {
@@ -65,14 +60,21 @@ public class V2XVoiceCallLiveScenario extends AbsV2XScenario<V2XPushMessageEntit
@Override
public void showWindow() {
if (getV2XWindow() != null) {
int width = (int) V2XUtils.getApp().getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
R.dimen.module_v2x_event_window_width_vr : R.dimen.module_v2x_event_window_width);
int height = (int) V2XUtils.getApp().getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
R.dimen.module_v2x_event_see_live_window_height_vr : R.dimen.module_v2x_event_see_live_window_height);
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(width, height);
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
V2XServiceManager
.getMogoTopViewManager()
.addViewNoLinkage(getV2XWindow().getView(), layoutParams, this);
} else {
V2XServiceManager
.getMogoTopViewManager()
.addView(getV2XWindow().getView(), layoutParams, this);
}
getV2XWindow().show(getV2XMessageEntity().getContent());
ViewGroup.LayoutParams layoutParams =
new ViewGroup.LayoutParams(
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_width),
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_event_see_live_window_height));
V2XServiceManager
.getMogoTopViewManager()
.addView(getV2XWindow().getView(), layoutParams, this);
V2XServiceManager.getMoGoV2XStatusManager().setLiveCarWindowShow(TAG, true);
}
}

View File

@@ -30,7 +30,7 @@ public class V2XVoiceCrossRoadLiveWindow extends V2XBasWindow
private boolean isVideoPlay = false;
// 处理道路事件30秒倒计时
private Handler handlerV2XEvent = new Handler();
private final Handler handlerV2XEvent = new Handler();
private Runnable runnableV2XEvent;
private static final int COUNT_DOWN_TIMER = 1_000;
private static final int ALL_EXPIRE_TIMER = 1_000 * 30;

View File

@@ -28,7 +28,6 @@ import com.mogo.module.v2x.entity.net.V2XSpecialCarRes;
import com.mogo.module.v2x.scenario.scene.livecar.V2XVoiceCallLiveBiz;
import com.mogo.module.v2x.utils.TestOnLineCarUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.utils.TipToast;
import com.zhidao.carchattingprovider.MogoDriverInfo;
@@ -58,6 +57,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
private Button mBtnTriggerPushLiveCarEvent;
private Button mBtnTriggerAnimationEvent;
private Button mBtnbtnFrontCarLiveEvent;
private Button mBtnbtnXINGLiveEvent;
private Button mBtnTriggerFatigueDrivingEvent;
private Button mBtnTriggerSeekHelpEvent;
private Button mBtnTriggerParkEvent;
@@ -122,6 +122,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
mBtnTriggerPushLiveCarEvent = findViewById(R.id.btnTriggerPushLiveCarEvent);
mBtnTriggerAnimationEvent = findViewById(R.id.btnTriggerAnimationEvent);
mBtnbtnFrontCarLiveEvent = findViewById(R.id.btnFrontCarLiveEvent);
mBtnbtnXINGLiveEvent = findViewById(R.id.btnXINGLiveEvent);
mBtnTriggerFatigueDrivingEvent = findViewById(R.id.btnTriggerFatigueDrivingEvent);
mBtnTriggerSeekHelpEvent = findViewById(R.id.btnTriggerSeekHelpEvent);
mBtnTriggerParkEvent = findViewById(R.id.btnTriggerParkEvent);
@@ -222,7 +223,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
});
//车路云—场景预警-V1.0 碰撞预警
mBtnTriggerWarningEvent.setOnClickListener(v->{
mBtnTriggerWarningEvent.setOnClickListener(v -> {
V2XMessageEntity<V2XWarningEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData();
@@ -262,6 +263,10 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
V2XVoiceCallLiveBiz.getInstance().getFrontCarLive();
});
mBtnbtnXINGLiveEvent.setOnClickListener(v -> {
V2XVoiceCallLiveBiz.getInstance().getOpenRoadCameraLive();
});
mBtnTriggerFatigueDrivingEvent.setOnClickListener(v -> {
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioFatigueDrivingData();

View File

@@ -94,12 +94,12 @@ public class V2XUtils {
sApplication = app;
}
sApplication.registerActivityLifecycleCallbacks(ACTIVITY_LIFECYCLE);
UTIL_POOL.execute(new Runnable() {
@Override
public void run() {
//AdaptScreenUtils.preLoad();
}
});
// UTIL_POOL.execute(new Runnable() {
// @Override
// public void run() {
// //AdaptScreenUtils.preLoad();
// }
// });
} else {
if (app != null && app.getClass() != sApplication.getClass()) {
sApplication.unregisterActivityLifecycleCallbacks(ACTIVITY_LIFECYCLE);

View File

@@ -3,11 +3,9 @@ package com.mogo.module.v2x.view;
import android.content.Context;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.SurfaceView;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
@@ -21,16 +19,11 @@ import com.mogo.commons.voice.AIAssist;
import com.mogo.module.common.entity.MarkerCarInfo;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XLivePushVoRes;
import com.mogo.module.v2x.network.V2XRefreshCallback;
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;
import com.mogo.utils.logger.Logger;
import com.tencent.rtmp.ui.TXCloudVideoView;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* @author liujing
@@ -46,7 +39,7 @@ public class CarZegoLiveVideoView extends RoundLayout {
private MarkerCarInfo.CarLiveInfo mCarLiveInfo;
// 重新刷新直播流
private V2XVoiceCallbackListener v2XVoiceCallbackRefreshListener = new V2XVoiceCallbackListener() {
private final V2XVoiceCallbackListener v2XVoiceCallbackRefreshListener = new V2XVoiceCallbackListener() {
@Override
public void onCallback(String command, Intent intent) {
mLoading.setVisibility(VISIBLE);
@@ -80,14 +73,11 @@ public class CarZegoLiveVideoView extends RoundLayout {
mClLoadError = findViewById(R.id.clLoadError);
mTvRefreshButton = findViewById(R.id.tvRefreshButton);
mTvRefreshButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mLoading.setVisibility(VISIBLE);
mClLoadError.setVisibility(GONE);
if (mCarLiveInfo != null) {
startLive(mCarLiveInfo);
}
mTvRefreshButton.setOnClickListener(v -> {
mLoading.setVisibility(VISIBLE);
mClLoadError.setVisibility(GONE);
if (mCarLiveInfo != null) {
startLive(mCarLiveInfo);
}
});
}

View File

@@ -307,6 +307,20 @@
android:textSize="@dimen/dp_22"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/btnXINGLiveEvent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:background="#3BDCC9"
android:padding="@dimen/dp_10"
android:text="查看前方路口视频"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_22"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</com.google.android.flexbox.FlexboxLayout>
<com.google.android.flexbox.FlexboxLayout

View File

@@ -5,10 +5,12 @@
<dimen name="module_v2x_search_marginLeft">32px</dimen>
<dimen name="module_v2x_operation_panel_share_goneMarginRight">32px</dimen>
<dimen name="module_v2x_event_window_width">1060px</dimen>
<dimen name="module_v2x_event_window_width_vr">583px</dimen>
<dimen name="module_v2x_push_img_height">390px</dimen>
<dimen name="module_v2x_push_img_container_height">410px</dimen>
<dimen name="module_v2x_event_see_live_window_height">670px</dimen>
<dimen name="module_v2x_event_see_live_window_height_vr">366px</dimen>
<dimen name="module_v2x_event_icon_size">147px</dimen>
<dimen name="module_v2x_event_distance_text">60px</dimen>
<dimen name="module_v2x_event_distance_title">40px</dimen>