From 6896faa6983d9e95290de9d08742d5bbc91f0c47 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Tue, 18 Apr 2023 10:12:45 +0800 Subject: [PATCH] [2.15.0] fix bug of custom pnc action view --- .../function/hmi/ui/vehicle/PncActionsView.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/PncActionsView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/PncActionsView.kt index 58bfe45c84..5b17603b00 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/PncActionsView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/PncActionsView.kt @@ -44,8 +44,8 @@ class PncActionsView @JvmOverloads constructor( private var mAutoPilotStatusInfo: AutopilotStatusInfo? = null private val bgResources: Int - private val topMargin: Int - private val txtSize: Int + private val topMargin: Float + private val txtSize: Float init { LayoutInflater.from(context).inflate(R.layout.view_pnc_actions, this, true) @@ -54,21 +54,21 @@ class PncActionsView @JvmOverloads constructor( R.styleable.PncActionsView_background_resource, R.drawable.pnc_actions_bg ) - topMargin = a.getResourceId( + topMargin = a.getDimension( R.styleable.PncActionsView_pnc_top_margin, - resources.getDimension(R.dimen.dp_30).toInt() + resources.getDimension(R.dimen.dp_30) ) - txtSize = a.getResourceId( + txtSize = a.getDimension( R.styleable.PncActionsView_pnc_size, - resources.getDimension(R.dimen.dp_34).toInt() + resources.getDimension(R.dimen.dp_34) ) a.recycle() } override fun onAttachedToWindow() { super.onAttachedToWindow() - (tvHmiPncActions.layoutParams as MarginLayoutParams).topMargin = topMargin - tvHmiPncActions.setTextSize(COMPLEX_UNIT_PX, txtSize.toFloat()) + (tvHmiPncActions.layoutParams as MarginLayoutParams).topMargin = topMargin.toInt() + tvHmiPncActions.setTextSize(COMPLEX_UNIT_PX, txtSize) CallerAutoPilotStatusListenerManager.addListener(TAG, this) CallerPlanningActionsListenerManager.addListener(TAG, this)