[6.7.0]数据上车到BUS-红绿灯乘客端
@@ -269,7 +269,7 @@ class TrafficLightPromptView @JvmOverloads constructor(
|
||||
}
|
||||
else -> {
|
||||
//BUS乘客端提示
|
||||
tvPromptTitle?.text = "即将绿灯"
|
||||
tvPromptTitle?.text = "即将绿灯,"
|
||||
tvPromptContent?.text = "请准备出发"
|
||||
}
|
||||
}
|
||||
@@ -287,7 +287,7 @@ class TrafficLightPromptView @JvmOverloads constructor(
|
||||
}
|
||||
else -> {
|
||||
//BUS乘客端提示
|
||||
tvPromptTitle?.text = "即将红灯"
|
||||
tvPromptTitle?.text = "即将红灯,"
|
||||
tvPromptContent?.text = "请减速慢行"
|
||||
}
|
||||
}
|
||||
@@ -305,7 +305,7 @@ class TrafficLightPromptView @JvmOverloads constructor(
|
||||
}
|
||||
else -> {
|
||||
//BUS乘客端提示
|
||||
tvPromptTitle?.text = "即将黄灯"
|
||||
tvPromptTitle?.text = "即将黄灯,"
|
||||
tvPromptContent?.text = "请减速慢行"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,7 @@ class FusionTrafficLightView @JvmOverloads constructor(
|
||||
private const val TAG = "FusionTrafficLightView"
|
||||
}
|
||||
|
||||
private var user = 0 //使用方,driver:0 passenger:1
|
||||
private var mCurrentLightId = TrafficLightEnum.BLACK
|
||||
private var user = 0 //使用方,driver:0 passenger taxi:1 passenger bus:2
|
||||
private var totalDuration = 0 //一轮灯态的总时长
|
||||
private var currentAngle = 0f //指针指向角度
|
||||
|
||||
@@ -59,10 +58,19 @@ class FusionTrafficLightView @JvmOverloads constructor(
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
if(user == 0){
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_view_fusion_traffic_light, this, true)
|
||||
}else{
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_view_fusion_traffic_light_p, this, true)
|
||||
when (user) {
|
||||
0 -> {
|
||||
//司机端
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_view_fusion_traffic_light, this, true)
|
||||
}
|
||||
1 -> {
|
||||
//Taxi乘客端
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_view_fusion_traffic_light_p, this, true)
|
||||
}
|
||||
else -> {
|
||||
//Bus乘客端
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_view_fusion_traffic_light_p_bus, this, true)
|
||||
}
|
||||
}
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
fusionTrafficLightNum = findViewById(R.id.fusionTrafficLightNum)
|
||||
@@ -229,19 +237,40 @@ class FusionTrafficLightView @JvmOverloads constructor(
|
||||
//根据当前灯态设置转盘、刻度、指针背景
|
||||
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))
|
||||
if(user == 2){
|
||||
//BUS乘客端
|
||||
fusionTrafficLightState?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green_p_bus))
|
||||
fusionTrafficLightScale?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green_scale_p_bus))
|
||||
fusionTrafficLightPointer?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green_pointer_p_bus))
|
||||
}else{
|
||||
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))
|
||||
if(user == 2){
|
||||
//BUS乘客端
|
||||
fusionTrafficLightState?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow_p_bus))
|
||||
fusionTrafficLightScale?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow_scale_p_bus))
|
||||
fusionTrafficLightPointer?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow_pointer_p_bus))
|
||||
}else{
|
||||
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(user == 2){
|
||||
//BUS乘客端
|
||||
fusionTrafficLightState?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red_p_bus))
|
||||
fusionTrafficLightScale?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red_scale_p_bus))
|
||||
fusionTrafficLightPointer?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red_pointer_p_bus))
|
||||
}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))
|
||||
}
|
||||
}
|
||||
}
|
||||
//更新当前灯态倒计时时间
|
||||
@@ -250,7 +279,7 @@ class FusionTrafficLightView @JvmOverloads constructor(
|
||||
}else{
|
||||
fusionTrafficLightNum?.text = "0"
|
||||
}
|
||||
//当时间为1开头时时间视觉上看不是左右居中对齐,需要做便宜操作
|
||||
//当时间为1开头时时间视觉上看不是左右居中对齐,需要做偏移操作
|
||||
if(currentDuration.toString().startsWith("1")){
|
||||
val numLayoutParams = fusionTrafficLightNum?.layoutParams as LayoutParams
|
||||
numLayoutParams.rightMargin = 6
|
||||
|
||||
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 501 B |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 502 B |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 510 B |
|
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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_132"
|
||||
android:layout_height="@dimen/dp_132"
|
||||
android:background="@drawable/bg_fusion_traffic_light_p_bus"
|
||||
>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.ProportionChartView
|
||||
android:id="@+id/fusionTrafficLightProportion"
|
||||
android:layout_width="@dimen/dp_113"
|
||||
android:layout_height="@dimen/dp_113"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fusionTrafficLightState"
|
||||
android:layout_width="@dimen/dp_110"
|
||||
android:layout_height="@dimen/dp_110"
|
||||
app:layout_constraintTop_toTopOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintBottom_toBottomOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintLeft_toLeftOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintRight_toRightOf="@id/fusionTrafficLightProportion"
|
||||
android:src="@drawable/icon_light_green_p_bus"
|
||||
android:contentDescription="@string/fusion_traffic_light_state"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fusionTrafficLightScale"
|
||||
android:layout_width="@dimen/dp_102"
|
||||
android:layout_height="@dimen/dp_102"
|
||||
app:layout_constraintTop_toTopOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintBottom_toBottomOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintLeft_toLeftOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintRight_toRightOf="@id/fusionTrafficLightProportion"
|
||||
android:src="@drawable/icon_light_green_scale_p_bus"
|
||||
android:contentDescription="@string/fusion_traffic_light_scale"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fusionTrafficLightPointer"
|
||||
android:layout_width="@dimen/dp_18"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
app:layout_constraintCircle="@id/fusionTrafficLightState"
|
||||
app:layout_constraintCircleRadius="@dimen/dp_46"
|
||||
android:src="@drawable/icon_light_green_pointer_p_bus"
|
||||
android:contentDescription="@string/fusion_traffic_light_pointer"
|
||||
tools:ignore="MissingConstraints"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
|
||||
android:id="@+id/fusionTrafficLightNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintBottom_toBottomOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintLeft_toLeftOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintRight_toRightOf="@id/fusionTrafficLightProportion"
|
||||
android:textColor="#063330"
|
||||
android:textSize="@dimen/sp_42"
|
||||
app:textType="DS_DIGIB_2"
|
||||
android:text="10"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -14,7 +14,8 @@
|
||||
android:textColor="#203555"
|
||||
android:textSize="@dimen/sp_28"
|
||||
android:layout_marginTop="@dimen/dp_55"
|
||||
android:layout_marginStart="@dimen/dp_70"
|
||||
android:layout_marginStart="@dimen/dp_61"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
@@ -25,18 +26,19 @@
|
||||
app:layout_constraintLeft_toLeftOf="@id/tvPromptTitle"
|
||||
android:textSize="@dimen/sp_28"
|
||||
android:textColor="#203555"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
<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_constraintBottom_toBottomOf="@id/tvPromptContent"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvPromptContent"
|
||||
android:textSize="@dimen/sp_90"
|
||||
android:layout_marginStart="@dimen/dp_30"
|
||||
android:layout_marginStart="@dimen/dp_19"
|
||||
app:textType="DS_DIGIB_2"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_marginBottom="@dimen/dp_m_10"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
<attr name="fusionLightUser">
|
||||
<enum name="driver" value="0"/>
|
||||
<enum name="passenger" value="1"/>
|
||||
<enum name="passenger_bus" value="2"/>
|
||||
</attr>
|
||||
</declare-styleable>
|
||||
|
||||
|
||||