[V2X]修正乘客端预警弹窗位置不对

This commit is contained in:
renwj
2022-07-19 10:41:41 +08:00
parent 35518052f7
commit ac534f6c57
3 changed files with 14 additions and 4 deletions

View File

@@ -48,7 +48,7 @@ public class TaxiPassengerV2XNotificationView extends IViewNotification {
// 设置View的出场位置
setSidePattern(SidePattern.LEFT);
setLayoutGravity(Gravity.LEFT);
setLayoutGravity(Gravity.LEFT | Gravity.TOP);
// 设置View的停留位置相对屏幕左上角的位置
// setOffsetX(getResources().
// getDimensionPixelSize(R.dimen.taxi_p_v2x_notification_view_margin_left));

View File

@@ -28,6 +28,7 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
import com.mogo.eagle.core.data.enums.SidePattern
import com.mogo.eagle.core.data.enums.SidePattern.*
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
@@ -140,6 +141,7 @@ import kotlin.collections.ArrayList
private var speakJob: Job? = null
private var showingV2XTip: IReminder? = null
override fun vipIdentification(visible: Boolean) {
ThreadUtils.runOnUiThread {
if (visible) {
@@ -582,7 +584,13 @@ import kotlin.collections.ArrayList
itx.isFocusable = false
itx.isClippingEnabled = false
itx.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
val transition = Slide(Gravity.TOP).also { t ->
val transition = Slide(when(content.sidePattern) {
LEFT, RESULT_LEFT-> Gravity.LEFT
RIGHT, RESULT_RIGHT -> Gravity.RIGHT
TOP, RESULT_TOP -> Gravity.TOP
BOTTOM, RESULT_BOTTOM -> Gravity.BOTTOM
else -> Gravity.TOP
}).also { t ->
t.interpolator = AccelerateDecelerateInterpolator()
t.duration = 200
}
@@ -594,7 +602,7 @@ import kotlin.collections.ArrayList
override fun show() {
val parent = it.window.decorView
parent.doOnAttach {
popupWindow.showAtLocation(parent, Gravity.TOP, 0, 0)
popupWindow.showAtLocation(parent, content.layoutGravity, 0, 0)
}
}
@@ -624,6 +632,7 @@ import kotlin.collections.ArrayList
if (reminder == null) {
return
}
showingV2XTip = reminder
lifecycleScope.launch {
delay(expireTime)
reminder?.hide()
@@ -662,6 +671,7 @@ import kotlin.collections.ArrayList
activity?.let {
WarningFloat.dismiss(tag)
}
showingV2XTip?.takeIf { it.isShowing() }?.also { it.hide() }
}
/**

View File

@@ -30,7 +30,7 @@ class V2XNotificationView @JvmOverloads constructor(
LayoutInflater.from(context).inflate(R.layout.notification_v2x_msg_vr, this, true)
// 设置View的出场位置
sidePattern = SidePattern.RESULT_TOP
layoutGravity = Gravity.CENTER_HORIZONTAL
layoutGravity = Gravity.CENTER_HORIZONTAL or Gravity.TOP
// 设置View的停留位置
setPadding(0, 110, 0, 0)
}