Merge branch 'dev_opt_2.15.0' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_opt_2.15.0
This commit is contained in:
@@ -22,6 +22,7 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.passenger.R;
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil;
|
||||
import com.mogo.och.common.module.wigets.OCHBorderShadowLayout;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
@@ -39,6 +40,8 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
|
||||
private FrameLayout flContainer;
|
||||
private ContentLoadingProgressBar mProgressBar;
|
||||
|
||||
private View mLiveBtn;
|
||||
private OCHBorderShadowLayout mLiveShadow;
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
*
|
||||
@@ -66,6 +69,17 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
|
||||
|
||||
mProgressBar = findViewById(R.id.bus_progress_bar);
|
||||
|
||||
mLiveShadow = findViewById(R.id.liveShadow);
|
||||
mLiveBtn = findViewById(R.id.liveBtn);
|
||||
|
||||
mLiveBtn.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
mLiveShadow.setVisibility(mLiveShadow.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
showRouteFragment();
|
||||
|
||||
// mCurrentArriveStation.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.RomaPassengerView
|
||||
android:id="@+id/ivMoGoLogo"
|
||||
android:layout_width="@dimen/dp_121"
|
||||
android:layout_height="@dimen/dp_121"
|
||||
android:layout_marginRight="@dimen/dp_751"
|
||||
@@ -154,6 +155,42 @@
|
||||
|
||||
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>
|
||||
|
||||
|
||||
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout
|
||||
android:id="@+id/liveShadow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/bus_p_curent_station_panel_margin_left"
|
||||
app:bgColor="@android:color/transparent"
|
||||
app:blurRadius="@dimen/dp_30"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/arrive_station_shadow"
|
||||
app:layout_constraintLeft_toRightOf="@+id/arrive_station_shadow"
|
||||
app:layout_constraintTop_toTopOf="@+id/arrive_station_shadow"
|
||||
app:shadowColor="@color/bus_p_panel_edge_shadow"
|
||||
app:shadowRadius="@dimen/dp_30"
|
||||
app:xOffset="0dp"
|
||||
app:yOffset="0dp">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bus_p_panel_cur_station_panel">
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.DriverMonitorView
|
||||
android:layout_width="@dimen/bus_p_live_station_panel_width"
|
||||
android:layout_height="@dimen/bus_p_curent_station_panel_height" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/liveBtn"
|
||||
android:layout_width="@dimen/dp_121"
|
||||
android:layout_height="@dimen/dp_121"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivMoGoLogo"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ivMoGoLogo"
|
||||
app:layout_constraintTop_toTopOf="@+id/ivMoGoLogo" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/bus_p_route_panel"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
<dimen name="bus_p_curent_station_txt_size1">55dp</dimen>
|
||||
<dimen name="bus_p_curent_station_tip_size1">40dp</dimen>
|
||||
|
||||
<dimen name="bus_p_live_station_panel_width">495dp</dimen>
|
||||
<dimen name="bus_p_live_station_panel_height">309dp</dimen>
|
||||
|
||||
<dimen name="bus_p_curent_station_txt_width">584dp</dimen>
|
||||
<dimen name="bus_p_station_txt_width">550dp</dimen>
|
||||
</resources>
|
||||
@@ -43,7 +43,7 @@ project.android.productFlavors {
|
||||
buildConfigField 'boolean', 'IS_CAR_MODEL_CHANGE', 'true'
|
||||
|
||||
// 构建 是否支持多屏异显异交互
|
||||
buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'true'
|
||||
buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'false'
|
||||
|
||||
//Bus不能启动自驾的档位
|
||||
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_N);add(chassis.Chassis.GearPosition.GEAR_R);}}'
|
||||
|
||||
@@ -45,7 +45,7 @@ project.android.productFlavors {
|
||||
buildConfigField 'boolean', 'IS_CAR_MODEL_CHANGE', 'true'
|
||||
|
||||
// 构建 是否支持多屏异显异交互
|
||||
buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'true'
|
||||
buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'false'
|
||||
|
||||
//Taxi不能启动自驾的档位
|
||||
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_P);add(chassis.Chassis.GearPosition.GEAR_R);}}'
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import com.mogo.cloud.live.manager.LiveStreamManagerImpl
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.cloud.trafficlive.api.ITrafficCarLiveCallBack
|
||||
import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.widget.RoundConstraintLayout
|
||||
import kotlinx.android.synthetic.main.view_camera_list.view.*
|
||||
import kotlinx.android.synthetic.main.view_driver_monitor.view.*
|
||||
|
||||
/**
|
||||
* 乘客端查看当前车辆驾驶舱的司机监控View
|
||||
*/
|
||||
class DriverMonitorView :
|
||||
RoundConstraintLayout {
|
||||
companion object {
|
||||
private val TAG = "DriverMonitorView"
|
||||
private var isLived = false
|
||||
|
||||
// TODO SOP演示功能代码,乘客端查看当前车辆上的司机位置监控,请求的是分体机提供的直播信息,这里采用的是硬编码,因为云平台的操作就是这样,没有接口供查询对应关系
|
||||
private var sopShowDriverMap = HashMap<String, String>()
|
||||
}
|
||||
|
||||
private val mHandler = Handler()
|
||||
private val mRunnable = object : Runnable {
|
||||
override fun run() {
|
||||
// Do something here
|
||||
Logger.d(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"检查司机直播……isLived=$isLived 当前车上的司机端SN=${sopShowDriverMap[CallerTelematicManager.getServerToken()]}"
|
||||
)
|
||||
CallerLogger.d(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"检查司机直播……isLived=$isLived 当前车上的司机端SN=${sopShowDriverMap[CallerTelematicManager.getServerToken()]}"
|
||||
)
|
||||
showLive()
|
||||
|
||||
mHandler.postDelayed(this, 10000) // 1 second delay
|
||||
}
|
||||
}
|
||||
|
||||
private val liveStreamManager by lazy {
|
||||
LiveStreamManagerImpl.getInstance(
|
||||
context.applicationContext as Application?,
|
||||
MoGoAiCloudClientConfig.getInstance().sn,
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
constructor(context: Context?) : super(context) {
|
||||
initView(context)
|
||||
}
|
||||
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
|
||||
initView(context)
|
||||
}
|
||||
|
||||
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attrs,
|
||||
defStyleAttr
|
||||
) {
|
||||
initView(context)
|
||||
}
|
||||
|
||||
private fun initView(context: Context?) {
|
||||
LayoutInflater.from(context)
|
||||
.inflate(R.layout.view_driver_monitor, this, true)
|
||||
|
||||
textureViewDriverMonitor.isOpaque = false
|
||||
|
||||
liveStreamManager.setLiveStatusChangeCallback {
|
||||
textureView
|
||||
.post {
|
||||
handleSnLiveStatus(it)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO SOP演示需求,只有乘客屏幕才会触发这个逻辑 begin
|
||||
// 测试数据
|
||||
sopShowDriverMap["X202022060289M7N8P"] = "F803EB2046PZD00188"//湘A01733D
|
||||
// key=pad司机屏幕SN,value=分体机SN,value用来调用ZeGo直播服务查看直播,@see MoGoAiCloudTrafficLive.viewDesignativeVehicleLive
|
||||
sopShowDriverMap["20220524733SWT1"] = "F803EB2046PZD00190"//湘D01777D
|
||||
sopShowDriverMap["20211110K7EJKPG"] = "F803EB2046PZD00188"//湘A01733D
|
||||
sopShowDriverMap["20211120H342O9Z"] = "F803EB2046PZD00167"//未知
|
||||
sopShowDriverMap["20211112X2RI32A"] = "F803EB2046PZD00274"//京A40776D
|
||||
sopShowDriverMap["202204085X310A1"] = "F803EB2046PZD00263"//湘D09005D
|
||||
|
||||
// TODO SOP演示需求,只有乘客屏幕才会触发这个逻辑 END
|
||||
// 点击重新连接直播
|
||||
ivNormal.setOnClickListener {
|
||||
showLive()
|
||||
}
|
||||
|
||||
mHandler.postDelayed(mRunnable, 1000) // 1 second delay
|
||||
}
|
||||
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
mHandler.removeCallbacks(mRunnable)
|
||||
sopShowDriverMap[CallerTelematicManager.getServerToken()]?.let {
|
||||
MoGoAiCloudTrafficLive.stopCarLive(it)
|
||||
}
|
||||
}
|
||||
|
||||
fun showLive() {
|
||||
if (!isLived) {
|
||||
sopShowDriverMap[CallerTelematicManager.getServerToken()]?.let {
|
||||
Logger.d(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"检查司机直播……isLived=$isLived 当前车上的司机端SN=${sopShowDriverMap[CallerTelematicManager.getServerToken()]}"
|
||||
)
|
||||
CallerLogger.d(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"检查司机直播……isLived=$isLived 当前车上的司机端SN=${sopShowDriverMap[CallerTelematicManager.getServerToken()]}"
|
||||
)
|
||||
MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(
|
||||
it,
|
||||
textureViewDriverMonitor,
|
||||
carLiveCallBack
|
||||
)
|
||||
}
|
||||
// MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(
|
||||
// "F803EB2046PZD00190",
|
||||
// textureViewDriverMonitor,
|
||||
// carLiveCallBack
|
||||
// )
|
||||
}
|
||||
}
|
||||
|
||||
private fun refreshView(lived: Boolean) {
|
||||
if (lived) {
|
||||
textureViewDriverMonitor.visibility = VISIBLE
|
||||
liveProgressBar.visibility = GONE
|
||||
tvLoadingHit.visibility = GONE
|
||||
} else {
|
||||
textureViewDriverMonitor.visibility = GONE
|
||||
liveProgressBar.visibility = VISIBLE
|
||||
tvLoadingHit.visibility = VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleSnLiveStatus(status: Int) {
|
||||
when (status) {
|
||||
0 -> {// 正在直播
|
||||
isLived = true
|
||||
}
|
||||
|
||||
1 -> {// 直播已停止
|
||||
isLived = false
|
||||
}
|
||||
|
||||
2 -> {// 直播强制结束
|
||||
isLived = false
|
||||
}
|
||||
}
|
||||
refreshView(isLived)
|
||||
|
||||
Logger.d("${SceneConstant.M_HMI}$TAG", "isLived:$isLived")
|
||||
CallerLogger.d("${SceneConstant.M_HMI}$TAG", "isLived:$isLived")
|
||||
}
|
||||
|
||||
private val carLiveCallBack = object : ITrafficCarLiveCallBack {
|
||||
override fun onLive(liveSn: String?) {
|
||||
Logger.d("${SceneConstant.M_HMI}$TAG", "onLive:$liveSn")
|
||||
CallerLogger.d("${SceneConstant.M_HMI}$TAG", "onLive:$liveSn")
|
||||
isLived = true
|
||||
refreshView(isLived)
|
||||
}
|
||||
|
||||
override fun onFirstFrame() {
|
||||
Logger.d("${SceneConstant.M_HMI}$TAG", "onFirstFrame:isFirstPage")
|
||||
CallerLogger.d("${SceneConstant.M_HMI}$TAG", "onFirstFrame:isFirstPage")
|
||||
isLived = true
|
||||
refreshView(isLived)
|
||||
}
|
||||
|
||||
override fun onDisConnect() {
|
||||
Logger.e("${SceneConstant.M_HMI}$TAG", "onDisConnect")
|
||||
CallerLogger.e("${SceneConstant.M_HMI}$TAG", "onDisConnect")
|
||||
isLived = false
|
||||
refreshView(isLived)
|
||||
}
|
||||
|
||||
override fun onError(errorMsg: String?) {
|
||||
Logger.e("${SceneConstant.M_HMI}$TAG", "onError msg is:${errorMsg}")
|
||||
CallerLogger.e("${SceneConstant.M_HMI}$TAG", "onError msg is:${errorMsg}")
|
||||
isLived = false
|
||||
refreshView(isLived)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mogo.eagle.core.widget.RoundConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/rclContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:background="#FFF"
|
||||
android:layout_height="match_parent"
|
||||
app:roundLayoutRadius="24dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivNormal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/bus_picture_nor"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--摄像头数据需要两种播放方式-->
|
||||
<TextureView
|
||||
android:id="@+id/textureViewDriverMonitor"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/liveProgressBar"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:indeterminateDrawable="@drawable/icon_loading_live"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLoadingHit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="44dp"
|
||||
android:text="加载中……"
|
||||
android:textColor="#2D3E5F"
|
||||
android:textSize="28dp"
|
||||
app:layout_constraintEnd_toEndOf="@+id/liveProgressBar"
|
||||
app:layout_constraintStart_toStartOf="@+id/liveProgressBar"
|
||||
app:layout_constraintTop_toBottomOf="@+id/liveProgressBar" />
|
||||
|
||||
</com.mogo.eagle.core.widget.RoundConstraintLayout>
|
||||
Reference in New Issue
Block a user