[6.5.0]当融合红绿灯展示时,其他来源的红绿灯视图隐藏

This commit is contained in:
xuxinchao
2024-07-19 18:12:15 +08:00
parent 4d0d422774
commit 2ef6bb6c80
4 changed files with 50 additions and 3 deletions

View File

@@ -46,6 +46,8 @@ class SingleTrafficLightView @JvmOverloads constructor(
private var mLightSourceDivider: View? = null
private var mCurrentLightId = TrafficLightEnum.BLACK
private var fusionTrafficLightState: Boolean = false //当前是否有融合红绿灯展示
private var trafficLightUser = 0 //0:默认1Taxi乘客屏肤色
init{
@@ -138,6 +140,24 @@ class SingleTrafficLightView @JvmOverloads constructor(
}
}
/**
* 获取融合红绿灯展示状态
* @param isVisible true展示 false不展示
*/
override fun notifyFusionTrafficLightStatus(isVisible: Boolean) {
super.notifyFusionTrafficLightStatus(isVisible)
if(fusionTrafficLightState != isVisible){
fusionTrafficLightState = isVisible
if(isVisible){
UiThreadHandler.post{
if(this@SingleTrafficLightView.visibility == View.VISIBLE){
this@SingleTrafficLightView.visibility = View.GONE
}
}
}
}
}
override fun disableTrafficLightCountDown() {
super.disableTrafficLightCountDown()
UiThreadHandler.post {
@@ -285,7 +305,9 @@ class SingleTrafficLightView @JvmOverloads constructor(
}else{
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_light_red_nor)
}
this@SingleTrafficLightView.visibility = VISIBLE
if(!fusionTrafficLightState){
this@SingleTrafficLightView.visibility = VISIBLE
}
}
TrafficLightEnum.YELLOW -> {
if(trafficLightUser == 1){
@@ -293,7 +315,9 @@ class SingleTrafficLightView @JvmOverloads constructor(
}else{
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_lightyellow_nor)
}
this@SingleTrafficLightView.visibility = VISIBLE
if(!fusionTrafficLightState){
this@SingleTrafficLightView.visibility = VISIBLE
}
}
TrafficLightEnum.GREEN -> {
if(trafficLightUser == 1){
@@ -301,7 +325,9 @@ class SingleTrafficLightView @JvmOverloads constructor(
}else{
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_light_green_nor)
}
this@SingleTrafficLightView.visibility = VISIBLE
if(!fusionTrafficLightState){
this@SingleTrafficLightView.visibility = VISIBLE
}
}
else -> this@SingleTrafficLightView.visibility = GONE
}