[6.7.0][数据上车] feat: 接驳/公交 B2乘客端增加通用事件弹框view ;

This commit is contained in:
aibingbing
2024-09-26 17:52:39 +08:00
parent aaa63597ba
commit a665332bec
3 changed files with 357 additions and 200 deletions

View File

@@ -75,6 +75,10 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
}
private val isB2 by lazy {
AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)
}
private var currentEventUUID: String = ""
init {
@@ -89,207 +93,13 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
private fun initView() {
if (isPassengerScreen) {
val layoutParam =
roundRoadV2NEventContainer.layoutParams as ConstraintLayout.LayoutParams
layoutParam.width = AutoSizeUtils.dp2px(
context, (580 + 37 + 37).toFloat()
)
layoutParam.height = ConstraintLayout.LayoutParams.WRAP_CONTENT
layoutParam.setMargins(
0,
0,
AutoSizeUtils.dp2px(context, 40f - 37f),
0
)
roundRoadV2NEventContainer.layoutParams = layoutParam
roundRoadV2NEventContainer.background = ContextCompat.getDrawable(
context,
R.drawable.hmi_v2n_event_bg_passenger
)
//乘客屏 背景图 右边带了 37px 渐变
val padding = AutoSizeUtils.dp2px(context, 37f)
roundRoadV2NEventContainer.setPadding(padding, padding, padding, padding)
val containerIconHintLayoutParams =
containerIconHint.layoutParams as ConstraintLayout.LayoutParams
containerIconHintLayoutParams.width = LayoutParams.MATCH_PARENT
containerIconHintLayoutParams.height = LayoutParams.WRAP_CONTENT
containerIconHintLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 36f - 19.4f), //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整
AutoSizeUtils.dp2px(context, 30f - 10.7f),
AutoSizeUtils.dp2px(context, 36f),
0
)
containerIconHint.layoutParams = containerIconHintLayoutParams
val ivV2XImageLayoutParams = ivV2XImage.layoutParams as RelativeLayout.LayoutParams
ivV2XImageLayoutParams.width =
AutoSizeUtils.dp2px(
context,
69f + 14f + 14f
) //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整
ivV2XImageLayoutParams.height =
AutoSizeUtils.dp2px(
context,
69f + 14f + 14f
) //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整
ivV2XImage.layoutParams = ivV2XImageLayoutParams
val tvV2XHintContentLayoutParams =
tvV2XHintContent.layoutParams as RelativeLayout.LayoutParams
tvV2XHintContentLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 30f - 19.7f), //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整
AutoSizeUtils.dp2px(context, (34f + 14f) - (46f / 2f)),
AutoSizeUtils.dp2px(context, 5f),
0
)
tvV2XHintContent.layoutParams = tvV2XHintContentLayoutParams
tvV2XHintContent.setTextColor(Color.parseColor("#131415"))
tvV2XHintContent.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
AutoSizeUtils.dp2px(context, 28f).toFloat()
)
tvV2XHintContent.setTypeface(null, Typeface.NORMAL)
tvV2XHintContent.setPadding(0, 0, 0, AutoSizeUtils.dp2px(context, 28f))
val containerImageAndLiveVideoLayoutParams =
containerImageAndLiveVideo.layoutParams as ConstraintLayout.LayoutParams
containerImageAndLiveVideoLayoutParams.width = AutoSizeUtils.dp2px(context, 480f + 18f) //乘客屏视频加载里面背景切图包含了白边
containerImageAndLiveVideoLayoutParams.height = AutoSizeUtils.dp2px(context, 280f)
containerImageAndLiveVideoLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 40f),
AutoSizeUtils.dp2px(context, 0f), //乘客屏icon ivV2XImage带了白边
AutoSizeUtils.dp2px(context, 44f),
0
)
containerImageAndLiveVideo.layoutParams = containerImageAndLiveVideoLayoutParams
contentImageView.setRadius(16f)
val tvV2XTimeStrLayoutParams =
tvV2XTimeStr.layoutParams as ConstraintLayout.LayoutParams
tvV2XTimeStrLayoutParams.width = LayoutParams.MATCH_PARENT
tvV2XTimeStrLayoutParams.height = LayoutParams.WRAP_CONTENT
tvV2XTimeStrLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 40f),
AutoSizeUtils.dp2px(context, 19f),
AutoSizeUtils.dp2px(context, 40f),
AutoSizeUtils.dp2px(context, 19f)
)
tvV2XTimeStr.layoutParams = tvV2XTimeStrLayoutParams
tvV2XTimeStr.setTextColor(Color.parseColor("#131415"))
tvV2XTimeStr.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
AutoSizeUtils.dp2px(context, 24f).toFloat()
)
ivClose.setImageResource(R.drawable.hmi_v2n_event_icon_close_passenger)
ivClose.setPadding(
AutoSizeUtils.dp2px(context, 2f),
AutoSizeUtils.dp2px(context, 2f),
AutoSizeUtils.dp2px(context, 2f),
AutoSizeUtils.dp2px(context, 2f)
)
val ivCloseLayoutParams = ivClose.layoutParams as ConstraintLayout.LayoutParams
ivCloseLayoutParams.width = AutoSizeUtils.dp2px(context, 32f)
ivCloseLayoutParams.height = AutoSizeUtils.dp2px(context, 32f)
ivCloseLayoutParams.setMargins(
0,
AutoSizeUtils.dp2px(context, 24f),
AutoSizeUtils.dp2px(context, 24f),
0
)
ivClose.layoutParams = ivCloseLayoutParams
containerEventContent.requestLayout()
roundRoadV2NEventContainer.requestLayout()
if (isB2) {
setB2PassengerScreenView()
} else {
setTaxiPassengerScreenView()
}
} else {
val layoutParam =
roundRoadV2NEventContainer.layoutParams as ConstraintLayout.LayoutParams
layoutParam.width = AutoSizeUtils.dp2px(context, (654 + 0 + 0).toFloat())
layoutParam.height = ConstraintLayout.LayoutParams.WRAP_CONTENT
roundRoadV2NEventContainer.layoutParams = layoutParam
roundRoadV2NEventContainer.background =
ContextCompat.getDrawable(context, R.drawable.hmi_v2n_event_bg_driver)
val padding = AutoSizeUtils.dp2px(context, 0f)
roundRoadV2NEventContainer.setPadding(padding, padding, padding, padding)
val containerIconHintLayoutParams =
containerIconHint.layoutParams as ConstraintLayout.LayoutParams
containerIconHintLayoutParams.width = LayoutParams.MATCH_PARENT
containerIconHintLayoutParams.height = LayoutParams.WRAP_CONTENT
containerIconHintLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 30f - 16f),
AutoSizeUtils.dp2px(context, 30f - 14f),
AutoSizeUtils.dp2px(context, 30f - 16f),
0
)
containerIconHint.layoutParams = containerIconHintLayoutParams
val ivV2XImageLayoutParams = ivV2XImage.layoutParams as RelativeLayout.LayoutParams
ivV2XImageLayoutParams.width = AutoSizeUtils.dp2px(context, 120f + 16f + 16f)
ivV2XImageLayoutParams.height = AutoSizeUtils.dp2px(context, 120f + 16f + 16f)
ivV2XImage.layoutParams = ivV2XImageLayoutParams
val tvV2XHintContentLayoutParams =
tvV2XHintContent.layoutParams as RelativeLayout.LayoutParams
tvV2XHintContentLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 30f - 14f),
AutoSizeUtils.dp2px(context, (60f + 16f) - (50f / 2f)),
AutoSizeUtils.dp2px(context, 5f),
0
)
tvV2XHintContent.layoutParams = tvV2XHintContentLayoutParams
tvV2XHintContent.setTextColor(Color.parseColor("#FFFFFF"))
tvV2XHintContent.setTypeface(null, Typeface.BOLD)
tvV2XHintContent.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
AutoSizeUtils.dp2px(context, 32f).toFloat()
)
val containerImageAndLiveVideoLayoutParams =
containerImageAndLiveVideo.layoutParams as ConstraintLayout.LayoutParams
containerImageAndLiveVideoLayoutParams.width = AutoSizeUtils.dp2px(context, 593f)
containerImageAndLiveVideoLayoutParams.height = AutoSizeUtils.dp2px(context, 330f)
containerImageAndLiveVideoLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 30f),
AutoSizeUtils.dp2px(context, 20f - 16f),
AutoSizeUtils.dp2px(context, 30f),
0
)
containerImageAndLiveVideo.layoutParams = containerImageAndLiveVideoLayoutParams
contentImageView.setRadius(12f)
val tvV2XTimeStrLayoutParams =
tvV2XTimeStr.layoutParams as ConstraintLayout.LayoutParams
tvV2XTimeStrLayoutParams.width = LayoutParams.MATCH_PARENT
tvV2XTimeStrLayoutParams.height = LayoutParams.WRAP_CONTENT
tvV2XTimeStrLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 30f),
AutoSizeUtils.dp2px(context, 12f),
AutoSizeUtils.dp2px(context, 30f),
AutoSizeUtils.dp2px(context, 24f)
)
tvV2XTimeStr.layoutParams = tvV2XTimeStrLayoutParams
tvV2XTimeStr.setTextColor(Color.parseColor("#999999"))
tvV2XTimeStr.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
AutoSizeUtils.dp2px(context, 26f).toFloat()
)
ivClose.setImageResource(R.drawable.hmi_v2n_event_icon_close_driver)
ivClose.setPadding(0, 0, 0, 0)
val ivCloseLayoutParams = ivClose.layoutParams as ConstraintLayout.LayoutParams
ivCloseLayoutParams.width = AutoSizeUtils.dp2px(context, 50f)
ivCloseLayoutParams.height = AutoSizeUtils.dp2px(context, 50f)
ivCloseLayoutParams.setMargins(0, 0, 0, 0)
ivClose.layoutParams = ivCloseLayoutParams
// 6.7.0 UI 没设计关闭按钮
ivClose.visibility = View.GONE
containerEventContent.requestLayout()
roundRoadV2NEventContainer.requestLayout()
setDriverScreenView()
}
ivClose.setOnClickListener {
@@ -297,6 +107,331 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
}
}
private fun setTaxiPassengerScreenView() {
val layoutParam =
roundRoadV2NEventContainer.layoutParams as ConstraintLayout.LayoutParams
layoutParam.width = AutoSizeUtils.dp2px(
context, (580 + 37 + 37).toFloat()
)
layoutParam.height = ConstraintLayout.LayoutParams.WRAP_CONTENT
layoutParam.setMargins(
0,
0,
AutoSizeUtils.dp2px(context, 40f - 37f),
0
)
roundRoadV2NEventContainer.layoutParams = layoutParam
roundRoadV2NEventContainer.background = ContextCompat.getDrawable(
context,
R.drawable.hmi_v2n_event_bg_passenger
)
//乘客屏 背景图 右边带了 37px 渐变
val padding = AutoSizeUtils.dp2px(context, 37f)
roundRoadV2NEventContainer.setPadding(padding, padding, padding, padding)
val containerIconHintLayoutParams =
containerIconHint.layoutParams as ConstraintLayout.LayoutParams
containerIconHintLayoutParams.width = LayoutParams.MATCH_PARENT
containerIconHintLayoutParams.height = LayoutParams.WRAP_CONTENT
containerIconHintLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 36f - 19.4f), //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整
AutoSizeUtils.dp2px(context, 30f - 10.7f),
AutoSizeUtils.dp2px(context, 36f),
0
)
containerIconHint.layoutParams = containerIconHintLayoutParams
val ivV2XImageLayoutParams = ivV2XImage.layoutParams as RelativeLayout.LayoutParams
ivV2XImageLayoutParams.width =
AutoSizeUtils.dp2px(
context,
69f + 14f + 14f
) //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整
ivV2XImageLayoutParams.height =
AutoSizeUtils.dp2px(
context,
69f + 14f + 14f
) //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整
ivV2XImage.layoutParams = ivV2XImageLayoutParams
val tvV2XHintContentLayoutParams =
tvV2XHintContent.layoutParams as RelativeLayout.LayoutParams
tvV2XHintContentLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 30f - 19.7f), //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整
AutoSizeUtils.dp2px(context, (34f + 14f) - (46f / 2f)),
AutoSizeUtils.dp2px(context, 5f),
0
)
tvV2XHintContent.layoutParams = tvV2XHintContentLayoutParams
tvV2XHintContent.setTextColor(Color.parseColor("#131415"))
tvV2XHintContent.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
AutoSizeUtils.dp2px(context, 28f).toFloat()
)
tvV2XHintContent.setTypeface(null, Typeface.NORMAL)
tvV2XHintContent.setPadding(0, 0, 0, AutoSizeUtils.dp2px(context, 28f))
val containerImageAndLiveVideoLayoutParams =
containerImageAndLiveVideo.layoutParams as ConstraintLayout.LayoutParams
containerImageAndLiveVideoLayoutParams.width = AutoSizeUtils.dp2px(context, 480f + 18f) //乘客屏视频加载里面背景切图包含了白边
containerImageAndLiveVideoLayoutParams.height = AutoSizeUtils.dp2px(context, 280f)
containerImageAndLiveVideoLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 40f),
AutoSizeUtils.dp2px(context, 0f), //乘客屏icon ivV2XImage带了白边
AutoSizeUtils.dp2px(context, 44f),
0
)
containerImageAndLiveVideo.layoutParams = containerImageAndLiveVideoLayoutParams
contentImageView.setRadius(16f)
val tvV2XTimeStrLayoutParams =
tvV2XTimeStr.layoutParams as ConstraintLayout.LayoutParams
tvV2XTimeStrLayoutParams.width = LayoutParams.MATCH_PARENT
tvV2XTimeStrLayoutParams.height = LayoutParams.WRAP_CONTENT
tvV2XTimeStrLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 40f),
AutoSizeUtils.dp2px(context, 19f),
AutoSizeUtils.dp2px(context, 40f),
AutoSizeUtils.dp2px(context, 19f)
)
tvV2XTimeStr.layoutParams = tvV2XTimeStrLayoutParams
tvV2XTimeStr.setTextColor(Color.parseColor("#131415"))
tvV2XTimeStr.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
AutoSizeUtils.dp2px(context, 24f).toFloat()
)
ivClose.setImageResource(R.drawable.hmi_v2n_event_icon_close_passenger)
ivClose.setPadding(
AutoSizeUtils.dp2px(context, 2f),
AutoSizeUtils.dp2px(context, 2f),
AutoSizeUtils.dp2px(context, 2f),
AutoSizeUtils.dp2px(context, 2f)
)
val ivCloseLayoutParams = ivClose.layoutParams as ConstraintLayout.LayoutParams
ivCloseLayoutParams.width = AutoSizeUtils.dp2px(context, 32f)
ivCloseLayoutParams.height = AutoSizeUtils.dp2px(context, 32f)
ivCloseLayoutParams.setMargins(
0,
AutoSizeUtils.dp2px(context, 24f),
AutoSizeUtils.dp2px(context, 24f),
0
)
ivClose.layoutParams = ivCloseLayoutParams
containerEventContent.requestLayout()
roundRoadV2NEventContainer.requestLayout()
}
private fun setB2PassengerScreenView() {
val layoutParam =
roundRoadV2NEventContainer.layoutParams as ConstraintLayout.LayoutParams
layoutParam.width = AutoSizeUtils.dp2px(
context, (390 + 25 + 25).toFloat()
)
layoutParam.height = ConstraintLayout.LayoutParams.WRAP_CONTENT
layoutParam.setMargins(
0,
0,
AutoSizeUtils.dp2px(context, 39f - 37f),
0
)
roundRoadV2NEventContainer.layoutParams = layoutParam
roundRoadV2NEventContainer.background = ContextCompat.getDrawable(
context,
R.drawable.hmi_v2n_event_bg_passenger
)
//乘客屏 背景图 右边带了 37px 渐变
val padding = AutoSizeUtils.dp2px(context, 37f)
roundRoadV2NEventContainer.setPadding(padding, padding, padding, padding)
val containerIconHintLayoutParams =
containerIconHint.layoutParams as ConstraintLayout.LayoutParams
containerIconHintLayoutParams.width = LayoutParams.MATCH_PARENT
containerIconHintLayoutParams.height = LayoutParams.WRAP_CONTENT
containerIconHintLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 20f - 19.4f), //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整
AutoSizeUtils.dp2px(context, 27f - 10.7f),
AutoSizeUtils.dp2px(context, 20f),
0
)
containerIconHint.layoutParams = containerIconHintLayoutParams
val ivV2XImageLayoutParams = ivV2XImage.layoutParams as RelativeLayout.LayoutParams
ivV2XImageLayoutParams.width =
AutoSizeUtils.dp2px(
context,
56f + 14f + 14f
) //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整
ivV2XImageLayoutParams.height =
AutoSizeUtils.dp2px(
context,
56f + 14f + 14f
) //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整
ivV2XImage.layoutParams = ivV2XImageLayoutParams
val tvV2XHintContentLayoutParams =
tvV2XHintContent.layoutParams as RelativeLayout.LayoutParams
tvV2XHintContentLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 21f - 19.7f), //乘客屏icon ivV2XImage带了白边, 高度、margin需要计算调整
AutoSizeUtils.dp2px(context, (28f + 14f) - (40f / 2f)),
AutoSizeUtils.dp2px(context, 5f),
0
)
tvV2XHintContent.layoutParams = tvV2XHintContentLayoutParams
tvV2XHintContent.setTextColor(Color.parseColor("#203555"))
tvV2XHintContent.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
AutoSizeUtils.dp2px(context, 28f).toFloat()
)
tvV2XHintContent.setTypeface(null, Typeface.NORMAL)
tvV2XHintContent.setPadding(0, 0, 0, AutoSizeUtils.dp2px(context, 28f))
val containerImageAndLiveVideoLayoutParams =
containerImageAndLiveVideo.layoutParams as ConstraintLayout.LayoutParams
containerImageAndLiveVideoLayoutParams.width = AutoSizeUtils.dp2px(context, 350f + 18f) //乘客屏视频加载里面背景切图包含了白边
containerImageAndLiveVideoLayoutParams.height = AutoSizeUtils.dp2px(context, 197f)
containerImageAndLiveVideoLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 20f),
AutoSizeUtils.dp2px(context, 23f - 14f), //乘客屏icon ivV2XImage带了白边
AutoSizeUtils.dp2px(context, 20f),
0
)
containerImageAndLiveVideo.layoutParams = containerImageAndLiveVideoLayoutParams
contentImageView.setRadius(16f)
val tvV2XTimeStrLayoutParams =
tvV2XTimeStr.layoutParams as ConstraintLayout.LayoutParams
tvV2XTimeStrLayoutParams.width = LayoutParams.MATCH_PARENT
tvV2XTimeStrLayoutParams.height = LayoutParams.WRAP_CONTENT
tvV2XTimeStrLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 20f),
AutoSizeUtils.dp2px(context, 16f),
AutoSizeUtils.dp2px(context, 20f),
AutoSizeUtils.dp2px(context, 26f)
)
tvV2XTimeStr.layoutParams = tvV2XTimeStrLayoutParams
tvV2XTimeStr.setTextColor(Color.parseColor("#17417B"))
tvV2XTimeStr.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
AutoSizeUtils.dp2px(context, 26f).toFloat()
)
ivClose.setImageResource(R.drawable.hmi_v2n_event_icon_close_passenger)
ivClose.setPadding(
AutoSizeUtils.dp2px(context, 2f),
AutoSizeUtils.dp2px(context, 2f),
AutoSizeUtils.dp2px(context, 2f),
AutoSizeUtils.dp2px(context, 2f)
)
val ivCloseLayoutParams = ivClose.layoutParams as ConstraintLayout.LayoutParams
ivCloseLayoutParams.width = AutoSizeUtils.dp2px(context, 32f)
ivCloseLayoutParams.height = AutoSizeUtils.dp2px(context, 32f)
ivCloseLayoutParams.setMargins(
0,
AutoSizeUtils.dp2px(context, 24f),
AutoSizeUtils.dp2px(context, 24f),
0
)
ivClose.layoutParams = ivCloseLayoutParams
// B2 乘客屏不能触摸
ivClose.visibility = View.GONE
containerEventContent.requestLayout()
roundRoadV2NEventContainer.requestLayout()
}
private fun setDriverScreenView() {
val layoutParam =
roundRoadV2NEventContainer.layoutParams as ConstraintLayout.LayoutParams
layoutParam.width = AutoSizeUtils.dp2px(context, (654 + 0 + 0).toFloat())
layoutParam.height = ConstraintLayout.LayoutParams.WRAP_CONTENT
roundRoadV2NEventContainer.layoutParams = layoutParam
roundRoadV2NEventContainer.background =
ContextCompat.getDrawable(context, R.drawable.hmi_v2n_event_bg_driver)
val padding = AutoSizeUtils.dp2px(context, 0f)
roundRoadV2NEventContainer.setPadding(padding, padding, padding, padding)
val containerIconHintLayoutParams =
containerIconHint.layoutParams as ConstraintLayout.LayoutParams
containerIconHintLayoutParams.width = LayoutParams.MATCH_PARENT
containerIconHintLayoutParams.height = LayoutParams.WRAP_CONTENT
containerIconHintLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 30f - 16f),
AutoSizeUtils.dp2px(context, 30f - 14f),
AutoSizeUtils.dp2px(context, 30f - 16f),
0
)
containerIconHint.layoutParams = containerIconHintLayoutParams
val ivV2XImageLayoutParams = ivV2XImage.layoutParams as RelativeLayout.LayoutParams
ivV2XImageLayoutParams.width = AutoSizeUtils.dp2px(context, 120f + 16f + 16f)
ivV2XImageLayoutParams.height = AutoSizeUtils.dp2px(context, 120f + 16f + 16f)
ivV2XImage.layoutParams = ivV2XImageLayoutParams
val tvV2XHintContentLayoutParams =
tvV2XHintContent.layoutParams as RelativeLayout.LayoutParams
tvV2XHintContentLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 30f - 14f),
AutoSizeUtils.dp2px(context, (60f + 16f) - (50f / 2f)),
AutoSizeUtils.dp2px(context, 5f),
0
)
tvV2XHintContent.layoutParams = tvV2XHintContentLayoutParams
tvV2XHintContent.setTextColor(Color.parseColor("#FFFFFF"))
tvV2XHintContent.setTypeface(null, Typeface.BOLD)
tvV2XHintContent.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
AutoSizeUtils.dp2px(context, 32f).toFloat()
)
val containerImageAndLiveVideoLayoutParams =
containerImageAndLiveVideo.layoutParams as ConstraintLayout.LayoutParams
containerImageAndLiveVideoLayoutParams.width = AutoSizeUtils.dp2px(context, 593f)
containerImageAndLiveVideoLayoutParams.height = AutoSizeUtils.dp2px(context, 330f)
containerImageAndLiveVideoLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 30f),
AutoSizeUtils.dp2px(context, 20f - 16f),
AutoSizeUtils.dp2px(context, 30f),
0
)
containerImageAndLiveVideo.layoutParams = containerImageAndLiveVideoLayoutParams
contentImageView.setRadius(12f)
val tvV2XTimeStrLayoutParams =
tvV2XTimeStr.layoutParams as ConstraintLayout.LayoutParams
tvV2XTimeStrLayoutParams.width = LayoutParams.MATCH_PARENT
tvV2XTimeStrLayoutParams.height = LayoutParams.WRAP_CONTENT
tvV2XTimeStrLayoutParams.setMargins(
AutoSizeUtils.dp2px(context, 30f),
AutoSizeUtils.dp2px(context, 12f),
AutoSizeUtils.dp2px(context, 30f),
AutoSizeUtils.dp2px(context, 24f)
)
tvV2XTimeStr.layoutParams = tvV2XTimeStrLayoutParams
tvV2XTimeStr.setTextColor(Color.parseColor("#999999"))
tvV2XTimeStr.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
AutoSizeUtils.dp2px(context, 26f).toFloat()
)
ivClose.setImageResource(R.drawable.hmi_v2n_event_icon_close_driver)
ivClose.setPadding(0, 0, 0, 0)
val ivCloseLayoutParams = ivClose.layoutParams as ConstraintLayout.LayoutParams
ivCloseLayoutParams.width = AutoSizeUtils.dp2px(context, 50f)
ivCloseLayoutParams.height = AutoSizeUtils.dp2px(context, 50f)
ivCloseLayoutParams.setMargins(0, 0, 0, 0)
ivClose.layoutParams = ivCloseLayoutParams
// 6.7.0 UI 没设计关闭按钮
ivClose.visibility = View.GONE
containerEventContent.requestLayout()
roundRoadV2NEventContainer.requestLayout()
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerRoadV2NEventWindowListenerManager.addListener(TAG, this)