Merge branch 'dev_minibus-d_230425_3.2.0' into code_opt_3.3.0
# Conflicts: # core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/CloudPoiManager.java
This commit is contained in:
@@ -2,18 +2,17 @@ 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.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.widget.RoundConstraintLayout
|
||||
import kotlinx.android.synthetic.main.view_driver_monitor.view.ivNormal
|
||||
import kotlinx.android.synthetic.main.view_driver_monitor.view.liveProgressBar
|
||||
@@ -27,37 +26,19 @@ 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()
|
||||
// TODO SOP演示功能代码,乘客端查看当前车辆上的司机位置监控,请求的是分体机提供的直播信息,这里采用的是硬编码,因为云平台的操作就是这样,没有接口供查询对应关系
|
||||
private var sopShowDriverMap = HashMap<String, String>()
|
||||
private var isLived = false
|
||||
|
||||
mHandler.postDelayed(this, 10000) // 1 second delay
|
||||
}
|
||||
}
|
||||
// 调用直播传入的司机屏幕SN
|
||||
private var currentDriverSN = ""
|
||||
|
||||
// 当前直播源的SN,TODO 如果要测试可以使用下面的SN
|
||||
// private var currentDriverLiveSN = "F803EB2046PZD00164"
|
||||
private var currentDriverLiveSN = ""
|
||||
|
||||
private val liveStreamManager by lazy {
|
||||
LiveStreamManagerImpl.getInstance(
|
||||
context.applicationContext as Application?,
|
||||
MoGoAiCloudClientConfig.getInstance().sn,
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
var liveListener: LiveListener? = null
|
||||
|
||||
@@ -83,10 +64,11 @@ class DriverMonitorView :
|
||||
|
||||
textureViewDriverMonitor.isOpaque = false
|
||||
|
||||
liveStreamManager.setLivePushStatusChangeCallback { }
|
||||
|
||||
// TODO SOP演示需求,只有乘客屏幕才会触发这个逻辑 begin
|
||||
// TODO SOP演示需求,只有乘客屏幕才会触发这个逻辑 ,车上必须配置了分体机作为直播源 begin
|
||||
// http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=111386656
|
||||
// 测试数据
|
||||
sopShowDriverMap["F803EB2046PZD00164"] = "F803EB2046PZD00164"//凤坤工位旁的分体机
|
||||
sopShowDriverMap["X20202105189C2522114198E7B3"] = "F803EB2046PZD00164"//凤坤工位旁的分体机
|
||||
sopShowDriverMap["X202022060289M7N8P"] = "F803EB2046PZD00188"//湘A01733D
|
||||
// key=pad司机屏幕SN,value=分体机SN,value用来调用ZeGo直播服务查看直播,@see MoGoAiCloudTrafficLive.viewDesignativeVehicleLive
|
||||
sopShowDriverMap["20220524733SWT1"] = "F803EB2046PZD00190"//湘D01777D
|
||||
@@ -98,61 +80,99 @@ class DriverMonitorView :
|
||||
// TODO SOP演示需求,只有乘客屏幕才会触发这个逻辑 END
|
||||
// 点击重新连接直播
|
||||
ivNormal.setOnClickListener {
|
||||
showLive()
|
||||
startLive()
|
||||
}
|
||||
|
||||
mHandler.postDelayed(mRunnable, 1000) // 1 second delay
|
||||
}
|
||||
|
||||
fun isSOPDriverSn(sn: String) :Boolean{
|
||||
return sopShowDriverMap.containsKey(sn)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
mHandler.removeCallbacks(mRunnable)
|
||||
sopShowDriverMap[CallerTelematicManager.getServerToken()]?.let {
|
||||
MoGoAiCloudTrafficLive.stopCarLive(it)
|
||||
if (currentDriverLiveSN.isNotEmpty()) {
|
||||
MoGoAiCloudTrafficLive.stopCarLive(currentDriverLiveSN)
|
||||
}
|
||||
}
|
||||
|
||||
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()]}"
|
||||
)
|
||||
/**
|
||||
* 检查传入的司机端所在车辆是否配置了,F车机作为直播源。ture-有,false-没有
|
||||
*/
|
||||
fun isSOPDriverSn(snDriver: String): Boolean {
|
||||
currentDriverSN = snDriver
|
||||
// 查找传入的司机端所在车是否配置了F车机作为直播源
|
||||
sopShowDriverMap[snDriver]?.let {
|
||||
// 这里应对的是乘客端切换连接的司机端的情况,正常情况这里不会执行,一个车只有一个司机端
|
||||
if (isLived && it != currentDriverLiveSN) {
|
||||
stopLive()
|
||||
}
|
||||
currentDriverLiveSN = it
|
||||
|
||||
// 这里知只是了初始化下直播SDK,防止直接调用观看直播时候还未登录问题
|
||||
LiveStreamManagerImpl.getInstance(
|
||||
context.applicationContext as Application?,
|
||||
MoGoAiCloudClientConfig.getInstance().sn,
|
||||
false
|
||||
)
|
||||
} ?: let {
|
||||
// 如果没查到,设置当前车辆为null,并将之前的直播关闭
|
||||
stopLive()
|
||||
currentDriverLiveSN = ""
|
||||
}
|
||||
|
||||
Logger.d(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"当前车上的司机端SN=${currentDriverSN},直播分体机SN=${currentDriverLiveSN}"
|
||||
)
|
||||
CallerLogger.d(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"当前车上的司机端SN=${currentDriverSN},直播分体机SN=${currentDriverLiveSN}"
|
||||
)
|
||||
return currentDriverLiveSN.isNotEmpty()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 打开,司机仓监控直播
|
||||
*/
|
||||
fun startLive() {
|
||||
if (currentDriverLiveSN.isNotEmpty()) {
|
||||
Logger.d(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"检查司机直播……isLived=$isLived 当前车上的司机端SN=${currentDriverSN},直播分体机SN=${currentDriverLiveSN}"
|
||||
)
|
||||
CallerLogger.d(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"检查司机直播……isLived=$isLived 当前车上的司机端SN=${currentDriverSN},直播分体机SN=${currentDriverLiveSN}"
|
||||
)
|
||||
if (!isLived) {
|
||||
MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(
|
||||
it,
|
||||
currentDriverLiveSN,
|
||||
textureViewDriverMonitor,
|
||||
carLiveCallBack
|
||||
)
|
||||
} ?: let {
|
||||
//为空又怎么撸
|
||||
if (CallerTelematicManager.getServerToken().isNotEmpty()) {
|
||||
Logger.d(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"检查司机直播……isLived=$isLived 当前车辆SN=${CallerTelematicManager.getServerToken()} 不支持直播"
|
||||
)
|
||||
CallerLogger.d(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"检查司机直播……isLived=$isLived 当前车辆SN=${CallerTelematicManager.getServerToken()} 不支持直播"
|
||||
)
|
||||
// 乘客屏幕连接上了司机屏,但是司机屏不在直播范围内,进行隐藏操作。
|
||||
liveListener?.onPlayError()
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort("正在直播中")
|
||||
}
|
||||
// TODO 测试用的
|
||||
// MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(
|
||||
// "F803EB2046PZD00164",
|
||||
// textureViewDriverMonitor,
|
||||
// carLiveCallBack
|
||||
// )
|
||||
} else {
|
||||
ToastUtils.showShort("当前车内没有直播源")
|
||||
//为空又怎么撸
|
||||
Logger.d(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"检查司机直播……isLived=$isLived 当前车辆SN=${currentDriverSN} 不支持直播"
|
||||
)
|
||||
CallerLogger.d(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"检查司机直播……isLived=$isLived 当前车辆SN=${currentDriverSN} 不支持直播"
|
||||
)
|
||||
// 乘客屏幕连接上了司机屏,但是司机屏不在直播范围内,进行隐藏操作。
|
||||
liveListener?.onPlayError()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭,司机仓监控直播
|
||||
*/
|
||||
fun stopLive() {
|
||||
isLived = false
|
||||
if (currentDriverLiveSN.isNotEmpty()) {
|
||||
MoGoAiCloudTrafficLive.stopCarLive(currentDriverLiveSN)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,20 +190,20 @@ class DriverMonitorView :
|
||||
|
||||
private val carLiveCallBack = object : ITrafficCarLiveCallBack {
|
||||
override fun onLive(liveSn: String?) {
|
||||
Logger.d("${SceneConstant.M_HMI}$TAG", "onLive:$liveSn")
|
||||
Logger.i("${SceneConstant.M_HMI}$TAG", "onLive:$liveSn")
|
||||
CallerLogger.d("${SceneConstant.M_HMI}$TAG", "onLive:$liveSn")
|
||||
}
|
||||
|
||||
override fun onFirstFrame() {
|
||||
Logger.d("${SceneConstant.M_HMI}$TAG", "onFirstFrame:isFirstPage")
|
||||
Logger.i("${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")
|
||||
Logger.w("${SceneConstant.M_HMI}$TAG", "onDisConnect")
|
||||
CallerLogger.w("${SceneConstant.M_HMI}$TAG", "onDisConnect")
|
||||
isLived = false
|
||||
refreshView(isLived)
|
||||
}
|
||||
@@ -196,14 +216,16 @@ class DriverMonitorView :
|
||||
}
|
||||
|
||||
override fun onPlaying() {
|
||||
Logger.e("${SceneConstant.M_HMI}$TAG", "onPlaying……")
|
||||
Logger.i("${SceneConstant.M_HMI}$TAG", "onPlaying……")
|
||||
CallerLogger.i("${SceneConstant.M_HMI}$TAG", "onPlaying……")
|
||||
isLived = true
|
||||
refreshView(isLived)
|
||||
}
|
||||
|
||||
override fun onPlaRequesting() {
|
||||
Logger.e("${SceneConstant.M_HMI}$TAG", "onPlaRequesting……")
|
||||
isLived = true
|
||||
Logger.w("${SceneConstant.M_HMI}$TAG", "onPlaRequesting……")
|
||||
CallerLogger.w("${SceneConstant.M_HMI}$TAG", "onPlaRequesting……")
|
||||
isLived = false
|
||||
refreshView(isLived)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.animation.Animator
|
||||
import android.animation.Animator.AnimatorListener
|
||||
import android.animation.AnimatorSet
|
||||
import android.animation.ObjectAnimator
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IV2XEventListener
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerV2XWarningListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import kotlinx.android.synthetic.main.view_v2x_warning_fog.view.*
|
||||
|
||||
class V2XFogEventView(context: Context, attrs: AttributeSet) :
|
||||
ConstraintLayout(context, attrs), IV2XEventListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "V2XFogEventView"
|
||||
}
|
||||
|
||||
private val animatorSet = AnimatorSet()
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_v2x_warning_fog, this, true)
|
||||
val animator1 = ObjectAnimator.ofFloat(iv_wu1, "alpha", 0f, 1f, 0f)
|
||||
val animator2 = ObjectAnimator.ofFloat(iv_wu1, "translationX", -500f, 100f, 300f)
|
||||
val animator3 = ObjectAnimator.ofFloat(iv_wu1, "scaleX", 1f, 1.5f, 2f)
|
||||
val animator4 = ObjectAnimator.ofFloat(iv_wu1, "scaleY", 1f, 1.5f, 2f)
|
||||
val animator5 = ObjectAnimator.ofFloat(iv_wu2, "alpha", 0f, 1f, 0f)
|
||||
val animator6 = ObjectAnimator.ofFloat(iv_wu2, "translationX", 500f, -100f, -300f)
|
||||
val animator7 = ObjectAnimator.ofFloat(iv_wu2, "scaleX", 1f, 1.5f, 2f)
|
||||
val animator8 = ObjectAnimator.ofFloat(iv_wu2, "scaleY", 1f, 1.5f, 2f)
|
||||
animatorSet.playTogether(
|
||||
animator1,
|
||||
animator2,
|
||||
animator3,
|
||||
animator4,
|
||||
animator5,
|
||||
animator6,
|
||||
animator7,
|
||||
animator8
|
||||
)
|
||||
animatorSet.duration = 5000
|
||||
animatorSet.addListener(object : AnimatorListener{
|
||||
override fun onAnimationStart(animation: Animator?) {
|
||||
visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun onAnimationCancel(animation: Animator?) {
|
||||
visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun onAnimationRepeat(animation: Animator?) {
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerV2XWarningListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun show(v2xType: String, direction: WarningDirectionEnum, time: Long) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
if(v2xType == EventTypeEnumNew.FOURS_FOG.poiType){
|
||||
if (animatorSet.isStarted) {
|
||||
return@runOnUiThread
|
||||
}
|
||||
animatorSet.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun dismiss(direction: WarningDirectionEnum) {
|
||||
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerV2XWarningListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.res.Resources;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
|
||||
|
||||
/**
|
||||
* created by wujifei on 2021/3/30 14:05
|
||||
* describe:
|
||||
*/
|
||||
public class DisplayEffectsHelper {
|
||||
private volatile static DisplayEffectsHelper instance = null;
|
||||
private AnimatorSet animatorSet;
|
||||
|
||||
public static DisplayEffectsHelper getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (DisplayEffectsHelper.class) {
|
||||
if (instance == null) {
|
||||
instance = new DisplayEffectsHelper();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void init(View rootView) {
|
||||
View view1 = rootView.findViewById(R.id.iv_wu1);
|
||||
View view2 = rootView.findViewById(R.id.iv_wu2);
|
||||
ObjectAnimator animator1 = ObjectAnimator.ofFloat(view1, "alpha", 0f, 1f, 0f);
|
||||
ObjectAnimator animator2 = ObjectAnimator.ofFloat(view1, "translationX", -500, 100f, 300f);
|
||||
ObjectAnimator animator3 = ObjectAnimator.ofFloat(view1, "scaleX", 1f, 1.5f, 2f);
|
||||
ObjectAnimator animator4 = ObjectAnimator.ofFloat(view1, "scaleY", 1f, 1.5f, 2f);
|
||||
ObjectAnimator animator5 = ObjectAnimator.ofFloat(view2, "alpha", 0f, 1f, 0f);
|
||||
ObjectAnimator animator6 = ObjectAnimator.ofFloat(view2, "translationX", 500, -100f, -300f);
|
||||
ObjectAnimator animator7 = ObjectAnimator.ofFloat(view2, "scaleX", 1f, 1.5f, 2f);
|
||||
ObjectAnimator animator8 = ObjectAnimator.ofFloat(view2, "scaleY", 1f, 1.5f, 2f);
|
||||
animatorSet = new AnimatorSet();
|
||||
animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5, animator6, animator7, animator8);
|
||||
animatorSet.setDuration(5000);
|
||||
}
|
||||
|
||||
public void display() {
|
||||
animatorSet.start();
|
||||
}
|
||||
|
||||
private float dp2px(float dp) {
|
||||
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
|
||||
return dp * metrics.density;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 784 KiB |
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_wu1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0"
|
||||
android:src="@drawable/wu1"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_wu2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0"
|
||||
android:src="@drawable/wu2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user