diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/traffic/TrafficLightPromptView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/traffic/TrafficLightPromptView.kt index 6cf7f76452..a5336bf601 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/traffic/TrafficLightPromptView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/traffic/TrafficLightPromptView.kt @@ -16,7 +16,6 @@ import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler import com.mogo.eagle.core.utilcode.util.ThreadUtils -import com.mogo.eagle.core.utilcode.util.UiThreadHandler /** * 融合红绿灯变灯提示 @@ -32,7 +31,7 @@ class TrafficLightPromptView @JvmOverloads constructor( private const val TAG = "TrafficLightPromptView" } - private var user = 0 //使用方,driver:0 passenger:1 + private var user = 0 //使用方,driver:0 passenger taxi:1 passenger bus:2 private var tvPromptTitle: TextView ?= null private var tvPromptContent: TextView ?= null private var tvTrafficNum: TypefaceTextView ?= null @@ -91,11 +90,21 @@ class TrafficLightPromptView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() - if(user == 0){ - LayoutInflater.from(context).inflate(R.layout.view_traffic_light_prompt, this, true) - tvPromptTitle = findViewById(R.id.tvPromptTitle) - }else{ - LayoutInflater.from(context).inflate(R.layout.view_traffic_light_prompt_p, this, true) + when (user) { + 0 -> { + //司机端 + LayoutInflater.from(context).inflate(R.layout.view_traffic_light_prompt, this, true) + tvPromptTitle = findViewById(R.id.tvPromptTitle) + } + 1 -> { + //TAXI乘客端 + LayoutInflater.from(context).inflate(R.layout.view_traffic_light_prompt_p_taxi, this, true) + } + else -> { + //BUS乘客端 + LayoutInflater.from(context).inflate(R.layout.view_traffic_light_prompt_p_bus, this, true) + tvPromptTitle = findViewById(R.id.tvPromptTitle) + } } tvPromptContent = findViewById(R.id.tvPromptContent) tvTrafficNum = findViewById(R.id.tvTrafficNum) @@ -163,12 +172,22 @@ class TrafficLightPromptView @JvmOverloads constructor( msg.obj = currentDuration mLightHandler.sendMessageDelayed(msg,200) } - if(user == 0){ - tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_green)) - tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_green)) - }else{ - tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_green_p)) - tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_green_p)) + when (user) { + 0 -> { + //司机端 + tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_green)) + tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_green)) + } + 1 -> { + //TAXI乘客端 + tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_green_p)) + tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_green_p)) + } + else -> { + //BUS乘客端 + tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_green_p_bus)) + tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_green_p_bus)) + } } } TrafficLightEnum.RED->{ @@ -179,12 +198,22 @@ class TrafficLightPromptView @JvmOverloads constructor( msg.obj = currentDuration mLightHandler.sendMessageDelayed(msg,200) } - if(user == 0){ - tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_red)) - tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_red)) - }else{ - tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_red_p)) - tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_red_p)) + when (user) { + 0 -> { + //司机端 + tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_red)) + tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_red)) + } + 1 -> { + //TAXI乘客端 + tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_red_p)) + tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_red_p)) + } + else -> { + //BUS乘客端 + tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_red_p_bus)) + tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_red_p_bus)) + } } } TrafficLightEnum.YELLOW->{ @@ -195,12 +224,22 @@ class TrafficLightPromptView @JvmOverloads constructor( msg.obj = currentDuration mLightHandler.sendMessageDelayed(msg,200) } - if(user == 0){ - tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_yellow)) - tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_yellow)) - }else{ - tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_yellow_p)) - tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_yellow_p)) + when (user) { + 0 -> { + //司机端 + tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_yellow)) + tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_yellow)) + } + 1 -> { + //TAXI乘客端 + tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_yellow_p)) + tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_yellow_p)) + } + else -> { + //BUS乘客端 + tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_yellow_p_bus)) + tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_yellow_p_bus)) + } } } TrafficLightEnum.BLACK->{ @@ -218,33 +257,57 @@ class TrafficLightPromptView @JvmOverloads constructor( } when(nextState){ TrafficLightEnum.GREEN->{ - if(user == 0){ - //司机端提示 - tvPromptTitle?.text = "即将绿灯" - tvPromptContent?.text = "请准备出发" - }else{ - //乘客端提示 - tvPromptContent?.text = "即将绿灯,请准备出发" + when (user) { + 0 -> { + //司机端提示 + tvPromptTitle?.text = "即将绿灯" + tvPromptContent?.text = "请准备出发" + } + 1 -> { + //TAXI乘客端提示 + tvPromptContent?.text = "即将绿灯,请准备出发" + } + else -> { + //BUS乘客端提示 + tvPromptTitle?.text = "即将绿灯" + tvPromptContent?.text = "请准备出发" + } } } TrafficLightEnum.RED->{ - if(user == 0){ - //司机端提示 - tvPromptTitle?.text = "即将红灯" - tvPromptContent?.text = "请减速慢行" - }else{ - //乘客端提示 - tvPromptContent?.text = "即将红灯,请减速慢行" + when (user) { + 0 -> { + //司机端提示 + tvPromptTitle?.text = "即将红灯" + tvPromptContent?.text = "请减速慢行" + } + 1 -> { + //TAXI乘客端提示 + tvPromptContent?.text = "即将红灯,请减速慢行" + } + else -> { + //BUS乘客端提示 + tvPromptTitle?.text = "即将红灯" + tvPromptContent?.text = "请减速慢行" + } } } TrafficLightEnum.YELLOW->{ - if(user == 0){ - //司机端提示 - tvPromptTitle?.text = "即将黄灯" - tvPromptContent?.text = "请减速慢行" - }else{ - //乘客端提示 - tvPromptContent?.text = "即将红灯,请减速慢行" + when (user) { + 0 -> { + //司机端提示 + tvPromptTitle?.text = "即将黄灯" + tvPromptContent?.text = "请减速慢行" + } + 1 -> { + //TAXI乘客端提示 + tvPromptContent?.text = "即将红灯,请减速慢行" + } + else -> { + //BUS乘客端提示 + tvPromptTitle?.text = "即将黄灯" + tvPromptContent?.text = "请减速慢行" + } } } TrafficLightEnum.BLACK->{ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/bg_light_prompt_bus_p.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/bg_light_prompt_bus_p.png new file mode 100644 index 0000000000..96a1c7baae Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/bg_light_prompt_bus_p.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_traffic_light_prompt_p_bus.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_traffic_light_prompt_p_bus.xml new file mode 100644 index 0000000000..d341621241 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_traffic_light_prompt_p_bus.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_traffic_light_prompt_p.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_traffic_light_prompt_p_taxi.xml similarity index 100% rename from core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_traffic_light_prompt_p.xml rename to core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_traffic_light_prompt_p_taxi.xml diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml index 555525b2a3..f286b4bedd 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml @@ -84,8 +84,11 @@ #31FF56 #FFCD3D #F63C12 + #F63C12 #36DB1C + #1FD74A #FDB700 + #FDB400 #131415 diff --git a/core/mogo-core-res/src/main/res/values/dimens.xml b/core/mogo-core-res/src/main/res/values/dimens.xml index edb2344b4f..6a2585cc0d 100644 --- a/core/mogo-core-res/src/main/res/values/dimens.xml +++ b/core/mogo-core-res/src/main/res/values/dimens.xml @@ -1106,6 +1106,7 @@ 45dp 46dp 48dp + 50dp 52dp 55dp 57dp