From bd75be898a79cb26580a02912bba9e593dff6f44 Mon Sep 17 00:00:00 2001 From: aibingbing Date: Thu, 11 Jul 2024 12:03:04 +0800 Subject: [PATCH] =?UTF-8?q?[6.5.0][=E4=BA=8B=E4=BB=B6=E5=BC=B9=E6=A1=86]?= =?UTF-8?q?=20refactor:=20=E4=BF=AE=E6=94=B9UI=20=E8=B5=B0=E6=9F=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9B=20feat:=20=E4=B8=8D=E5=9C=A8?= =?UTF-8?q?=E9=AB=98=E7=B2=BE=E5=9C=B0=E5=9B=BE=E9=A1=B5=E9=9D=A2=E4=B8=8D?= =?UTF-8?q?=E5=BC=B9=E4=BA=8B=E4=BB=B6=E6=A1=86=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hmi/ui/v2n/RoadV2NEventWindowView.kt | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/v2n/RoadV2NEventWindowView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/v2n/RoadV2NEventWindowView.kt index 7c62335a9a..b9d11f326e 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/v2n/RoadV2NEventWindowView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/v2n/RoadV2NEventWindowView.kt @@ -18,7 +18,9 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.v2x.RoadV2NEventType import com.mogo.eagle.core.data.v2x.RoadV2NEventWindowBean import com.mogo.eagle.core.function.api.hmi.v2n.IRoadV2NEventWindowListener +import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager +import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager import com.mogo.eagle.core.function.call.hmi.CallerRoadV2NEventWindowListenerManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils @@ -47,7 +49,8 @@ class RoadV2NEventWindowView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : ConstraintLayout(context, attrs, defStyleAttr), IRoadV2NEventWindowListener { +) : ConstraintLayout(context, attrs, defStyleAttr), IRoadV2NEventWindowListener, + IViewControlListener { companion object { const val TAG = "RoadV2NEventWindowView" @@ -62,6 +65,7 @@ class RoadV2NEventWindowView @JvmOverloads constructor( map ) } + CallerLogger.i(TAG, msg) } } @@ -71,6 +75,9 @@ class RoadV2NEventWindowView @JvmOverloads constructor( private var currentEventUUID: String = "" + // 只有在高精地图的tab才展示事件弹框 + private var canShowV2NEventWindowView = true + init { LayoutInflater.from(context).inflate(R.layout.hmi_view_road_v2n_event_window, this, true) } @@ -101,7 +108,7 @@ class RoadV2NEventWindowView @JvmOverloads constructor( containerIconHintLayoutParams.width = LayoutParams.MATCH_PARENT containerIconHintLayoutParams.height = LayoutParams.WRAP_CONTENT containerIconHintLayoutParams.setMargins( - AutoSizeUtils.dp2px(context, 50f - 17f), //乘客屏icon ivV2XImage带了白边 + AutoSizeUtils.dp2px(context, 50f - 17f), //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整 AutoSizeUtils.dp2px(context, 40f), AutoSizeUtils.dp2px(context, 50f), 0 @@ -109,18 +116,23 @@ class RoadV2NEventWindowView @JvmOverloads constructor( containerIconHint.layoutParams = containerIconHintLayoutParams val ivV2XImageLayoutParams = ivV2XImage.layoutParams as RelativeLayout.LayoutParams - ivV2XImageLayoutParams.width = AutoSizeUtils.dp2px(context, 69f + 34f) //乘客屏icon ivV2XImage带了白边 - ivV2XImageLayoutParams.height = AutoSizeUtils.dp2px(context, 69f + 34f) //乘客屏icon ivV2XImage带了白边 + ivV2XImageLayoutParams.width = + AutoSizeUtils.dp2px(context, 69f + 34f) //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整 + ivV2XImageLayoutParams.height = + AutoSizeUtils.dp2px(context, 69f + 34f) //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整 ivV2XImage.layoutParams = ivV2XImageLayoutParams val tvV2XHintContentLayoutParams = tvV2XHintContent.layoutParams as RelativeLayout.LayoutParams tvV2XHintContentLayoutParams.setMargins( - AutoSizeUtils.dp2px(context, 30f - 17f), 0,//乘客屏icon ivV2XImage带了白边 - AutoSizeUtils.dp2px(context, 15f), 0 + AutoSizeUtils.dp2px(context, 30f - 17f), //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整 + 0, + AutoSizeUtils.dp2px(context, 15f), + 0 ) tvV2XHintContent.layoutParams = tvV2XHintContentLayoutParams tvV2XHintContent.setTextColor(Color.parseColor("#131415")) + tvV2XHintContent.setPadding(0, 0, 0, AutoSizeUtils.dp2px(context, 16f)) val containerImageAndLiveVideoLayoutParams = containerImageAndLiveVideo.layoutParams as ConstraintLayout.LayoutParams @@ -134,7 +146,7 @@ class RoadV2NEventWindowView @JvmOverloads constructor( ) containerImageAndLiveVideo.layoutParams = containerImageAndLiveVideoLayoutParams - contentImageView.setRadius(AutoSizeUtils.dp2px(context, 16f).toFloat()) + contentImageView.setRadius(16f) val tvV2XTimeStrLayoutParams = tvV2XTimeStr.layoutParams as ConstraintLayout.LayoutParams @@ -223,7 +235,7 @@ class RoadV2NEventWindowView @JvmOverloads constructor( ) containerImageAndLiveVideo.layoutParams = containerImageAndLiveVideoLayoutParams - contentImageView.setRadius(AutoSizeUtils.dp2px(context, 12f).toFloat()) + contentImageView.setRadius(12f) val tvV2XTimeStrLayoutParams = tvV2XTimeStr.layoutParams as ConstraintLayout.LayoutParams @@ -262,16 +274,22 @@ class RoadV2NEventWindowView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() CallerRoadV2NEventWindowListenerManager.addListener(TAG, this) + CallerHmiViewControlListenerManager.addListener(TAG, this) initView() } override fun onDetachedFromWindow() { super.onDetachedFromWindow() CallerRoadV2NEventWindowListenerManager.removeListener(TAG) + CallerHmiViewControlListenerManager.removeListener(TAG) } override fun show(dataBean: RoadV2NEventWindowBean) { trackEvent("show --> ${dataBean.toString()}") + if (!canShowV2NEventWindowView) { + trackEvent("show --> 当前不在高精地图页面,跳过") + return + } UiThreadHandler.removeCallbacks(dismissRunnable) UiThreadHandler.post { currentEventUUID = dataBean.eventId @@ -335,4 +353,9 @@ class RoadV2NEventWindowView @JvmOverloads constructor( } } } + + override fun mainPageViewVisible(v: Int) { + canShowV2NEventWindowView = (View.VISIBLE == v) + trackEvent("mainPageViewVisible --> $canShowV2NEventWindowView") + } } \ No newline at end of file