diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt index 140f923748..56b5d25457 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt @@ -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) } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_traffic_light_ai.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_traffic_light_ai.png new file mode 100644 index 0000000000..bbb4ac0f33 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_traffic_light_ai.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_traffic_light_obu.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_traffic_light_obu.png new file mode 100644 index 0000000000..bcfc24dbe1 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_traffic_light_obu.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_traffic_light_vehicle.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_traffic_light_vehicle.png new file mode 100644 index 0000000000..88ff6c3250 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_traffic_light_vehicle.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_view_traffic_light.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_view_traffic_light.xml index 4bda39f7de..c5e84468e4 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_view_traffic_light.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_view_traffic_light.xml @@ -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" /> - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml index 8455161f95..1097775dc6 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml @@ -212,4 +212,6 @@ 消息盒子吐司图标 + 红绿灯信号来源 +