[650] refactor: 调整司机屏下通用事件弹框 UI;
fix: layout 中margin 使用代码动态设置不能生效问题;
This commit is contained in:
@@ -6,6 +6,7 @@ import android.util.AttributeSet
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
@@ -17,7 +18,8 @@ import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.containerEvent
|
||||
import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.containerEventContent
|
||||
import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.containerIconHint
|
||||
import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.containerLivePlay
|
||||
import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.ivClose
|
||||
import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.ivV2XImage
|
||||
@@ -54,7 +56,7 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
|
||||
val layoutParam =
|
||||
roundRoadV2NEventContainer.layoutParams as ConstraintLayout.LayoutParams
|
||||
layoutParam.width = AutoSizeUtils.dp2px(
|
||||
context, (600 + 37 + 37).toFloat()
|
||||
context, (580 + 37 + 37).toFloat()
|
||||
)
|
||||
layoutParam.height = ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||
roundRoadV2NEventContainer.layoutParams = layoutParam
|
||||
@@ -66,7 +68,7 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
|
||||
roundRoadV2NEventContainer.setPadding(padding, padding, padding, padding)
|
||||
|
||||
val containerEventLayoutParams =
|
||||
containerEvent.layoutParams as ConstraintLayout.LayoutParams
|
||||
containerIconHint.layoutParams as ConstraintLayout.LayoutParams
|
||||
containerEventLayoutParams.width = LayoutParams.MATCH_PARENT
|
||||
containerEventLayoutParams.height = LayoutParams.WRAP_CONTENT
|
||||
containerEventLayoutParams.setMargins(
|
||||
@@ -75,17 +77,15 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
|
||||
AutoSizeUtils.dp2px(context, 50f),
|
||||
0
|
||||
)
|
||||
containerEvent.layoutParams = containerEventLayoutParams
|
||||
containerIconHint.layoutParams = containerEventLayoutParams
|
||||
|
||||
val ivV2XImageLayoutParams = ivV2XImage.layoutParams as ConstraintLayout.LayoutParams
|
||||
val ivV2XImageLayoutParams = ivV2XImage.layoutParams as RelativeLayout.LayoutParams
|
||||
ivV2XImageLayoutParams.width = AutoSizeUtils.dp2px(context, 69f)
|
||||
ivV2XImageLayoutParams.height = AutoSizeUtils.dp2px(context, 69f)
|
||||
ivV2XImage.layoutParams = ivV2XImageLayoutParams
|
||||
|
||||
val tvV2XHintContentLayoutParams =
|
||||
tvV2XHintContent.layoutParams as ConstraintLayout.LayoutParams
|
||||
tvV2XHintContentLayoutParams.width = 0
|
||||
tvV2XHintContentLayoutParams.height = LayoutParams.WRAP_CONTENT
|
||||
tvV2XHintContent.layoutParams as RelativeLayout.LayoutParams
|
||||
tvV2XHintContentLayoutParams.setMargins(
|
||||
AutoSizeUtils.dp2px(context, 30f), 0, 0, 0
|
||||
)
|
||||
@@ -121,6 +121,13 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
|
||||
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)
|
||||
@@ -130,14 +137,8 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
|
||||
AutoSizeUtils.dp2px(context, 20f), 0
|
||||
)
|
||||
ivClose.layoutParams = ivCloseLayoutParams
|
||||
ivClose.setPadding(
|
||||
AutoSizeUtils.dp2px(context, 2f),
|
||||
AutoSizeUtils.dp2px(context, 2f),
|
||||
AutoSizeUtils.dp2px(context, 2f),
|
||||
AutoSizeUtils.dp2px(context, 2f)
|
||||
)
|
||||
ivClose.setImageResource(R.drawable.hmi_v2n_event_icon_close_passenger)
|
||||
|
||||
containerEventContent.requestLayout()
|
||||
roundRoadV2NEventContainer.requestLayout()
|
||||
} else {
|
||||
val layoutParam =
|
||||
@@ -146,12 +147,12 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
|
||||
layoutParam.height = ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||
roundRoadV2NEventContainer.layoutParams = layoutParam
|
||||
roundRoadV2NEventContainer.background =
|
||||
ContextCompat.getDrawable(context, R.drawable.bg_v2n_event_driver)
|
||||
ContextCompat.getDrawable(context, R.drawable.hmi_v2n_event_bg_driver)
|
||||
val padding = AutoSizeUtils.dp2px(context, 0f)
|
||||
roundRoadV2NEventContainer.setPadding(padding, padding, padding, padding)
|
||||
|
||||
val containerEventLayoutParams =
|
||||
containerEvent.layoutParams as ConstraintLayout.LayoutParams
|
||||
containerIconHint.layoutParams as ConstraintLayout.LayoutParams
|
||||
containerEventLayoutParams.width = LayoutParams.MATCH_PARENT
|
||||
containerEventLayoutParams.height = LayoutParams.WRAP_CONTENT
|
||||
containerEventLayoutParams.setMargins(
|
||||
@@ -160,17 +161,15 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
|
||||
AutoSizeUtils.dp2px(context, 30f),
|
||||
0
|
||||
)
|
||||
containerEvent.layoutParams = containerEventLayoutParams
|
||||
containerIconHint.layoutParams = containerEventLayoutParams
|
||||
|
||||
val ivV2XImageLayoutParams = ivV2XImage.layoutParams as ConstraintLayout.LayoutParams
|
||||
val ivV2XImageLayoutParams = ivV2XImage.layoutParams as RelativeLayout.LayoutParams
|
||||
ivV2XImageLayoutParams.width = AutoSizeUtils.dp2px(context, 84f)
|
||||
ivV2XImageLayoutParams.height = AutoSizeUtils.dp2px(context, 84f)
|
||||
ivV2XImage.layoutParams = ivV2XImageLayoutParams
|
||||
|
||||
val tvV2XHintContentLayoutParams =
|
||||
tvV2XHintContent.layoutParams as ConstraintLayout.LayoutParams
|
||||
tvV2XHintContentLayoutParams.width = 0
|
||||
tvV2XHintContentLayoutParams.height = LayoutParams.WRAP_CONTENT
|
||||
tvV2XHintContent.layoutParams as RelativeLayout.LayoutParams
|
||||
tvV2XHintContentLayoutParams.setMargins(
|
||||
AutoSizeUtils.dp2px(context, 32f),
|
||||
0,
|
||||
@@ -209,14 +208,15 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
|
||||
AutoSizeUtils.dp2px(context, 22f).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
|
||||
ivClose.setPadding(0, 0, 0, 0)
|
||||
ivClose.setImageResource(R.drawable.hmi_v2n_event_icon_close_driver)
|
||||
|
||||
containerEventContent.requestLayout()
|
||||
roundRoadV2NEventContainer.requestLayout()
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 282 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -9,6 +9,7 @@
|
||||
android:padding="@dimen/dp_37">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/containerEventContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -16,13 +17,13 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/containerEvent"
|
||||
<RelativeLayout
|
||||
android:id="@+id/containerIconHint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_50"
|
||||
android:layout_marginLeft="@dimen/dp_50"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
android:layout_marginEnd="@dimen/dp_50"
|
||||
android:layout_marginRight="@dimen/dp_50"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
@@ -31,36 +32,25 @@
|
||||
android:id="@+id/ivV2XImage"
|
||||
android:layout_width="@dimen/dp_69"
|
||||
android:layout_height="@dimen/dp_69"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/tvV2XHintContent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
tools:src="@drawable/v2x_icon_shigong_zhandao" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvV2XHintContent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_30"
|
||||
android:layout_toRightOf="@+id/ivV2XImage"
|
||||
android:ellipsize="end"
|
||||
android:gravity="start"
|
||||
android:layout_centerVertical="true"
|
||||
android:maxLines="2"
|
||||
android:textColor="#131415"
|
||||
android:textSize="@dimen/dp_32"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivV2XImage"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_default="wrap"
|
||||
app:layout_goneMarginStart="0dp"
|
||||
tools:text="前方150米 道路施工 前方150米 道路施工 前方150米 道路施工" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.v2n.RoadV2NEventLivePlayView
|
||||
android:id="@+id/containerLivePlay"
|
||||
@@ -72,15 +62,15 @@
|
||||
android:visibility="visible"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/containerEvent" />
|
||||
app:layout_constraintTop_toBottomOf="@id/containerIconHint" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvV2XTimeStr"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_51"
|
||||
android:layout_marginLeft="@dimen/dp_51"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_51"
|
||||
android:layout_marginRight="@dimen/dp_51"
|
||||
android:layout_marginBottom="@dimen/dp_33"
|
||||
android:ellipsize="end"
|
||||
android:gravity="start"
|
||||
@@ -98,7 +88,7 @@
|
||||
android:layout_width="@dimen/dp_32"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:layout_marginRight="@dimen/dp_20"
|
||||
android:padding="@dimen/dp_2"
|
||||
android:src="@drawable/hmi_v2n_event_icon_close_passenger"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
|
||||
Reference in New Issue
Block a user