opt
This commit is contained in:
@@ -32,7 +32,10 @@ class NoticeNormalBroadcastReceiver : BroadcastReceiver() {
|
||||
mIMoGoWaringProvider = mMogoServiceApis!!.waringProviderApi
|
||||
|
||||
// 分发场景
|
||||
dispatchShowWaring("11", "官方公告", "测试普通云公告", "www")
|
||||
dispatchShowWaring("11", "官方公告", "测试普通云公告普通云公告普通云公告普通云公告普通云公告普通云公告普通云公告哈哈哈哈哈哈好好",
|
||||
"https://dataservice-1255510688.cos.ap-beijing.myqcloud.com/carImg/yycp_NoticeDETAIL_location.png",
|
||||
"https://vd2.bdstatic.com/mda-mk1347dzxdmcre0y/sc/cae_h264/1635819498112313003/mda-mk1347dzxdmcre0y.mp4?v_from_s=hkapp-haokan-tucheng&auth_key=1635837585-0-0-5295f6658c7711ba7b4d3ef478a7fbaa&bcevod_channel=searchbox_feed&pd=1&pt=3&abtest=",
|
||||
2)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
@@ -42,7 +45,9 @@ class NoticeNormalBroadcastReceiver : BroadcastReceiver() {
|
||||
id: String,
|
||||
titleTv: String,
|
||||
contentTv: String,
|
||||
imageUrl: String
|
||||
imageUrl: String,
|
||||
videoUrl: String,
|
||||
fileType: Int
|
||||
) {
|
||||
|
||||
val data = NoticeNormalData()
|
||||
@@ -50,6 +55,8 @@ class NoticeNormalBroadcastReceiver : BroadcastReceiver() {
|
||||
data.imageUrl = imageUrl
|
||||
data.title = titleTv
|
||||
data.content = contentTv
|
||||
data.videoUrl = videoUrl
|
||||
data.fileType = fileType
|
||||
|
||||
mIMoGoWaringProvider!!.showNoticeNormalData(data)
|
||||
}
|
||||
|
||||
@@ -1,35 +1,54 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.notice
|
||||
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog
|
||||
import com.mogo.utils.glide.GlideApp
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
import com.shuyu.gsyvideoplayer.cache.CacheFactory
|
||||
import com.shuyu.gsyvideoplayer.cache.ProxyCacheManager
|
||||
import com.shuyu.gsyvideoplayer.listener.GSYMediaPlayerListener
|
||||
import com.shuyu.gsyvideoplayer.model.VideoOptionModel
|
||||
import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
|
||||
import com.shuyu.gsyvideoplayer.player.PlayerFactory
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
import tv.danmaku.ijk.media.player.IjkMediaPlayer
|
||||
import java.util.*
|
||||
|
||||
|
||||
/**
|
||||
* 点击查看对话框,需要做接口的请求 TODO
|
||||
*
|
||||
* 点击查看对话框,需要做接口的请求
|
||||
*
|
||||
*/
|
||||
class NoticeCheckDialog(context: Context) : BaseFloatDialog(context) {
|
||||
|
||||
private val TAG = "NoticeCheckDialog"
|
||||
private var pushCheckClose: ImageView? = null
|
||||
private var pushCheckTitle: TextView? = null
|
||||
private var pushCheckContent: TextView? = null
|
||||
private var pushImageView: ImageView? = null
|
||||
private var pushVideo: SimpleVideoPlayer? = null
|
||||
private val gsyVideoOptionBuilder = GSYVideoOptionBuilder()
|
||||
// private var mLoading: ProgressBar? = null
|
||||
|
||||
init {
|
||||
setContentView(R.layout.notice_dialog_check_with_accessory)
|
||||
setCanceledOnTouchOutside(true)
|
||||
pushCheckClose = findViewById(R.id.module_push_dialog_close)
|
||||
pushCheckTitle = findViewById(R.id.module_push_dialog_acc_title)
|
||||
pushCheckContent = findViewById(R.id.module_push_dialog_content)
|
||||
pushCheckContent = findViewById(R.id.module_push_dialog_bottom_title)
|
||||
pushImageView = findViewById(R.id.notice_image)
|
||||
pushVideo = findViewById(R.id.notice_video_layout)
|
||||
|
||||
// GlideApp.with(context!!).load(headImgUrl)
|
||||
// .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(pushImageView)
|
||||
// mLoading = findViewById(R.id.loading)
|
||||
// mLoading!!.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(context, R.color.notice_video_progressbar_loading_color), PorterDuff.Mode.MULTIPLY)
|
||||
|
||||
pushCheckClose?.setOnClickListener {
|
||||
dismiss()
|
||||
@@ -39,21 +58,70 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context) {
|
||||
/**
|
||||
* 展示详情页面
|
||||
*/
|
||||
fun showCheckDialog(title: String, dbId: String) {
|
||||
if (isShowing) {
|
||||
fun showCheckDialog(noticeNormal: NoticeNormalData) {
|
||||
Logger.d("liyz", "------1--------")
|
||||
if (isShowing || noticeNormal == null) {
|
||||
return
|
||||
}
|
||||
if (title.isBlank() || dbId.isBlank()) {
|
||||
return
|
||||
}
|
||||
pushCheckTitle?.text = title
|
||||
|
||||
//网络请求处理数据
|
||||
if (noticeNormal.title.isBlank() || noticeNormal.content.isBlank()) {
|
||||
return
|
||||
}
|
||||
|
||||
pushCheckTitle?.text = noticeNormal.title
|
||||
pushCheckContent?.text = noticeNormal.content
|
||||
|
||||
if (!TextUtils.isEmpty(noticeNormal.imageUrl) && noticeNormal.fileType == 1) {
|
||||
Logger.d("liyz", "------2--------")
|
||||
pushVideo?.visibility = View.GONE
|
||||
pushImageView?.visibility = View.VISIBLE
|
||||
pushImageView?.let { GlideApp.with(context!!).load(noticeNormal.imageUrl).into(it) }
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(noticeNormal.videoUrl) && noticeNormal.fileType == 2) {
|
||||
Logger.d("liyz", "------3--------")
|
||||
pushImageView?.visibility = View.GONE
|
||||
pushVideo?.visibility = View.VISIBLE
|
||||
//加载视频播放
|
||||
playLiveVideo(noticeNormal.videoUrl)
|
||||
}
|
||||
|
||||
show()
|
||||
}
|
||||
|
||||
//展示相关数据,播放视频 TODO
|
||||
|
||||
/**
|
||||
* 播放直播流,且开始心跳
|
||||
*/
|
||||
private fun playLiveVideo(videoUrl: String) {
|
||||
// pushVideo?.setPlayListener(object : PlayListener {
|
||||
// override fun onPlayEvent(event: Int) {
|
||||
// Logger.d("liyz", "event ----- $event")
|
||||
// if (event == SimpleVideoPlayer.PLAY_EVT_PLAY_LOADING) {
|
||||
//// mLoading!!.visibility = View.VISIBLE
|
||||
// } else if (event == SimpleVideoPlayer.PLAY_EVT_PLAY_BEGIN) {
|
||||
//// mLoading!!.visibility = View.GONE
|
||||
// } else if (event < 0) {
|
||||
// stopLive()
|
||||
//// mLoading!!.visibility = View.GONE
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
|
||||
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||
.build(pushVideo)
|
||||
pushVideo!!.startButton.performClick()
|
||||
}
|
||||
|
||||
fun stopLive() {
|
||||
try {
|
||||
GSYVideoManager.releaseAllVideos()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
//播放完成的回调 TODO
|
||||
|
||||
|
||||
}
|
||||
@@ -54,13 +54,14 @@ class NoticeFloatView constructor(
|
||||
pushContent = findViewById(R.id.notice_push_content)
|
||||
titleIconContainer = findViewById(R.id.module_push_app_icon_title)
|
||||
|
||||
//查看结果 TODO
|
||||
//查看结果
|
||||
pushCheck.setOnClickListener {
|
||||
pushData?.let {
|
||||
if (pushCheckDialog == null) {
|
||||
pushCheckDialog = NoticeCheckDialog(ContextHolderUtil.getContext())
|
||||
}
|
||||
pushCheckDialog!!.showCheckDialog(it.title, it.dbId)
|
||||
pushCheckDialog!!.showCheckDialog(it)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,12 +50,13 @@
|
||||
<!--中间图片-->
|
||||
<ImageView
|
||||
android:id="@+id/notice_image"
|
||||
android:layout_width="@dimen/module_push_dialog_check_acc_image_width"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/module_push_dialog_check_acc_image__height"
|
||||
android:layout_marginLeft="@dimen/dp_150"
|
||||
android:layout_marginTop="@dimen/dp_52"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:layout_marginRight="@dimen/dp_150"
|
||||
android:background="@color/module_commons_FFF_333"
|
||||
android:visibility="gone"
|
||||
android:scaleType="fitXY"
|
||||
app:layout_constraintBottom_toTopOf="@+id/module_push_dialog_bottom_title"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
@@ -70,12 +71,21 @@
|
||||
android:layout_marginTop="@dimen/dp_52"
|
||||
android:layout_marginRight="@dimen/dp_150"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toTopOf="@+id/module_push_dialog_bottom_title"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_push_dialog_acc_title" />
|
||||
|
||||
<androidx.core.widget.ContentLoadingProgressBar
|
||||
android:id="@+id/loading"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:visibility="gone"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<!--加载失败默认图-->
|
||||
<ImageView
|
||||
android:id="@+id/load_failed_image"
|
||||
|
||||
@@ -6,4 +6,5 @@
|
||||
<color name="notice_check_dialog_bg_color">#E63B4577</color>
|
||||
<color name="notice_traffic_line">#D5D5D4</color>
|
||||
<color name="notice_dialog_back">#3B4577</color>
|
||||
<color name="notice_video_progressbar_loading_color">#256BFF</color>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user