[Change]
增加HMI中红绿灯View代理设置,setProxyTrafficLightView,代理View需要实现IViewTrafficLight抽象类 Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -24,6 +24,7 @@ showWarningV2X : 展示VR下V2X预警
|
||||
vipIdentification : VIP标志展示控制
|
||||
showToolsView : 打开工具View
|
||||
hideToolsView : 关闭工具View
|
||||
setProxyTrafficLightView : 设置红绿灯代理View
|
||||
```
|
||||
|
||||
* ### 高精 MAP 图层 相关 -> [CallerHDMapManager.kt][DebugSettingView.kt] -> [Demo][DebugSettingView.kt]
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
@@ -99,6 +100,10 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
|
||||
private var autoPilotBadCaseView: AutoPilotBadCaseView? = null
|
||||
|
||||
// HMI 视图控件代理
|
||||
// 红绿灯View代理
|
||||
private var mViewTrafficLightVr: IViewTrafficLight? = null
|
||||
|
||||
private var onBadCaseShow: (() -> View)? = null
|
||||
private var onBadCaseHide: (() -> Unit)? = null
|
||||
|
||||
@@ -277,6 +282,8 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
view.postDelayed({
|
||||
activity?.let { CarcorderPreviewView.show(it) }
|
||||
}, 1000)*/
|
||||
|
||||
setProxyTrafficLightView(viewTrafficLightVr)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@@ -299,7 +306,8 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
}
|
||||
if (record.type == 2 && (record.stat == 101 || record.stat == 100)) {
|
||||
CallerMapDataCollectorManager.finish(record.id, record.stat, "", record.fileName ?: "", record.note ?: "")
|
||||
CallerMapDataCollectorManager.finish(record.id, record.stat, "", record.fileName
|
||||
?: "", record.note ?: "")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,6 +399,10 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
}
|
||||
|
||||
override fun setProxyTrafficLightView(view: IViewTrafficLight) {
|
||||
mViewTrafficLightVr = view
|
||||
}
|
||||
|
||||
private fun showBadCasesFloat(dismiss: (() -> Unit)?) {
|
||||
Log.d("QQQ", "showBadCaseToolsFloat")
|
||||
context?.let { it ->
|
||||
@@ -597,6 +609,20 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
} else {
|
||||
setToolsViewVisibility(View.GONE)
|
||||
}
|
||||
|
||||
// 控制 限速UI 展示
|
||||
if (HmiBuildConfig.isShowLimitingVelocityView) {
|
||||
showLimitingVelocity(View.VISIBLE)
|
||||
} else {
|
||||
showLimitingVelocity(View.GONE)
|
||||
}
|
||||
|
||||
// 控制 红绿灯 展示
|
||||
if (HmiBuildConfig.isShowTrafficLightView) {
|
||||
setTrafficLightVrVisibility(View.VISIBLE)
|
||||
} else {
|
||||
setTrafficLightVrVisibility(View.GONE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
@@ -615,6 +641,10 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
viewSpeedChart?.visibility = visibility
|
||||
}
|
||||
|
||||
override fun setTrafficLightVrVisibility(visibility: Int) {
|
||||
mViewTrafficLightVr?.visibility = visibility
|
||||
}
|
||||
|
||||
override fun setAutopilotStatusViewVisibility(visibility: Int) {
|
||||
viewAutopilotStatus?.visibility = visibility
|
||||
}
|
||||
@@ -771,30 +801,30 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
* @param checkLightId 0-都是默认不亮起,1-红,2-黄,3-绿
|
||||
*/
|
||||
override fun showWarningTrafficLight(checkLightId: Int) {
|
||||
viewTrafficLightVr?.showWarningTrafficLight(checkLightId)
|
||||
mViewTrafficLightVr?.showWarningTrafficLight(checkLightId)
|
||||
}
|
||||
|
||||
override fun isWarningTrafficLightShow(): Boolean {
|
||||
return viewTrafficLightVr?.visibility == View.VISIBLE
|
||||
return mViewTrafficLightVr?.visibility == View.VISIBLE
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
override fun disableWarningTrafficLight() {
|
||||
viewTrafficLightVr?.disableWarningTrafficLight()
|
||||
mViewTrafficLightVr?.disableWarningTrafficLight()
|
||||
}
|
||||
|
||||
override fun changeCountdownRed(redNum: Int) {
|
||||
viewTrafficLightVr?.changeCountdownRed(redNum)
|
||||
mViewTrafficLightVr?.changeCountdownRed(redNum)
|
||||
}
|
||||
|
||||
override fun changeCountdownYellow(yellowNum: Int) {
|
||||
viewTrafficLightVr?.changeCountdownYellow(yellowNum)
|
||||
mViewTrafficLightVr?.changeCountdownYellow(yellowNum)
|
||||
}
|
||||
|
||||
override fun changeCountdownGreen(greenNum: Int) {
|
||||
viewTrafficLightVr?.changeCountdownGreen(greenNum)
|
||||
mViewTrafficLightVr?.changeCountdownGreen(greenNum)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -803,7 +833,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
override fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
viewTrafficLightVr?.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
|
||||
mViewTrafficLightVr?.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1106,9 +1136,9 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
val tipsView = upgradeTipsView?.invoke()
|
||||
//如果工控机处于“下载中”、“可升级(下载完成)”、“升级中”、“升级失败”状态时,工具箱入口显示红色角标
|
||||
if (AdUpgradeStateHelper.showUpgradeTips(downloadStatus, upgradeStatus)) {
|
||||
if (HmiBuildConfig.isShowUpgradeTipsView){
|
||||
if (HmiBuildConfig.isShowUpgradeTipsView) {
|
||||
viewUpgradeTips?.visibility = View.VISIBLE
|
||||
}else{
|
||||
} else {
|
||||
tipsView?.let {
|
||||
it.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.view_traffic_light_vr.view.*
|
||||
@@ -15,10 +16,10 @@ import kotlinx.android.synthetic.main.view_traffic_light_vr.view.*
|
||||
* 红绿灯控件
|
||||
*/
|
||||
class TrafficLightView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : IViewTrafficLight(context, attrs, defStyleAttr) {
|
||||
|
||||
|
||||
init {
|
||||
@@ -30,7 +31,7 @@ class TrafficLightView @JvmOverloads constructor(
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
*/
|
||||
fun showWarningTrafficLight(checkLightId: Int) {
|
||||
override fun showWarningTrafficLight(checkLightId: Int) {
|
||||
UiThreadHandler.post {
|
||||
visibility = View.VISIBLE
|
||||
when (checkLightId) {
|
||||
@@ -61,7 +62,7 @@ class TrafficLightView @JvmOverloads constructor(
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
fun disableWarningTrafficLight() {
|
||||
override fun disableWarningTrafficLight() {
|
||||
UiThreadHandler.post {
|
||||
visibility = View.GONE
|
||||
ctvRedTrafficLight.isChecked = false
|
||||
@@ -79,7 +80,7 @@ class TrafficLightView @JvmOverloads constructor(
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
override fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
UiThreadHandler.post {
|
||||
changeCountdownGreen(readNum)
|
||||
changeCountdownYellow(yellowNum)
|
||||
@@ -87,7 +88,7 @@ class TrafficLightView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun changeCountdownGreen(greenNum: Int) {
|
||||
override fun changeCountdownGreen(greenNum: Int) {
|
||||
UiThreadHandler.post {
|
||||
if (greenNum > 0) {
|
||||
ctvGreenTrafficLight.text = "$greenNum"
|
||||
@@ -97,7 +98,7 @@ class TrafficLightView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun changeCountdownYellow(yellowNum: Int) {
|
||||
override fun changeCountdownYellow(yellowNum: Int) {
|
||||
UiThreadHandler.post {
|
||||
if (yellowNum > 0) {
|
||||
ctvYellowTrafficLight.text = "$yellowNum"
|
||||
@@ -107,7 +108,7 @@ class TrafficLightView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun changeCountdownRed(redNum: Int) {
|
||||
override fun changeCountdownRed(redNum: Int) {
|
||||
UiThreadHandler.post {
|
||||
if (redNum > 0) {
|
||||
ctvRedTrafficLight.text = "$redNum"
|
||||
@@ -117,5 +118,4 @@ class TrafficLightView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -31,26 +31,38 @@ object HmiBuildConfig {
|
||||
var isShowToolsView = true
|
||||
|
||||
/**
|
||||
* 是否展示BadCase按钮
|
||||
* 是否展示 BadCase按钮
|
||||
*/
|
||||
@JvmField
|
||||
var isShowBadCaseView = true
|
||||
|
||||
/**
|
||||
* 是否展示工控机升级提示UI
|
||||
* 是否展示 工控机升级提示UI
|
||||
*/
|
||||
@JvmField
|
||||
var isShowUpgradeTipsView = true
|
||||
|
||||
/**
|
||||
* 是否展示转向灯ui
|
||||
* 是否展示 转向灯ui
|
||||
*/
|
||||
@JvmField
|
||||
var isShowTurnLightView = true
|
||||
|
||||
/**
|
||||
* 是否展示刹车ui
|
||||
* 是否展示 刹车ui
|
||||
*/
|
||||
@JvmField
|
||||
var isShowBrakeLightView = true
|
||||
|
||||
/**
|
||||
* 是否显示 限速UI
|
||||
*/
|
||||
@JvmField
|
||||
var isShowLimitingVelocityView = true
|
||||
|
||||
/**
|
||||
* 是否显示 红绿等
|
||||
*/
|
||||
@JvmField
|
||||
var isShowTrafficLightView = false
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.mogo.eagle.core.function.api.hmi.view
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.widget.LinearLayout
|
||||
|
||||
/**
|
||||
* 定义红绿灯View具备的功能接口
|
||||
*/
|
||||
abstract class IViewTrafficLight(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) :
|
||||
LinearLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
*/
|
||||
open fun showWarningTrafficLight(checkLightId: Int) {}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
open fun disableWarningTrafficLight() {}
|
||||
|
||||
/**
|
||||
* @param readNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
open fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {}
|
||||
|
||||
open fun changeCountdownGreen(greenNum: Int) {}
|
||||
|
||||
open fun changeCountdownYellow(yellowNum: Int) {}
|
||||
|
||||
open fun changeCountdownRed(redNum: Int) {}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,12 +4,13 @@ import android.view.View
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/8/2 7:36 下午
|
||||
*/
|
||||
interface IMoGoWaringProvider {
|
||||
interface IMoGoWaringProvider {
|
||||
|
||||
/**
|
||||
* 隐藏 脉速表
|
||||
@@ -17,6 +18,12 @@ interface IMoGoWaringProvider {
|
||||
*/
|
||||
fun setSpeedChartViewVisibility(visibility: Int)
|
||||
|
||||
/**
|
||||
* 隐藏 红绿灯UI
|
||||
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
|
||||
*/
|
||||
fun setTrafficLightVrVisibility(visibility: Int)
|
||||
|
||||
/**
|
||||
* 隐藏 自动驾驶触发 按钮
|
||||
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
|
||||
@@ -76,7 +83,7 @@ interface IMoGoWaringProvider {
|
||||
/**
|
||||
* 红绿灯是否展示
|
||||
*/
|
||||
fun isWarningTrafficLightShow():Boolean
|
||||
fun isWarningTrafficLightShow(): Boolean
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警
|
||||
@@ -183,26 +190,31 @@ interface IMoGoWaringProvider {
|
||||
* @param downloadVersion 下载版本
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
fun showAdUpgradeStatus(upgradeMode : Int,downloadStatus : Int,currentProgress : Int,totalProgress : Int
|
||||
,downloadVersion : String,upgradeStatus : Int)
|
||||
fun showAdUpgradeStatus(upgradeMode: Int, downloadStatus: Int, currentProgress: Int, totalProgress: Int, downloadVersion: String, upgradeStatus: Int)
|
||||
|
||||
/**
|
||||
* 注册badcase入口展示和隐藏的回调
|
||||
* 当[onShow]被调用时,调用[showBadCaseEntrance]
|
||||
* [onHide]回调不用关心,可以不注册
|
||||
*/
|
||||
fun registerBadCaseCallback(onShow:() -> View, onHide: (() -> Unit)?)
|
||||
fun registerBadCaseCallback(onShow: () -> View, onHide: (() -> Unit)?)
|
||||
|
||||
/**
|
||||
*注册工控机升级提示圆点View的回调
|
||||
* @param 提示圆点View
|
||||
*/
|
||||
fun registerUpgradeTipsCallback(tipsView:() -> View)
|
||||
fun registerUpgradeTipsCallback(tipsView: () -> View)
|
||||
|
||||
/**
|
||||
* 工控机重启返回结果
|
||||
* @param code
|
||||
* @param msg
|
||||
*/
|
||||
fun showDockerRebootResult(code: Int,msg: String)
|
||||
fun showDockerRebootResult(code: Int, msg: String)
|
||||
|
||||
/**
|
||||
* 设置红绿灯代理View
|
||||
* @param view
|
||||
*/
|
||||
fun setProxyTrafficLightView(view: IViewTrafficLight)
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
@@ -19,7 +20,7 @@ import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
object CallerHmiManager : CallerBase() {
|
||||
private val waringProviderApi
|
||||
get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI)
|
||||
.navigation() as? IMoGoWaringProvider;
|
||||
.navigation() as? IMoGoWaringProvider;
|
||||
|
||||
/**
|
||||
* 隐藏 脉速表
|
||||
@@ -63,14 +64,14 @@ object CallerHmiManager : CallerBase() {
|
||||
/**
|
||||
* 控制刹车功能
|
||||
*/
|
||||
fun setBrakeLightFunction (isOpen: Boolean) {
|
||||
fun setBrakeLightFunction(isOpen: Boolean) {
|
||||
waringProviderApi?.setBrakeLightFunction(isOpen)
|
||||
}
|
||||
|
||||
/**
|
||||
* 开关DebugView
|
||||
*/
|
||||
fun toggleDebugView(){
|
||||
fun toggleDebugView() {
|
||||
waringProviderApi?.toggleDebugView()
|
||||
}
|
||||
|
||||
@@ -259,9 +260,8 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param downloadVersion 下载版本
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
fun showAdUpgradeStatus(upgradeMode : Int, downloadStatus : Int,currentProgress : Int,totalProgress : Int
|
||||
,downloadVersion : String,upgradeStatus : Int){
|
||||
waringProviderApi?.showAdUpgradeStatus(upgradeMode,downloadStatus, currentProgress, totalProgress, downloadVersion, upgradeStatus)
|
||||
fun showAdUpgradeStatus(upgradeMode: Int, downloadStatus: Int, currentProgress: Int, totalProgress: Int, downloadVersion: String, upgradeStatus: Int) {
|
||||
waringProviderApi?.showAdUpgradeStatus(upgradeMode, downloadStatus, currentProgress, totalProgress, downloadVersion, upgradeStatus)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -269,7 +269,7 @@ object CallerHmiManager : CallerBase() {
|
||||
* 当[onShow]被调用时, 表示达到展示条件,返回展示的入口控件
|
||||
* [onHide]回调不用关心,可以不注册
|
||||
*/
|
||||
fun registerBadCaseCallback(onShow:() -> View, onHide: (() -> Unit)?) {
|
||||
fun registerBadCaseCallback(onShow: () -> View, onHide: (() -> Unit)?) {
|
||||
waringProviderApi?.registerBadCaseCallback(onShow, onHide)
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ object CallerHmiManager : CallerBase() {
|
||||
*注册工控机升级提示圆点View的回调
|
||||
* @param 提示圆点View
|
||||
*/
|
||||
fun registerUpgradeTipsCallback(tipsView:() -> View){
|
||||
fun registerUpgradeTipsCallback(tipsView: () -> View) {
|
||||
waringProviderApi?.registerUpgradeTipsCallback(tipsView)
|
||||
}
|
||||
|
||||
@@ -286,8 +286,16 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param code
|
||||
* @param msg
|
||||
*/
|
||||
fun showDockerRebootResult(code: Int,msg: String){
|
||||
fun showDockerRebootResult(code: Int, msg: String) {
|
||||
waringProviderApi?.showDockerRebootResult(code, msg)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置红绿灯代理View
|
||||
* @param view
|
||||
*/
|
||||
fun setProxyTrafficLightView(view: IViewTrafficLight) {
|
||||
waringProviderApi?.setProxyTrafficLightView(view)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user