[650]feat: 增加司机屏 通用事件弹框样式及 UI;
This commit is contained in:
@@ -349,6 +349,16 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.v2n.RoadV2NEventWindowView
|
||||
android:id="@+id/roadV2NEventWindowView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_32"
|
||||
android:layout_marginBottom="@dimen/dp_30"
|
||||
app:layout_constraintBottom_toTopOf="@+id/smallMapView"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<com.mogo.och.common.module.wigets.LoadingMapStatusView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
@@ -198,8 +198,8 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.v2n.PassengerV2NEventView
|
||||
android:id="@+id/passengerV2NEventView"
|
||||
<com.mogo.eagle.core.function.hmi.ui.v2n.RoadV2NEventWindowView
|
||||
android:id="@+id/roadV2NEventWindowView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.v2n
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.v2x.RoadV2NEventWindowBean
|
||||
import com.mogo.eagle.core.function.api.hmi.v2n.IRoadV2NEventWindowListener
|
||||
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
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.hmi_view_passenger_v2n_event.view.containerLivePlay
|
||||
import kotlinx.android.synthetic.main.hmi_view_passenger_v2n_event.view.ivClose
|
||||
import kotlinx.android.synthetic.main.hmi_view_passenger_v2n_event.view.ivPassengerV2XImage
|
||||
import kotlinx.android.synthetic.main.hmi_view_passenger_v2n_event.view.roundRoadV2NEventContainer
|
||||
import kotlinx.android.synthetic.main.hmi_view_passenger_v2n_event.view.tvPassengerV2XContent
|
||||
import kotlinx.android.synthetic.main.hmi_view_passenger_v2n_event.view.tvPassengerV2XTime
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
/**
|
||||
* V2N通用事件弹框
|
||||
*/
|
||||
class PassengerV2NEventView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IRoadV2NEventWindowListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "PassengerV2NEventView"
|
||||
}
|
||||
|
||||
private val isPassengerScreen by lazy {
|
||||
AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
|
||||
}
|
||||
|
||||
private var currentEventUUID: String = ""
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_view_passenger_v2n_event, this, true)
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
if (isPassengerScreen) {
|
||||
val layoutParam = ConstraintLayout.LayoutParams(
|
||||
AutoSizeUtils.dp2px(
|
||||
context, (600 + 37 + 37).toFloat()
|
||||
),
|
||||
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
roundRoadV2NEventContainer.layoutParams = layoutParam
|
||||
roundRoadV2NEventContainer.background = ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.hmi_v2n_event_bg_passenger
|
||||
)
|
||||
val padding = AutoSizeUtils.dp2px(context, 37f)
|
||||
roundRoadV2NEventContainer.setPadding(padding, padding, padding, padding)
|
||||
} else {
|
||||
val layoutParam = ConstraintLayout.LayoutParams(
|
||||
AutoSizeUtils.dp2px(
|
||||
context, (600 + 0 + 0).toFloat()
|
||||
),
|
||||
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
roundRoadV2NEventContainer.layoutParams = layoutParam
|
||||
roundRoadV2NEventContainer.background =
|
||||
ContextCompat.getDrawable(context, R.drawable.bg_v2n_event_driver)
|
||||
val padding = AutoSizeUtils.dp2px(context, 0f)
|
||||
roundRoadV2NEventContainer.setPadding(padding, padding, padding, padding)
|
||||
}
|
||||
|
||||
ivClose.setOnClickListener {
|
||||
visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerRoadV2NEventWindowListenerManager.addListener(TAG, this)
|
||||
|
||||
//TODO
|
||||
val eventId = CallerRoadV2NEventWindowListenerManager.show(
|
||||
System.currentTimeMillis(),
|
||||
R.drawable.v2x_icon_shigong_zhandao,
|
||||
"前方 200米 道路积水",
|
||||
true,
|
||||
"172.168.1.20",
|
||||
0.0,
|
||||
0.0
|
||||
)
|
||||
UiThreadHandler.postDelayed({
|
||||
CallerRoadV2NEventWindowListenerManager.dismiss(eventId)
|
||||
|
||||
val eventId1 = CallerRoadV2NEventWindowListenerManager.show(
|
||||
System.currentTimeMillis(),
|
||||
R.drawable.v2x_icon_jiaotongshigu_vr,
|
||||
"前方 300米 发生交通事故",
|
||||
true,
|
||||
"172.168.1.20",
|
||||
0.0,
|
||||
0.0
|
||||
)
|
||||
}, 20 * 1000L)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerRoadV2NEventWindowListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun show(dataBean: RoadV2NEventWindowBean) {
|
||||
currentEventUUID = dataBean.uuid
|
||||
ivPassengerV2XImage.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
dataBean.iconResId
|
||||
)
|
||||
)
|
||||
tvPassengerV2XContent.text = dataBean.hintStr
|
||||
tvPassengerV2XTime.text =
|
||||
"更新时间:${DateTimeUtils.getTimeText(dataBean.timestamp, DateTimeUtils.HH_mm_ss)}"
|
||||
if (dataBean.isNeedTTS) {
|
||||
AIAssist.getInstance(context)
|
||||
.speakTTSVoiceWithLevel(dataBean.hintStr, AIAssist.LEVEL0)
|
||||
}
|
||||
containerLivePlay.startRoadCameraLive(
|
||||
dataBean.cameraIp,
|
||||
dataBean.lon, dataBean.lat
|
||||
)
|
||||
visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun dismiss(eventId: String) {
|
||||
if (eventId == currentEventUUID) {
|
||||
visibility = View.GONE
|
||||
currentEventUUID = ""
|
||||
containerLivePlay.stopRoadCameraLive()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,10 @@ import kotlinx.android.synthetic.main.hmi_view_v2n_event_live_play.view.ivLoadin
|
||||
import kotlinx.android.synthetic.main.hmi_view_v2n_event_live_play.view.ivTipLogo
|
||||
import kotlinx.android.synthetic.main.hmi_view_v2n_event_live_play.view.svpPlayer
|
||||
import kotlinx.android.synthetic.main.hmi_view_v2n_event_live_play.view.tvTipContent
|
||||
import kotlinx.android.synthetic.main.hmi_view_v2n_event_live_play.view.v2nEventLivePlayContainer
|
||||
import tv.danmaku.ijk.media.player.IjkMediaPlayer
|
||||
|
||||
class V2NEventLivePlayView @JvmOverloads constructor(
|
||||
class RoadV2NEventLivePlayView @JvmOverloads constructor(
|
||||
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
@@ -93,6 +94,20 @@ class V2NEventLivePlayView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (isPassengerScreen) {
|
||||
v2nEventLivePlayContainer.background = ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.bg_v2n_event_live_play_passenger
|
||||
)
|
||||
ivTipLogo.setImageResource(R.drawable.hmi_v2n_event_mogo_logo_passenger)
|
||||
} else {
|
||||
v2nEventLivePlayContainer.background = ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.bg_v2n_event_live_play_driver
|
||||
)
|
||||
ivTipLogo.setImageResource(R.drawable.hmi_v2n_event_mogo_logo_driver)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +134,8 @@ class V2NEventLivePlayView @JvmOverloads constructor(
|
||||
showPlayFail()
|
||||
|
||||
//TODO
|
||||
startPlay("https://video.zhidaozhixing.com/hy/LI_008_070.flv?txSecret=28ece9ad0bd67d06a7d391ed42264a99&txTime=66922502")
|
||||
//startPlay("https://video.zhidaozhixing.com/hy/LI_008_070.flv?txSecret=28ece9ad0bd67d06a7d391ed42264a99&txTime=66922502")
|
||||
startPlay("https://video.zhidaozhixing.com/hy/LI_007_040.flv?txSecret=3586b5516f8d65b9110ab6c3f8e76b98&txTime=669B5E8D")
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,291 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.v2n
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.util.AttributeSet
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.v2x.RoadV2NEventWindowBean
|
||||
import com.mogo.eagle.core.function.api.hmi.v2n.IRoadV2NEventWindowListener
|
||||
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
|
||||
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.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
|
||||
import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.roundRoadV2NEventContainer
|
||||
import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.tvV2XHintContent
|
||||
import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.tvV2XTimeStr
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
/**
|
||||
* 路侧V2N事件通用弹框
|
||||
*/
|
||||
class RoadV2NEventWindowView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IRoadV2NEventWindowListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "RoadV2NEventWindowView"
|
||||
}
|
||||
|
||||
private val isPassengerScreen by lazy {
|
||||
AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
|
||||
}
|
||||
|
||||
private var currentEventUUID: String = ""
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_view_road_v2n_event_window, this, true)
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
if (isPassengerScreen) {
|
||||
val layoutParam =
|
||||
roundRoadV2NEventContainer.layoutParams as ConstraintLayout.LayoutParams
|
||||
layoutParam.width = AutoSizeUtils.dp2px(
|
||||
context, (600 + 37 + 37).toFloat()
|
||||
)
|
||||
layoutParam.height = ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||
roundRoadV2NEventContainer.layoutParams = layoutParam
|
||||
roundRoadV2NEventContainer.background = ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.hmi_v2n_event_bg_passenger
|
||||
)
|
||||
val padding = AutoSizeUtils.dp2px(context, 37f)
|
||||
roundRoadV2NEventContainer.setPadding(padding, padding, padding, padding)
|
||||
|
||||
val containerEventLayoutParams =
|
||||
containerEvent.layoutParams as ConstraintLayout.LayoutParams
|
||||
containerEventLayoutParams.width = LayoutParams.MATCH_PARENT
|
||||
containerEventLayoutParams.height = LayoutParams.WRAP_CONTENT
|
||||
containerEventLayoutParams.setMargins(
|
||||
AutoSizeUtils.dp2px(context, 50f),
|
||||
AutoSizeUtils.dp2px(context, 40f),
|
||||
AutoSizeUtils.dp2px(context, 50f),
|
||||
0
|
||||
)
|
||||
containerEvent.layoutParams = containerEventLayoutParams
|
||||
|
||||
val ivV2XImageLayoutParams = ivV2XImage.layoutParams as ConstraintLayout.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
|
||||
tvV2XHintContentLayoutParams.setMargins(
|
||||
AutoSizeUtils.dp2px(context, 30f), 0, 0, 0
|
||||
)
|
||||
tvV2XHintContent.layoutParams = tvV2XHintContentLayoutParams
|
||||
tvV2XHintContent.setTextColor(Color.parseColor("#131415"))
|
||||
|
||||
val containerLivePlayLayoutParams =
|
||||
containerLivePlay.layoutParams as ConstraintLayout.LayoutParams
|
||||
containerLivePlayLayoutParams.width = AutoSizeUtils.dp2px(context, 498f)
|
||||
containerLivePlayLayoutParams.height = AutoSizeUtils.dp2px(context, 298f)
|
||||
containerLivePlayLayoutParams.setMargins(
|
||||
AutoSizeUtils.dp2px(context, 51f),
|
||||
AutoSizeUtils.dp2px(context, 30f),
|
||||
AutoSizeUtils.dp2px(context, 51f),
|
||||
0
|
||||
)
|
||||
containerLivePlay.layoutParams = containerLivePlayLayoutParams
|
||||
|
||||
val tvV2XTimeStrLayoutParams =
|
||||
tvV2XTimeStr.layoutParams as ConstraintLayout.LayoutParams
|
||||
tvV2XTimeStrLayoutParams.width = LayoutParams.MATCH_PARENT
|
||||
tvV2XTimeStrLayoutParams.height = LayoutParams.WRAP_CONTENT
|
||||
tvV2XTimeStrLayoutParams.setMargins(
|
||||
AutoSizeUtils.dp2px(context, 51f),
|
||||
AutoSizeUtils.dp2px(context, 20f),
|
||||
AutoSizeUtils.dp2px(context, 51f),
|
||||
AutoSizeUtils.dp2px(context, 33f)
|
||||
)
|
||||
tvV2XTimeStr.layoutParams = tvV2XTimeStrLayoutParams
|
||||
tvV2XTimeStr.setTextColor(Color.parseColor("#131415"))
|
||||
tvV2XTimeStr.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_PX,
|
||||
AutoSizeUtils.dp2px(context, 24f).toFloat()
|
||||
)
|
||||
|
||||
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, 20f),
|
||||
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)
|
||||
|
||||
roundRoadV2NEventContainer.requestLayout()
|
||||
} else {
|
||||
val layoutParam =
|
||||
roundRoadV2NEventContainer.layoutParams as ConstraintLayout.LayoutParams
|
||||
layoutParam.width = AutoSizeUtils.dp2px(context, (600 + 0 + 0).toFloat())
|
||||
layoutParam.height = ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||
roundRoadV2NEventContainer.layoutParams = layoutParam
|
||||
roundRoadV2NEventContainer.background =
|
||||
ContextCompat.getDrawable(context, R.drawable.bg_v2n_event_driver)
|
||||
val padding = AutoSizeUtils.dp2px(context, 0f)
|
||||
roundRoadV2NEventContainer.setPadding(padding, padding, padding, padding)
|
||||
|
||||
val containerEventLayoutParams =
|
||||
containerEvent.layoutParams as ConstraintLayout.LayoutParams
|
||||
containerEventLayoutParams.width = LayoutParams.MATCH_PARENT
|
||||
containerEventLayoutParams.height = LayoutParams.WRAP_CONTENT
|
||||
containerEventLayoutParams.setMargins(
|
||||
AutoSizeUtils.dp2px(context, 30f),
|
||||
AutoSizeUtils.dp2px(context, 31f),
|
||||
AutoSizeUtils.dp2px(context, 30f),
|
||||
0
|
||||
)
|
||||
containerEvent.layoutParams = containerEventLayoutParams
|
||||
|
||||
val ivV2XImageLayoutParams = ivV2XImage.layoutParams as ConstraintLayout.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
|
||||
tvV2XHintContentLayoutParams.setMargins(
|
||||
AutoSizeUtils.dp2px(context, 32f),
|
||||
0,
|
||||
0,
|
||||
0
|
||||
)
|
||||
tvV2XHintContent.layoutParams = tvV2XHintContentLayoutParams
|
||||
tvV2XHintContent.setTextColor(Color.parseColor("#FFFFFF"))
|
||||
|
||||
val containerLivePlayLayoutParams =
|
||||
containerLivePlay.layoutParams as ConstraintLayout.LayoutParams
|
||||
containerLivePlayLayoutParams.width = AutoSizeUtils.dp2px(context, 540f)
|
||||
containerLivePlayLayoutParams.height = AutoSizeUtils.dp2px(context, 300f)
|
||||
containerLivePlayLayoutParams.setMargins(
|
||||
AutoSizeUtils.dp2px(context, 30f),
|
||||
AutoSizeUtils.dp2px(context, 30f),
|
||||
AutoSizeUtils.dp2px(context, 30f),
|
||||
0
|
||||
)
|
||||
containerLivePlay.layoutParams = containerLivePlayLayoutParams
|
||||
|
||||
val tvV2XTimeStrLayoutParams =
|
||||
tvV2XTimeStr.layoutParams as ConstraintLayout.LayoutParams
|
||||
tvV2XTimeStrLayoutParams.width = LayoutParams.MATCH_PARENT
|
||||
tvV2XTimeStrLayoutParams.height = LayoutParams.WRAP_CONTENT
|
||||
tvV2XTimeStrLayoutParams.setMargins(
|
||||
AutoSizeUtils.dp2px(context, 29f),
|
||||
AutoSizeUtils.dp2px(context, 25f),
|
||||
AutoSizeUtils.dp2px(context, 29f),
|
||||
AutoSizeUtils.dp2px(context, 30f)
|
||||
)
|
||||
tvV2XTimeStr.layoutParams = tvV2XTimeStrLayoutParams
|
||||
tvV2XTimeStr.setTextColor(Color.parseColor("#66FFFFFF"))
|
||||
tvV2XTimeStr.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_PX,
|
||||
AutoSizeUtils.dp2px(context, 22f).toFloat()
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
roundRoadV2NEventContainer.requestLayout()
|
||||
}
|
||||
|
||||
ivClose.setOnClickListener {
|
||||
visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerRoadV2NEventWindowListenerManager.addListener(TAG, this)
|
||||
initView()
|
||||
//TODO
|
||||
val eventId = CallerRoadV2NEventWindowListenerManager.show(
|
||||
System.currentTimeMillis(),
|
||||
R.drawable.v2x_icon_shigong_zhandao,
|
||||
"前方 200米 道路积水",
|
||||
true,
|
||||
"172.168.1.20",
|
||||
0.0,
|
||||
0.0
|
||||
)
|
||||
UiThreadHandler.postDelayed({
|
||||
CallerRoadV2NEventWindowListenerManager.dismiss(eventId)
|
||||
|
||||
val eventId1 = CallerRoadV2NEventWindowListenerManager.show(
|
||||
System.currentTimeMillis(),
|
||||
R.drawable.v2x_icon_jiaotongshigu_vr,
|
||||
"前方 300米 发生交通事故",
|
||||
true,
|
||||
"172.168.1.20",
|
||||
0.0,
|
||||
0.0
|
||||
)
|
||||
}, 20 * 1000L)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerRoadV2NEventWindowListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun show(dataBean: RoadV2NEventWindowBean) {
|
||||
currentEventUUID = dataBean.uuid
|
||||
ivV2XImage.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
dataBean.iconResId
|
||||
)
|
||||
)
|
||||
tvV2XHintContent.text = dataBean.hintStr
|
||||
tvV2XTimeStr.text =
|
||||
"更新时间:${DateTimeUtils.getTimeText(dataBean.timestamp, DateTimeUtils.HH_mm_ss)}"
|
||||
if (dataBean.isNeedTTS) {
|
||||
AIAssist.getInstance(context)
|
||||
.speakTTSVoiceWithLevel(dataBean.hintStr, AIAssist.LEVEL0)
|
||||
}
|
||||
containerLivePlay.startRoadCameraLive(
|
||||
dataBean.cameraIp,
|
||||
dataBean.lon, dataBean.lat
|
||||
)
|
||||
visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun dismiss(eventId: String) {
|
||||
if (eventId == currentEventUUID) {
|
||||
visibility = View.GONE
|
||||
currentEventUUID = ""
|
||||
containerLivePlay.stopRoadCameraLive()
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
@@ -2,9 +2,9 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="45"
|
||||
android:endColor="#080C15"
|
||||
android:startColor="#16316C"
|
||||
android:angle="270"
|
||||
android:endColor="#B3080C15"
|
||||
android:startColor="#B316316C"
|
||||
android:type="linear" />
|
||||
<corners android:radius="@dimen/dp_20" />
|
||||
</shape>
|
||||
@@ -2,4 +2,5 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#252B3F" />
|
||||
<corners android:radius="@dimen/dp_12" />
|
||||
</shape>
|
||||
@@ -2,4 +2,5 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#B2BED9" />
|
||||
<corners android:radius="@dimen/dp_36" />
|
||||
</shape>
|
||||
@@ -28,19 +28,19 @@
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivPassengerV2XImage"
|
||||
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/tvPassengerV2XContent"
|
||||
app:layout_constraintRight_toLeftOf="@id/tvV2XHintContent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@drawable/v2x_icon_shigong_zhandao" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvPassengerV2XContent"
|
||||
android:id="@+id/tvV2XHintContent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_30"
|
||||
@@ -53,7 +53,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivPassengerV2XImage"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivV2XImage"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_default="wrap"
|
||||
@@ -62,12 +62,12 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.v2n.V2NEventLivePlayView
|
||||
<com.mogo.eagle.core.function.hmi.ui.v2n.RoadV2NEventLivePlayView
|
||||
android:id="@+id/containerLivePlay"
|
||||
android:layout_width="@dimen/dp_498"
|
||||
android:layout_height="@dimen/dp_298"
|
||||
android:layout_marginStart="@dimen/dp_51"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:layout_marginEnd="@dimen/dp_51"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
@@ -75,7 +75,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/containerEvent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvPassengerV2XTime"
|
||||
android:id="@+id/tvV2XTimeStr"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_51"
|
||||
@@ -87,7 +87,6 @@
|
||||
android:maxLines="1"
|
||||
android:textColor="#131415"
|
||||
android:textSize="@dimen/dp_24"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
@@ -2,10 +2,10 @@
|
||||
<com.mogo.eagle.core.widget.RoundConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/v2nEventLivePlayContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_v2n_event_live_play_passenger"
|
||||
app:roundLayoutRadius="@dimen/dp_36">
|
||||
android:background="@drawable/bg_v2n_event_live_play_passenger">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTipContent"
|
||||
|
||||
Reference in New Issue
Block a user