[650]feat: 路侧事件弹框,增加caller 调用方式;
This commit is contained in:
@@ -3,12 +3,19 @@ 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.road.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 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.tvPassengerV2XContent
|
||||
import kotlinx.android.synthetic.main.hmi_view_passenger_v2n_event.view.tvPassengerV2XTime
|
||||
@@ -20,7 +27,7 @@ class PassengerV2NEventView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IRoadV2NEventWindowListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "PassengerV2NEventView"
|
||||
@@ -30,6 +37,8 @@ class PassengerV2NEventView @JvmOverloads constructor(
|
||||
AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
|
||||
}
|
||||
|
||||
private var currentEventUUID: String = ""
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_view_passenger_v2n_event, this, true)
|
||||
initView()
|
||||
@@ -42,25 +51,48 @@ class PassengerV2NEventView @JvmOverloads constructor(
|
||||
)
|
||||
else ContextCompat.getDrawable(context, R.drawable.bg_v2n_event_driver)
|
||||
|
||||
//TODO
|
||||
ivPassengerV2XImage.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.v2x_icon_shigong_zhandao
|
||||
)
|
||||
)
|
||||
tvPassengerV2XContent.text = "前方150米 道路施工 前方150米 道路施工 前方150米 道路施工"
|
||||
tvPassengerV2XTime.text = "更新时间:10:38:20"
|
||||
containerLivePlay.startPlay("https://video.zhidaozhixing.com/hy/LI_008_070.flv?txSecret=28ece9ad0bd67d06a7d391ed42264a99&txTime=66922502")
|
||||
ivClose.setOnClickListener {
|
||||
visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
//CallerMsgBoxEventListenerManager.addListener(TAG,this)
|
||||
CallerRoadV2NEventWindowListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
//CallerMsgBoxEventListenerManager.removeListener(TAG)
|
||||
CallerRoadV2NEventWindowListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun show(dataBean: RoadV2NEventWindowBean) {
|
||||
currentEventUUID = dataBean.uuid
|
||||
|
||||
//TODO
|
||||
ivPassengerV2XImage.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
dataBean.iconResId
|
||||
)
|
||||
)
|
||||
tvPassengerV2XContent.text = dataBean.hintStr
|
||||
tvPassengerV2XTime.text =
|
||||
"更新时间:${DateTimeUtils.getTimeText(dataBean.timestamp, DateTimeUtils.HH_mm_ss)}"
|
||||
containerLivePlay.startPlay("https://video.zhidaozhixing.com/hy/LI_008_070.flv?txSecret=28ece9ad0bd67d06a7d391ed42264a99&txTime=66922502")
|
||||
if (dataBean.isNeedTTS) {
|
||||
AIAssist.getInstance(context)
|
||||
.speakTTSVoiceWithLevel(dataBean.hintStr, AIAssist.LEVEL0)
|
||||
}
|
||||
visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun dismiss(eventId: String) {
|
||||
if (eventId == currentEventUUID) {
|
||||
visibility = View.GONE
|
||||
currentEventUUID = ""
|
||||
//TODO
|
||||
//停止播放
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,5 +186,13 @@ class V2NEventLivePlayView @JvmOverloads constructor(
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
stopLoading()
|
||||
try {
|
||||
svpPlayer?.gsyVideoManager?.stop()
|
||||
} catch (e: Exception) {
|
||||
CallerLogger.w(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"onDetachedFromWindow, e=${e.message}"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 689 B |
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/dp_600"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_v2n_event_driver">
|
||||
android:background="@drawable/hmi_v2n_event_bg_passenger">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/containerEvent"
|
||||
@@ -83,4 +83,14 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/containerLivePlay"
|
||||
tools:text="更新时间:10:38:20" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivClose"
|
||||
android:layout_width="@dimen/dp_32"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_marginEnd="@dimen/dp_2"
|
||||
android:padding="@dimen/dp_2"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</com.mogo.eagle.core.widget.RoundConstraintLayout>
|
||||
Reference in New Issue
Block a user