From fe3bfb7dc3000bd91719f994750e727568a6ddb9 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Mon, 1 Nov 2021 18:32:28 +0800 Subject: [PATCH] fixed conflict --- .../mogo-core-function-hmi/build.gradle | 2 + .../src/main/AndroidManifest.xml | 9 +++ .../receiver/NoticeNormalBroadcastReceiver.kt | 56 +++++++++++++++++++ .../hmi/ui/notice/NoticeCheckDialog.kt | 18 +++++- .../function/hmi/ui/notice/NoticeFloatView.kt | 53 ++++++++++-------- .../notice_dialog_check_with_accessory.xml | 39 +++++++++++-- ...eck.xml => notice_module_dialog_check.xml} | 3 +- 7 files changed, 148 insertions(+), 32 deletions(-) create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt rename core/function-impl/mogo-core-function-hmi/src/main/res/layout/{notice_push_dialog_check.xml => notice_module_dialog_check.xml} (96%) diff --git a/core/function-impl/mogo-core-function-hmi/build.gradle b/core/function-impl/mogo-core-function-hmi/build.gradle index 5f71ecce56..c13ea62bf3 100644 --- a/core/function-impl/mogo-core-function-hmi/build.gradle +++ b/core/function-impl/mogo-core-function-hmi/build.gradle @@ -61,6 +61,7 @@ dependencies { implementation rootProject.ext.dependencies.mogo_core_utils implementation rootProject.ext.dependencies.mogo_core_network implementation rootProject.ext.dependencies.mogo_core_function_call +// implementation rootProject.ext.dependencies.mogo_core_res } else { implementation project(':modules:mogo-module-common') implementation project(':services:mogo-service-api') @@ -70,6 +71,7 @@ dependencies { implementation project(':core:mogo-core-utils') implementation project(':core:mogo-core-function-api') implementation project(':core:mogo-core-function-call') +// implementation project(':core:mogo-core-res') } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/AndroidManifest.xml b/core/function-impl/mogo-core-function-hmi/src/main/AndroidManifest.xml index cab30ee3da..4e3fdff847 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/AndroidManifest.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/AndroidManifest.xml @@ -27,5 +27,14 @@ + + + + + + + + + \ 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/receiver/NoticeNormalBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt new file mode 100644 index 0000000000..14fbce0bd5 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt @@ -0,0 +1,56 @@ +package com.mogo.eagle.core.function.hmi.receiver + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import com.alibaba.android.arouter.launcher.ARouter +import com.mogo.module.common.enums.EventTypeEnum +import com.mogo.eagle.core.function.hmi.WaringConst +import com.mogo.service.IMogoServiceApis +import com.mogo.eagle.core.data.constants.MogoServicePaths +import com.mogo.eagle.core.data.notice.NoticeNormalData +import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider +import com.mogo.utils.logger.Logger + +/** + * 用于普通云公告的测试 + * + * @author lixiaopeng + */ +class NoticeNormalBroadcastReceiver : BroadcastReceiver() { + + companion object { + private const val TAG = "NoticeNormalBroadcastReceiver" + private var mMogoServiceApis: IMogoServiceApis? = null + private var mIMoGoWaringProvider: IMoGoWaringProvider? = null + } + + override fun onReceive(context: Context, intent: Intent) { + try { + mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS) + .navigation(context) as IMogoServiceApis + mIMoGoWaringProvider = mMogoServiceApis!!.waringProviderApi + + // 分发场景 + dispatchShowWaring("11", "官方公告", "测试普通云公告", "www") + } catch (e: Exception) { + e.printStackTrace() + } + } + + private fun dispatchShowWaring( + id: String, + titleTv: String, + contentTv: String, + imageUrl: String + ) { + + val data = NoticeNormalData() + data.dbId = id + data.imageUrl = imageUrl + data.title = titleTv + data.content = contentTv + + mIMoGoWaringProvider!!.showNoticeNormalData(data) + } +} \ 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/NoticeCheckDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt index a5efe22924..bf66606a42 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 @@ -4,23 +4,33 @@ import android.content.Context import android.widget.ImageView import android.widget.TextView import com.mogo.eagle.core.function.hmi.R +//import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer import com.mogo.module.common.dialog.BaseFloatDialog /** * 点击查看对话框,需要做接口的请求 TODO + * */ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context) { 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 init { - setContentView(R.layout.notice_push_dialog_check) + setContentView(R.layout.notice_dialog_check_with_accessory) //notice_module_dialog_check setCanceledOnTouchOutside(true) pushCheckClose = findViewById(R.id.module_push_dialog_close) - pushCheckTitle = findViewById(R.id.module_push_dialog_title) + pushCheckTitle = findViewById(R.id.module_push_dialog_acc_title) pushCheckContent = findViewById(R.id.module_push_dialog_content) + 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) + pushCheckClose?.setOnClickListener { dismiss() } @@ -37,4 +47,8 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context) { pushCheckContent?.text = content show() } + + //展示相关数据,播放视频 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 c101eee60b..a569c2aa3f 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 @@ -3,16 +3,15 @@ package com.mogo.eagle.core.function.hmi.ui.notice import android.content.Context import android.os.Handler import android.os.Looper -import android.util.Log import android.view.LayoutInflater import android.view.View import android.widget.FrameLayout +import android.widget.ImageView import android.widget.TextView import androidx.annotation.LayoutRes import com.mogo.commons.context.ContextHolderUtil import com.mogo.eagle.core.data.notice.NoticeNormalData import com.mogo.eagle.core.function.hmi.R -import com.mogo.eagle.core.function.hmi.ui.notice.roundimage.RoundedImageView import com.mogo.eagle.core.function.hmi.ui.utils.getApis import com.mogo.eagle.core.function.hmi.ui.utils.gone import com.mogo.eagle.core.function.hmi.ui.utils.visible @@ -43,17 +42,17 @@ class NoticeFloatView constructor( PushViewController { private lateinit var titleIconContainer: View private lateinit var pushTitle: TextView - private lateinit var pushImage: RoundedImageView + private lateinit var pushImage: ImageView private lateinit var pushContent: TextView private lateinit var pushCheck: TextView private var pushData: NoticeNormalData? = null override fun inflateView(layoutId: Int) { LayoutInflater.from(context).inflate(layoutId, this, true) - pushTitle = findViewById(R.id.module_push_title) - pushCheck = findViewById(R.id.module_push_check) - pushImage = findViewById(R.id.module_push_image) - pushContent = findViewById(R.id.module_push_content) + pushTitle = findViewById(R.id.notice_push_title) + pushCheck = findViewById(R.id.notice_push_banner_check) + pushImage = findViewById(R.id.notice_push_style_image) + pushContent = findViewById(R.id.notice_push_content) titleIconContainer = findViewById(R.id.module_push_app_icon_title) //查看结果 @@ -72,21 +71,28 @@ class NoticeFloatView constructor( // title pushTitle.text = bean.title + val params = pushImage.layoutParams + params.width = getImgWidth() + params.height = getImgHeight() + pushImage.layoutParams = params + pushImage.visible() + GlideApp.with(this).load(bean.imageUrl).placeholder(R.drawable.notice_banner_default).into(pushImage) + // image - if (bean.imageUrl.isEmpty() && bean.QRCode.isEmpty()) { - pushImage.gone() - } else if (bean.imageUrl.isNotEmpty()) { - val params = pushImage.layoutParams - params.width = getImgWidth() - params.height = getImgHeight() - pushImage.layoutParams = params - pushImage.visible() - GlideApp.with(this).load(bean.imageUrl).into(pushImage) - } else if (bean.QRCode.isNotEmpty()) { - val params = pushImage.layoutParams - params.width = getQrImgWidth() - params.height = getQrImgHeight() - pushImage.layoutParams = params +// if (bean.imageUrl.isEmpty()) { +// pushImage.gone() +// } else if (bean.imageUrl.isNotEmpty()) { +// val params = pushImage.layoutParams +// params.width = getImgWidth() +// params.height = getImgHeight() +// pushImage.layoutParams = params +// pushImage.visible() +// GlideApp.with(this).load(bean.imageUrl).placeholder(R.drawable.notice_banner_default).into(pushImage) +// } else if (bean.QRCode.isNotEmpty()) { +// val params = pushImage.layoutParams +// params.width = getQrImgWidth() +// params.height = getQrImgHeight() +// pushImage.layoutParams = params // ThreadPoolService.execute { // val bmp = stringConverterBitmap( // bean.QRCode, @@ -98,7 +104,7 @@ class NoticeFloatView constructor( // pushImage.visible() // } // } - } +// } // content if (bean.content.isEmpty()) { @@ -135,7 +141,7 @@ class NoticeFloatView constructor( private val mTopViewManager: IMogoTopViewManager = getApis(context).topViewManager init { - inflateView(R.layout.notice_module_push_item) + inflateView(R.layout.notice_push_top_banner) } private var topViewStatusListener = object : IMogoTopViewStatusListener { @@ -195,7 +201,6 @@ class NoticeFloatView constructor( } fun pushBeanChanged(bean: NoticeNormalData?) { - Log.d("liyz", "NoticeFloatVideo pushBeanChanged -----> bean = " + bean) uiHandler.post { uiHandler.removeCallbacks(delayClosePush) if (bean == null) { 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 ea97036108..8356c13943 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 @@ -39,22 +39,53 @@ android:layout_marginRight="@dimen/dp_150" android:layout_marginBottom="@dimen/dp_56" android:ellipsize="end" - android:maxLines="2" android:gravity="left" + android:maxLines="2" android:text=" 官方公告测试数据,当前测试数据属于查看UI状态,多于两行是怎么显示的,多余的内容是都是省略号显示的呢,看一下测试数据的" android:textColor="#FFF" android:textSize="@dimen/dp_50" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" /> + + + + + + + + + + + + + + + + + + + - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_push_dialog_check.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_module_dialog_check.xml similarity index 96% rename from core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_push_dialog_check.xml rename to core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_module_dialog_check.xml index 7fdd8003f5..8e6759c085 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_push_dialog_check.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_module_dialog_check.xml @@ -3,8 +3,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="@dimen/module_push_dialog_check_width" - android:layout_height="@dimen/module_push_dialog_check_height" - android:background="@drawable/module_push_dialog_check_background"> + android:layout_height="@dimen/module_push_dialog_check_height">