[650]feat: 增加通用事件弹框;

This commit is contained in:
aibingbing
2024-06-14 19:51:40 +08:00
parent 46c27a969b
commit 7bd544f387
8 changed files with 290 additions and 0 deletions

View File

@@ -197,6 +197,15 @@
android:layout_marginEnd="@dimen/dp_60"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<com.mogo.eagle.core.function.hmi.ui.v2n.PassengerV2NEventView
android:id="@+id/passengerV2NEventView"
android:layout_width="@dimen/dp_600"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_52"
app:layout_constraintBottom_toTopOf="@+id/aciv_xiaozhi_normal"
app:layout_constraintRight_toRightOf="parent"
android:visibility="gone"/>
<!--气泡态消息盒子-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxBubbleView

View File

@@ -0,0 +1,50 @@
package com.mogo.eagle.core.function.hmi.ui.v2n
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.hmi_view_passenger_v2n_event.view.ivPassengerV2XImage
import kotlinx.android.synthetic.main.hmi_view_passenger_v2n_event.view.tvPassengerV2XContent
/**
* V2N通用事件弹框乘客屏
*/
class PassengerV2NEventView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
companion object {
const val TAG = "PassengerV2NEventView"
}
init {
LayoutInflater.from(context).inflate(R.layout.hmi_view_passenger_v2n_event, this, true)
initView()
}
private fun initView() {
//TODO
ivPassengerV2XImage.setImageDrawable(
ContextCompat.getDrawable(
context,
R.drawable.v2x_icon_shigong_zhandao
)
)
tvPassengerV2XContent.text = "前方150米 道路施工"
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
//CallerMsgBoxEventListenerManager.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
//CallerMsgBoxEventListenerManager.removeListener(TAG)
}
}

View File

@@ -0,0 +1,85 @@
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 com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
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
class V2NEventLivePlayView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
companion object {
const val TAG = "V2NEventLivePlayView"
}
private val gsyVideoOptionBuilder by lazy {
GSYVideoOptionBuilder()
}
init {
LayoutInflater.from(context).inflate(R.layout.hmi_view_v2n_event_live_play, this, true)
initView()
}
private fun initView() {
showLoading()
//TODO
UiThreadHandler.postDelayed({
showLivePlay("https://video.zhidaozhixing.com/hy/LI_008_070.flv?txSecret=28ece9ad0bd67d06a7d391ed42264a99&txTime=66922502")
}, 2000L)
}
/**
* 展示加载中
*/
fun showLoading() {
tvTipContent.visibility = View.GONE
ivTipLogo.visibility = View.VISIBLE
svpPlayer.visibility = View.GONE
}
/**
* 展示请求视频流地址失败
*/
fun showLoadFail() {
tvTipContent.visibility = View.VISIBLE
ivTipLogo.visibility = View.GONE
svpPlayer.visibility = View.GONE
}
/**
* 开始视频流播放
*/
fun showLivePlay(flvUrl: String) {
gsyVideoOptionBuilder.setUrl(flvUrl)
.setCacheWithPlay(false)
.setAutoFullWithSize(false)
.setIsTouchWigetFull(false)
.setIsTouchWiget(false)
.setPlayTag(TAG).build(svpPlayer)
svpPlayer.startButton.performClick()
tvTipContent.visibility = View.GONE
ivTipLogo.visibility = View.GONE
svpPlayer.visibility = View.VISIBLE
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="146"
android:endColor="#DDE6F5"
android:startColor="#E9F1FF"
android:type="linear" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#252B3F" />
</shape>

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="@dimen/dp_600"
android:layout_height="wrap_content"
android:background="@drawable/bg_passenger_v2n_event"
app:roundLayoutRadius="@dimen/dp_36">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/containerEvent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_50"
android:layout_marginTop="@dimen/dp_40"
android:layout_marginEnd="@dimen/dp_50"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/ivPassengerV2XImage"
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_constraintTop_toTopOf="parent"
tools:src="@drawable/v2x_icon_shigong_zhandao" />
<TextView
android:id="@+id/tvPassengerV2XContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_30"
android:ellipsize="end"
android:gravity="start"
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/ivPassengerV2XImage"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_default="wrap"
app:layout_goneMarginStart="0dp"
tools:text="前方150米 道路施工" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.mogo.eagle.core.function.hmi.ui.v2n.V2NEventLivePlayView
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_marginEnd="@dimen/dp_51"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/containerEvent" />
<TextView
android:id="@+id/tvPassengerV2XTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_51"
android:layout_marginEnd="@dimen/dp_51"
android:layout_marginBottom="@dimen/dp_33"
android:ellipsize="end"
android:gravity="start"
android:maxLines="1"
android:textColor="#131415"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/containerLivePlay"
tools:text="更新时间10:38:20" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_v2n_event_live_play"
app:roundLayoutRadius="@dimen/dp_36">
<TextView
android:id="@+id/tvTipContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="当前设备暂无信号"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_32"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="gone" />
<ImageView
android:id="@+id/ivTipLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:src="@drawable/hmi_v2n_event_mogo_logo"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
android:id="@+id/svpPlayer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>