[6.5.0]红绿灯逻辑调整
This commit is contained in:
@@ -105,6 +105,12 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
"${SceneConstant.M_D_C}${TAG}",
|
||||
"onAutopilotPerceptionTrafficLight ---- hasObuLightStatus = $hasObuLightStatus ----hasAiLightStatus = $hasAiLightStatus , trafficLights : ${trafficLights?:"null"}"
|
||||
)
|
||||
Log.i(TAG,"source="+trafficLights?.source)
|
||||
if(trafficLights?.source == 2){
|
||||
hasObuLightStatus = false
|
||||
hasAiLightStatus = false
|
||||
hasFusionLightStatus = true
|
||||
}
|
||||
if (!hasObuLightStatus) {
|
||||
if (!hasAiLightStatus) {
|
||||
trafficLights?.let {
|
||||
@@ -130,6 +136,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
if (!hasAutopilotPerception) {
|
||||
hasAutopilotPerception = true
|
||||
}
|
||||
|
||||
if(light.nextState == null || light.nextState == FusionTrafficLightOuterClass.FusionLightState.STATE_OFF_FUSION
|
||||
|| light.nextTwoState == null || light.nextTwoState == FusionTrafficLightOuterClass.FusionLightState.STATE_OFF_FUSION){
|
||||
if (HmiBuildConfig.isShowCarSourceTrafficLightView) {
|
||||
@@ -147,17 +154,25 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
onTrafficLightPlusSource(convert(light.state), 0, DataSourceType.TELEMATIC)
|
||||
}
|
||||
}else{
|
||||
//有下一和下二灯态,则为融合V2N红绿灯数据
|
||||
onFusionTrafficLight(convert(light.state),light.duration.toInt(),
|
||||
convert(light.nextState),light.nextDuration.toInt(),
|
||||
convert(light.nextTwoState),light.nextTwoDuration.toInt(),
|
||||
DataSourceType.TELEMATIC_UNION_V2N
|
||||
)
|
||||
//当前灯态倒计时小于5S时,展示额外的提示框
|
||||
if(light.duration < 5){
|
||||
onTrafficLightPrompt(convert(light.state),light.duration.toInt())
|
||||
Log.i(TAG,"current state="+light.state+" current duration="+light.duration+
|
||||
" nextState="+light.nextState+" nextDuration="+light.nextDuration+
|
||||
" nextTwoState="+light.nextTwoState+" nextTwoDuration="+light.nextTwoDuration)
|
||||
if(convert(light.state) == TrafficLightEnum.BLACK){
|
||||
//隐藏当前红绿灯以及额外提示框
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
}else{
|
||||
//有下一和下二灯态,则为融合V2N红绿灯数据
|
||||
onFusionTrafficLight(convert(light.state),light.duration.toInt(),
|
||||
convert(light.nextState),light.nextDuration.toInt(),
|
||||
convert(light.nextTwoState),light.nextTwoDuration.toInt(),
|
||||
DataSourceType.TELEMATIC_UNION_V2N
|
||||
)
|
||||
//当前灯态倒计时小于5S时,展示额外的提示框
|
||||
if(light.duration < 5){
|
||||
onTrafficLightPrompt(convert(light.state),light.duration,convert(light.nextState),light.nextDuration,
|
||||
convert(light.nextTwoState),light.nextTwoDuration)
|
||||
}
|
||||
}
|
||||
//TODO 提示框的消失逻辑
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -277,10 +292,11 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_ADAS,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_ADAS_TRAFFIC_LIGHT,
|
||||
paramIndexes = [0, 1])
|
||||
override fun onTrafficLightPrompt(currentState: TrafficLightEnum, currentDuration: Int) {
|
||||
super.onTrafficLightPrompt(currentState, currentDuration)
|
||||
Log.i("xuxinchao","融合V2N红绿灯额外提示框提醒 Dis")
|
||||
CallerTrafficLightListenerManager.onShowTrafficLightPrompt(currentState, currentDuration)
|
||||
override fun onTrafficLightPrompt(currentState: TrafficLightEnum, currentDuration: Float,
|
||||
nextState: TrafficLightEnum, nextDuration: Float,
|
||||
nextTwoState: TrafficLightEnum, nextTwoDuration: Float) {
|
||||
super.onTrafficLightPrompt(currentState, currentDuration,nextState, nextDuration, nextTwoState, nextTwoDuration)
|
||||
CallerTrafficLightListenerManager.onShowTrafficLightPrompt(currentState, currentDuration,nextState, nextDuration, nextTwoState, nextTwoDuration)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.widget.ImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotSummaryInfo
|
||||
import com.mogo.eagle.core.data.notice.AutoExplorationEntity
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
|
||||
@@ -86,6 +87,18 @@ class AutomaticExplorationView @JvmOverloads constructor(
|
||||
dataList.add(AutoExplorationEntity("前方路口行人/非机动车分析",6000L))
|
||||
dataList.add(AutoExplorationEntity("路侧视频分析",8000L))
|
||||
automaticExplorationAdapter?.setData(dataList)
|
||||
|
||||
//每出现一次自动探查,增加相应的服务次数
|
||||
//车辆服务次数
|
||||
AutopilotSummaryInfo.vehicleServiceNum += 31
|
||||
//道路信息提醒次数
|
||||
AutopilotSummaryInfo.infoTipNum += 9
|
||||
//车辆行为提醒次数
|
||||
AutopilotSummaryInfo.vehicleTipNum += 13
|
||||
//弱势参与者提醒次数
|
||||
AutopilotSummaryInfo.vulnerableTipNum += 4
|
||||
//消除安全风险隐患次数
|
||||
AutopilotSummaryInfo.dangerNum += 24
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
|
||||
/**
|
||||
* 融合红绿灯变灯提示
|
||||
@@ -33,7 +34,6 @@ class TrafficLightPromptView @JvmOverloads constructor(
|
||||
private var tvPromptContent: TextView ?= null
|
||||
private var tvTrafficNum: TypefaceTextView ?= null
|
||||
private var tvTrafficNumDecimal: TypefaceTextView ?= null
|
||||
private val randomList = ArrayList<Float>()
|
||||
|
||||
init {
|
||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.TrafficLightPromptView)
|
||||
@@ -53,16 +53,6 @@ class TrafficLightPromptView @JvmOverloads constructor(
|
||||
tvTrafficNum = findViewById(R.id.tvTrafficNum)
|
||||
tvTrafficNumDecimal = findViewById(R.id.tvTrafficNumDecimal)
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
|
||||
randomList.add(0.99f)
|
||||
randomList.add(0.72f)
|
||||
randomList.add(0.44f)
|
||||
randomList.add(0.21f)
|
||||
randomList.add(0.06f)
|
||||
|
||||
// tvPromptContent?.text = "请准备出发"
|
||||
// tvTrafficNum?.text = "12"
|
||||
// tvTrafficNumDecimal?.text = ".56"
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
@@ -70,6 +60,12 @@ class TrafficLightPromptView @JvmOverloads constructor(
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun disableTrafficLight() {
|
||||
super.disableTrafficLight()
|
||||
UiThreadHandler.post{
|
||||
this@TrafficLightPromptView.visibility = GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -77,8 +73,10 @@ class TrafficLightPromptView @JvmOverloads constructor(
|
||||
* @param currentState 当前灯态
|
||||
* @param currentDuration 当前灯态倒计时
|
||||
*/
|
||||
override fun onShowTrafficLightPrompt(currentState: TrafficLightEnum, currentDuration: Int) {
|
||||
super.onShowTrafficLightPrompt(currentState, currentDuration)
|
||||
override fun onShowTrafficLightPrompt(currentState: TrafficLightEnum, currentDuration: Float,
|
||||
nextState: TrafficLightEnum, nextDuration: Float,
|
||||
nextTwoState: TrafficLightEnum, nextTwoDuration: Float) {
|
||||
super.onShowTrafficLightPrompt(currentState, currentDuration,nextState, nextDuration, nextTwoState, nextTwoDuration)
|
||||
ThreadUtils.runOnUiThread {
|
||||
when(currentState){
|
||||
TrafficLightEnum.GREEN->{
|
||||
@@ -115,7 +113,49 @@ class TrafficLightPromptView @JvmOverloads constructor(
|
||||
this@TrafficLightPromptView.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
tvTrafficNum?.text = currentDuration.toString()
|
||||
if(currentDuration>0 && currentDuration<5){
|
||||
tvTrafficNum?.text = "${currentDuration.toInt()}."
|
||||
tvTrafficNumDecimal?.text = (currentDuration*100 - currentDuration.toInt()*100).toInt().toString()
|
||||
}else{
|
||||
tvTrafficNum?.text = "0."
|
||||
tvTrafficNumDecimal?.text = "0"
|
||||
this@TrafficLightPromptView.visibility = View.GONE
|
||||
}
|
||||
when(nextState){
|
||||
TrafficLightEnum.GREEN->{
|
||||
if(user == 0){
|
||||
//司机端提示
|
||||
tvPromptTitle?.text = "即将绿灯"
|
||||
tvPromptContent?.text = "请准备出发"
|
||||
}else{
|
||||
//乘客端提示
|
||||
tvPromptContent?.text = "即将绿灯,请准备出发"
|
||||
}
|
||||
}
|
||||
TrafficLightEnum.RED->{
|
||||
if(user == 0){
|
||||
//司机端提示
|
||||
tvPromptTitle?.text = "即将红灯"
|
||||
tvPromptContent?.text = "请减速慢行"
|
||||
}else{
|
||||
//乘客端提示
|
||||
tvPromptContent?.text = "即将红灯,请减速慢行"
|
||||
}
|
||||
}
|
||||
TrafficLightEnum.YELLOW->{
|
||||
if(user == 0){
|
||||
//司机端提示
|
||||
tvPromptTitle?.text = "即将黄灯"
|
||||
tvPromptContent?.text = "请减速慢行"
|
||||
}else{
|
||||
//乘客端提示
|
||||
tvPromptContent?.text = "即将红灯,请减速慢行"
|
||||
}
|
||||
}
|
||||
TrafficLightEnum.BLACK->{
|
||||
this@TrafficLightPromptView.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -12,6 +11,7 @@ import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.hmi_view_fusion_traffic_light.view.fusionTrafficLightBg
|
||||
import kotlinx.android.synthetic.main.hmi_view_fusion_traffic_light.view.fusionTrafficLightNum
|
||||
@@ -19,6 +19,7 @@ import kotlinx.android.synthetic.main.hmi_view_fusion_traffic_light.view.fusionT
|
||||
import kotlinx.android.synthetic.main.hmi_view_fusion_traffic_light.view.fusionTrafficLightProportion
|
||||
import kotlinx.android.synthetic.main.hmi_view_fusion_traffic_light.view.fusionTrafficLightScale
|
||||
import kotlinx.android.synthetic.main.hmi_view_fusion_traffic_light.view.fusionTrafficLightState
|
||||
import java.util.LinkedList
|
||||
|
||||
/**
|
||||
* 融合红绿灯View
|
||||
@@ -69,7 +70,6 @@ class FusionTrafficLightView @JvmOverloads constructor(
|
||||
*/
|
||||
override fun disableTrafficLight() {
|
||||
super.disableTrafficLight()
|
||||
Log.i("xuxinchao","disableTrafficLight 关闭红绿灯预警展示")
|
||||
UiThreadHandler.post{
|
||||
mCurrentLightId = TrafficLightEnum.BLACK
|
||||
this@FusionTrafficLightView.visibility = GONE
|
||||
@@ -94,116 +94,129 @@ class FusionTrafficLightView @JvmOverloads constructor(
|
||||
) {
|
||||
super.showFusionTrafficLight(currentState, currentDuration, nextState,
|
||||
nextDuration, nextTwoState, nextTwoDuration, lightSource)
|
||||
//如果当前红绿灯视图为隐藏状态则设置为显示状态
|
||||
if(this@FusionTrafficLightView.visibility == View.GONE){
|
||||
this@FusionTrafficLightView.visibility = View.VISIBLE
|
||||
//首次展示,需要将当前、下一、下二灯态的时间占比绘制出来,只绘制一次
|
||||
val proportionList = ArrayList<Int>()
|
||||
//按照绿、黄、红的顺序将灯态时间添加到数组
|
||||
when (currentState) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
//如果当前红绿灯视图为隐藏状态则设置为显示状态
|
||||
if(this@FusionTrafficLightView.visibility == View.GONE){
|
||||
this@FusionTrafficLightView.visibility = View.VISIBLE
|
||||
//首次展示,需要将当前、下一、下二灯态的时间占比绘制出来,只绘制一次
|
||||
val proportionList = ArrayList<Int>(3)
|
||||
proportionList.add(0)
|
||||
proportionList.add(0)
|
||||
proportionList.add(0)
|
||||
//按照绿、黄、红的顺序将灯态时间添加到数组
|
||||
when (currentState) {
|
||||
TrafficLightEnum.GREEN -> {
|
||||
proportionList.add(0,currentDuration)
|
||||
maxGreenDuration = currentDuration
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
proportionList.add(1,currentDuration)
|
||||
if(currentDuration < 3){
|
||||
maxYellowDuration = 3
|
||||
}else{
|
||||
maxYellowDuration = currentDuration
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
proportionList.add(2,currentDuration)
|
||||
maxRedDuration = currentDuration
|
||||
}
|
||||
}
|
||||
when(nextState){
|
||||
TrafficLightEnum.GREEN -> {
|
||||
proportionList.add(0,nextDuration)
|
||||
maxGreenDuration = nextDuration
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
proportionList.add(1,nextDuration)
|
||||
if(nextDuration<3){
|
||||
maxYellowDuration = 3
|
||||
}else{
|
||||
maxYellowDuration = nextDuration
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
proportionList.add(2,nextDuration)
|
||||
maxRedDuration = nextDuration
|
||||
}
|
||||
}
|
||||
when(nextTwoState){
|
||||
TrafficLightEnum.GREEN -> {
|
||||
proportionList.add(0,nextTwoDuration)
|
||||
maxGreenDuration = nextTwoDuration
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
proportionList.add(1,nextTwoDuration)
|
||||
if(nextTwoDuration<3){
|
||||
maxYellowDuration = 3
|
||||
}else{
|
||||
maxYellowDuration = nextTwoDuration
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
proportionList.add(2,nextTwoDuration)
|
||||
maxRedDuration = nextTwoDuration
|
||||
}
|
||||
}
|
||||
fusionTrafficLightProportion.updateProportion(proportionList)
|
||||
totalDuration = maxGreenDuration + maxYellowDuration + maxRedDuration
|
||||
}
|
||||
//根据当前灯态设置转盘、刻度、指针背景
|
||||
when(currentState){
|
||||
TrafficLightEnum.GREEN -> {
|
||||
proportionList.add(0,currentDuration)
|
||||
maxGreenDuration = currentDuration
|
||||
fusionTrafficLightState.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green))
|
||||
fusionTrafficLightScale.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green_scale))
|
||||
fusionTrafficLightPointer.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green_pointer))
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
proportionList.add(1,currentDuration)
|
||||
maxYellowDuration = currentDuration
|
||||
fusionTrafficLightState.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow))
|
||||
fusionTrafficLightScale.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow_scale))
|
||||
fusionTrafficLightPointer.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow_pointer))
|
||||
}
|
||||
else -> {
|
||||
proportionList.add(2,currentDuration)
|
||||
maxRedDuration = currentDuration
|
||||
fusionTrafficLightState.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red))
|
||||
fusionTrafficLightScale.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red_scale))
|
||||
fusionTrafficLightPointer.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red_pointer))
|
||||
}
|
||||
}
|
||||
when(nextState){
|
||||
//更新当前灯态倒计时时间
|
||||
if(currentDuration>0){
|
||||
fusionTrafficLightNum.text = currentDuration.toString()
|
||||
}else{
|
||||
fusionTrafficLightNum.text = "0"
|
||||
}
|
||||
//当时间为1开头时时间视觉上看不是左右居中对齐,需要做便宜操作
|
||||
if(currentDuration.toString().startsWith("1")){
|
||||
val numLayoutParams = fusionTrafficLightNum.layoutParams as LayoutParams
|
||||
numLayoutParams.rightMargin = 10
|
||||
fusionTrafficLightNum.layoutParams = numLayoutParams
|
||||
}else{
|
||||
val numLayoutParams = fusionTrafficLightNum.layoutParams as LayoutParams
|
||||
numLayoutParams.rightMargin = 0
|
||||
fusionTrafficLightNum.layoutParams = numLayoutParams
|
||||
}
|
||||
|
||||
//更新指针指向
|
||||
val pointerLayoutParams = fusionTrafficLightPointer.layoutParams as LayoutParams
|
||||
var currentAngle = 0f
|
||||
currentAngle = when (currentState) {
|
||||
TrafficLightEnum.GREEN -> {
|
||||
proportionList.add(0,nextDuration)
|
||||
maxGreenDuration = nextDuration
|
||||
360f*(maxGreenDuration-currentDuration)/totalDuration
|
||||
}
|
||||
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
proportionList.add(1,nextDuration)
|
||||
maxYellowDuration = nextDuration
|
||||
360f*(maxGreenDuration+maxYellowDuration-currentDuration)/totalDuration
|
||||
}
|
||||
|
||||
else -> {
|
||||
proportionList.add(2,nextDuration)
|
||||
maxRedDuration = nextDuration
|
||||
360f*(maxGreenDuration+maxYellowDuration+maxRedDuration-currentDuration)/totalDuration
|
||||
}
|
||||
}
|
||||
when(nextTwoState){
|
||||
TrafficLightEnum.GREEN -> {
|
||||
proportionList.add(0,nextTwoDuration)
|
||||
maxGreenDuration = nextTwoDuration
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
proportionList.add(1,nextTwoDuration)
|
||||
maxYellowDuration = nextTwoDuration
|
||||
}
|
||||
else -> {
|
||||
proportionList.add(2,nextTwoDuration)
|
||||
maxRedDuration = nextTwoDuration
|
||||
}
|
||||
}
|
||||
fusionTrafficLightProportion.updateProportion(proportionList)
|
||||
totalDuration = maxGreenDuration + maxYellowDuration + maxRedDuration
|
||||
Log.i("xuxinchao","totalDuration="+totalDuration)
|
||||
Log.i("xuxinchao","maxGreenDuration="+maxGreenDuration)
|
||||
Log.i("xuxinchao","maxYellowDuration="+maxYellowDuration)
|
||||
Log.i("xuxinchao","maxRedDuration="+maxRedDuration)
|
||||
}
|
||||
//根据当前灯态设置转盘、刻度、指针背景
|
||||
when(currentState){
|
||||
TrafficLightEnum.GREEN -> {
|
||||
fusionTrafficLightState.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green))
|
||||
fusionTrafficLightScale.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green_scale))
|
||||
fusionTrafficLightPointer.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green_pointer))
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
fusionTrafficLightState.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow))
|
||||
fusionTrafficLightScale.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow_scale))
|
||||
fusionTrafficLightPointer.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow_pointer))
|
||||
}
|
||||
else -> {
|
||||
fusionTrafficLightState.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red))
|
||||
fusionTrafficLightScale.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red_scale))
|
||||
fusionTrafficLightPointer.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red_pointer))
|
||||
}
|
||||
}
|
||||
//更新当前灯态倒计时时间
|
||||
if(currentDuration>0){
|
||||
fusionTrafficLightNum.text = currentDuration.toString()
|
||||
}else{
|
||||
fusionTrafficLightNum.text = "0"
|
||||
}
|
||||
//当时间为1开头时时间视觉上看不是左右居中对齐,需要做便宜操作
|
||||
if(currentDuration.toString().startsWith("1")){
|
||||
val numLayoutParams = fusionTrafficLightNum.layoutParams as LayoutParams
|
||||
numLayoutParams.rightMargin = 10
|
||||
fusionTrafficLightNum.layoutParams = numLayoutParams
|
||||
}else{
|
||||
val numLayoutParams = fusionTrafficLightNum.layoutParams as LayoutParams
|
||||
numLayoutParams.rightMargin = 0
|
||||
fusionTrafficLightNum.layoutParams = numLayoutParams
|
||||
pointerLayoutParams.circleAngle = currentAngle
|
||||
fusionTrafficLightPointer.rotation = currentAngle
|
||||
fusionTrafficLightPointer.layoutParams = pointerLayoutParams
|
||||
}
|
||||
|
||||
//更新指针指向
|
||||
val pointerLayoutParams = fusionTrafficLightPointer.layoutParams as LayoutParams
|
||||
var currentAngle = 0f
|
||||
currentAngle = when (currentState) {
|
||||
TrafficLightEnum.GREEN -> {
|
||||
360f*(maxGreenDuration-currentDuration)/totalDuration
|
||||
}
|
||||
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
360f*(maxGreenDuration+maxYellowDuration-currentDuration)/totalDuration
|
||||
}
|
||||
|
||||
else -> {
|
||||
360f*(maxGreenDuration+maxYellowDuration+maxRedDuration-currentDuration)/totalDuration
|
||||
}
|
||||
}
|
||||
pointerLayoutParams.circleAngle = currentAngle
|
||||
fusionTrafficLightPointer.rotation = currentAngle
|
||||
fusionTrafficLightPointer.layoutParams = pointerLayoutParams
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -56,6 +56,14 @@ class ItinerarySummaryDialog(context: Context, isDriver: Boolean, theme: Int) :
|
||||
//关闭Dialog按钮
|
||||
ivSummaryClose = findViewById(R.id.ivSummaryClose)
|
||||
ivSummaryClose?.setOnClickListener {
|
||||
//对本次服务记录清零
|
||||
AutopilotSummaryInfo.intersectionServicesNum = 0
|
||||
AutopilotSummaryInfo.lightServicesNum = 0
|
||||
AutopilotSummaryInfo.infoTipNum = 0
|
||||
AutopilotSummaryInfo.vehicleTipNum = 0
|
||||
AutopilotSummaryInfo.vulnerableTipNum = 0
|
||||
AutopilotSummaryInfo.dangerNum = 0
|
||||
//关闭弹窗
|
||||
dismiss()
|
||||
}
|
||||
//小智总结
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/fusionTrafficLightBg"
|
||||
android:layout_width="@dimen/dp_250"
|
||||
android:layout_height="@dimen/dp_250"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_fusion_traffic_light_p"
|
||||
>
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
android:layout_marginLeft="@dimen/dp_150"
|
||||
android:textSize="@dimen/sp_30"
|
||||
android:textColor="@color/white"
|
||||
android:text="即将绿灯"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
@@ -27,7 +26,6 @@
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:textSize="@dimen/sp_21"
|
||||
android:textColor="@color/white"
|
||||
android:text="请准备出发"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
|
||||
@@ -38,7 +36,6 @@
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvPromptContent"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
android:textSize="@dimen/sp_40"
|
||||
android:text=".99"
|
||||
android:textColor="@color/light_prompt_red"
|
||||
app:textType="DS_DIGIB_2"
|
||||
/>
|
||||
@@ -50,7 +47,6 @@
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvTrafficNumDecimal"
|
||||
app:layout_constraintRight_toLeftOf="@id/tvTrafficNumDecimal"
|
||||
android:textSize="@dimen/sp_90"
|
||||
android:text="3"
|
||||
android:textColor="@color/light_prompt_red"
|
||||
app:textType="DS_DIGIB_2"
|
||||
/>
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
android:textColor="@color/light_prompt_content"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:layout_marginStart="@dimen/dp_50"
|
||||
android:text="即将红灯,请减速慢行"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
|
||||
@@ -25,7 +24,6 @@
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvPromptContent"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvPromptContent"
|
||||
android:textSize="@dimen/sp_76"
|
||||
android:text="2"
|
||||
android:layout_marginLeft="@dimen/dp_25"
|
||||
app:textType="DS_DIGIB_2"
|
||||
/>
|
||||
@@ -37,7 +35,6 @@
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvTrafficNum"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvTrafficNum"
|
||||
android:textSize="@dimen/sp_30"
|
||||
android:text=".99"
|
||||
app:textType="DS_DIGIB_2"
|
||||
android:gravity="bottom"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user