diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt index 14fbce0bd5..4dfdd36da2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt @@ -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) } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt index aa8be66de9..41165b2633 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt @@ -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 } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeFloatView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeFloatView.kt index 2eb06663a0..90a65417db 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeFloatView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeFloatView.kt @@ -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) + } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_check_with_accessory.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_check_with_accessory.xml index e3c17b5030..4e1d752dc2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_check_with_accessory.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_check_with_accessory.xml @@ -50,12 +50,13 @@ + + #E63B4577 #D5D5D4 #3B4577 + #256BFF \ No newline at end of file