[6.7.0]红绿灯UI改版
This commit is contained in:
@@ -44,7 +44,8 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
private var mTrafficLightClBG: ConstraintLayout ?= null //司机端红绿灯背景
|
||||
private var mLightTimeTV: TypefaceTextView ?= null //司机端红绿灯倒计时
|
||||
private var mLightTimeTVP: GradientTextView? = null //乘客屏红绿灯倒计时
|
||||
private var mLightSourceTV: TextView? = null //红绿灯来源
|
||||
private var mLightSourceTV: TextView? = null //乘客端红绿灯来源
|
||||
private var mLightSourceIV: ImageView ?= null //司机端红绿灯来源
|
||||
private var mLightSourceDivider: View? = null //分割线
|
||||
|
||||
private var mCurrentLightId = TrafficLightEnum.BLACK
|
||||
@@ -70,19 +71,20 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_view_traffic_light, this, true)
|
||||
}
|
||||
mLightIconIV = findViewById(R.id.hmi_traffic_light_iv)
|
||||
mLightSourceTV = findViewById(R.id.hmi_traffic_light_source)
|
||||
mLightSourceDivider = findViewById(R.id.hmi_traffic_light_divider)
|
||||
if(trafficLightUser==1){
|
||||
mLightIconBG = findViewById(R.id.hmi_traffic_light_bg)
|
||||
mLightTimeTVP = findViewById(R.id.hmi_traffic_light_time_tv_p)
|
||||
mLightSourceTV = findViewById(R.id.hmi_traffic_light_source)
|
||||
}else{
|
||||
mTrafficLightClBG = findViewById(R.id.hmi_traffic_light_cl_bg)
|
||||
mLightTimeTV = findViewById(R.id.hmi_traffic_light_time_tv)
|
||||
mLightSourceIV = findViewById(R.id.hmi_traffic_light_source_image)
|
||||
}
|
||||
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
CallerHmiViewControlListenerManager.addListener(TrafficLightView_TAG, this)
|
||||
CallerSkinModeListenerManager.addListener(this.hashCode().toString(), this)
|
||||
CallerTrafficLightListenerManager.addListener(this.hashCode().toString(), this)
|
||||
CallerHmiViewControlListenerManager.addListener(this.hashCode().toString(), this)
|
||||
|
||||
if(trafficLightUser==1){
|
||||
mLightIconBG?.setBackgroundResource(R.drawable.traffic_light_bg_taxi_p)
|
||||
@@ -98,9 +100,9 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerSkinModeListenerManager.removeListener(TAG)
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
CallerHmiViewControlListenerManager.removeListener(TrafficLightView_TAG)
|
||||
CallerSkinModeListenerManager.removeListener(this.hashCode().toString())
|
||||
CallerTrafficLightListenerManager.removeListener(this.hashCode().toString())
|
||||
CallerHmiViewControlListenerManager.removeListener(this.hashCode().toString())
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
@@ -172,7 +174,13 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
context.resources.getDimension(R.dimen.dp_310).toInt()
|
||||
}else{
|
||||
//司机屏
|
||||
//TODO
|
||||
val lp = this.layoutParams as MarginLayoutParams
|
||||
lp.width = context.resources.getDimension(R.dimen.dp_280).toInt()
|
||||
this.layoutParams = lp
|
||||
mLightSourceIV?.visibility = VISIBLE
|
||||
mLightSourceDivider!!.visibility = VISIBLE
|
||||
mLightTimeTV?.visibility = GONE
|
||||
mTrafficLightClBG?.setBackgroundResource(R.drawable.icon_single_traffic_light_perception_bg)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -327,12 +335,14 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
else -> this@SingleTrafficLightView.visibility = GONE
|
||||
}
|
||||
when (lightSource) {
|
||||
//TODO 司机屏展示来源需要更改文案
|
||||
DataSourceType.AICLOUD -> {
|
||||
if(trafficLightUser == 1){
|
||||
mLightSourceTV?.text = context.getString(R.string.light_source_ai_cloud)
|
||||
}else{
|
||||
mLightSourceTV?.text = context.getString(R.string.light_source_driver_ai_cloud)
|
||||
mLightSourceIV?.setImageDrawable(ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_traffic_light_ai
|
||||
))
|
||||
}
|
||||
}
|
||||
DataSourceType.TELEMATIC_UNION_V2I,
|
||||
@@ -341,16 +351,20 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
if(trafficLightUser == 1){
|
||||
mLightSourceTV?.text = context.getString(R.string.light_source_perception)
|
||||
}else{
|
||||
mLightSourceTV?.text = context.getString(R.string.light_source_driver_perception)
|
||||
mLightSourceIV?.setImageDrawable(ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_traffic_light_vehicle
|
||||
))
|
||||
}
|
||||
}
|
||||
DataSourceType.OBU -> {
|
||||
if(trafficLightUser == 1){
|
||||
mLightSourceTV?.text = context.getString(R.string.light_source_obu)
|
||||
}else{
|
||||
mLightSourceTV?.text = context.getString(R.string.light_source_driver_obu)
|
||||
mLightSourceTV?.textSize = AutoSizeUtils.sp2px(context, 23f).toFloat()
|
||||
mLightSourceTV?.setLineSpacing(0f, 1.0f)
|
||||
mLightSourceIV?.setImageDrawable(ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_traffic_light_obu
|
||||
))
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
@@ -374,7 +388,13 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
context.resources.getDimension(R.dimen.hmi_traffic_light_bus_bg_width).toInt()
|
||||
}else{
|
||||
//司机屏
|
||||
//TODO
|
||||
val lp = this.layoutParams as MarginLayoutParams
|
||||
lp.width = context.resources.getDimension(R.dimen.dp_368).toInt()
|
||||
this.layoutParams = lp
|
||||
mLightSourceIV?.visibility = VISIBLE
|
||||
mLightSourceDivider!!.visibility = VISIBLE
|
||||
mLightTimeTV?.visibility = VISIBLE
|
||||
mTrafficLightClBG?.setBackgroundResource(R.drawable.icon_single_traffic_light_bg)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -37,22 +37,19 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:background="#999999"
|
||||
app:layout_constraintRight_toLeftOf="@id/hmi_traffic_light_source"
|
||||
app:layout_constraintRight_toLeftOf="@id/hmi_traffic_light_source_image"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hmi_traffic_light_source"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
<ImageView
|
||||
android:id="@+id/hmi_traffic_light_source_image"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:orientation="vertical"
|
||||
android:textSize="@dimen/sp_32"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginEnd="@dimen/dp_65"
|
||||
android:contentDescription="@string/traffic_light_source"
|
||||
android:layout_marginEnd="@dimen/dp_50"
|
||||
/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -212,4 +212,6 @@
|
||||
|
||||
<string name="msg_box_toast_icon">消息盒子吐司图标</string>
|
||||
|
||||
<string name="traffic_light_source">红绿灯信号来源</string>
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user