[6.7.0]数据上车-红绿灯bus乘客端
This commit is contained in:
@@ -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->{
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/dp_396"
|
||||
android:layout_height="@dimen/dp_183"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@drawable/bg_light_prompt_bus_p">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvPromptTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:textColor="#203555"
|
||||
android:textSize="@dimen/sp_28"
|
||||
android:layout_marginTop="@dimen/dp_55"
|
||||
android:layout_marginStart="@dimen/dp_70"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvPromptContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvPromptTitle"
|
||||
app:layout_constraintLeft_toLeftOf="@id/tvPromptTitle"
|
||||
android:textSize="@dimen/sp_28"
|
||||
android:textColor="#203555"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
|
||||
android:id="@+id/tvTrafficNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvPromptContent"
|
||||
android:textSize="@dimen/sp_90"
|
||||
android:layout_marginStart="@dimen/dp_30"
|
||||
app:textType="DS_DIGIB_2"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
|
||||
android:id="@+id/tvTrafficNumDecimal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvPromptContent"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvTrafficNum"
|
||||
android:layout_marginStart="@dimen/dp_2"
|
||||
android:textSize="@dimen/sp_50"
|
||||
app:textType="DS_DIGIB_2"
|
||||
android:layout_marginBottom="@dimen/dp_m_2"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -84,8 +84,11 @@
|
||||
<color name="light_prompt_green">#31FF56</color>
|
||||
<color name="light_prompt_yellow">#FFCD3D</color>
|
||||
<color name="light_prompt_red_p">#F63C12</color>
|
||||
<color name="light_prompt_red_p_bus">#F63C12</color>
|
||||
<color name="light_prompt_green_p">#36DB1C</color>
|
||||
<color name="light_prompt_green_p_bus">#1FD74A</color>
|
||||
<color name="light_prompt_yellow_p">#FDB700</color>
|
||||
<color name="light_prompt_yellow_p_bus">#FDB400</color>
|
||||
|
||||
<color name="auto_exploration_content_p">#131415</color>
|
||||
|
||||
|
||||
@@ -1106,6 +1106,7 @@
|
||||
<dimen name="sp_45">45dp</dimen>
|
||||
<dimen name="sp_46">46dp</dimen>
|
||||
<dimen name="sp_48">48dp</dimen>
|
||||
<dimen name="sp_50">50dp</dimen>
|
||||
<dimen name="sp_52">52dp</dimen>
|
||||
<dimen name="sp_55">55dp</dimen>
|
||||
<dimen name="sp_57">57dp</dimen>
|
||||
|
||||
Reference in New Issue
Block a user