From e6c41d85ccd158d37e68f3fb48e2b0064bcca864 Mon Sep 17 00:00:00 2001 From: liujing Date: Fri, 29 Oct 2021 12:12:10 +0800 Subject: [PATCH 1/5] =?UTF-8?q?[add]=201.=E6=B5=8B=E8=AF=95Reciver=20kotli?= =?UTF-8?q?n=E7=B1=BB=202.=E6=B7=BB=E5=8A=A0hmi=E6=A8=A1=E5=9D=97=E8=B0=83?= =?UTF-8?q?=E8=B5=B7=E4=B8=9A=E5=8A=A1=E6=A8=A1=E5=9D=97=E4=B8=8B=E7=9A=84?= =?UTF-8?q?view=E5=B1=95=E7=A4=BA=E5=B1=82notice=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/gradle.xml | 3 +- .../mogo-core-function-notice/build.gradle | 2 + .../src/main/AndroidManifest.xml | 10 +---- .../core/function/notice/NoticeProvider.java | 7 +++- .../test/TestNoticeBroadcastReceiver.java | 42 ------------------- .../test/TestNoticeBroadcastReceiver.kt | 39 +++++++++++++++++ .../function/call/hmi/CallerHmiManager.kt | 3 +- 7 files changed, 51 insertions(+), 55 deletions(-) delete mode 100644 core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.java create mode 100644 core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.kt diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 7f9f262a61..1230f12f86 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,7 +4,7 @@ diff --git a/core/function-impl/mogo-core-function-notice/build.gradle b/core/function-impl/mogo-core-function-notice/build.gradle index e8c776714b..fc27273bad 100644 --- a/core/function-impl/mogo-core-function-notice/build.gradle +++ b/core/function-impl/mogo-core-function-notice/build.gradle @@ -56,6 +56,7 @@ dependencies { api rootProject.ext.dependencies.mogocommons api rootProject.ext.dependencies.mogoserviceapi implementation rootProject.ext.dependencies.modulecommon + implementation rootProject.ext.dependencies.moduleHmi } else { api project(":foudations:mogo-commons") api project(':services:mogo-service-api') @@ -64,6 +65,7 @@ dependencies { implementation project(':core:mogo-core-function-call') implementation project(':core:mogo-core-res') implementation project(':core:mogo-core-data') + implementation project(':core:function-impl:mogo-core-function-hmi') } } diff --git a/core/function-impl/mogo-core-function-notice/src/main/AndroidManifest.xml b/core/function-impl/mogo-core-function-notice/src/main/AndroidManifest.xml index 810055ae58..9f65d6f79c 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/AndroidManifest.xml +++ b/core/function-impl/mogo-core-function-notice/src/main/AndroidManifest.xml @@ -2,13 +2,5 @@ - - - - - - - - - + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeProvider.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeProvider.java index 719ea6b94f..c0dcf261e4 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeProvider.java +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeProvider.java @@ -11,6 +11,7 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths; import com.mogo.eagle.core.data.notice.NoticePushData; import com.mogo.eagle.core.function.api.notice.IMoGoNoticeProvider; import com.mogo.eagle.core.function.call.notice.CallerNoticeManager; +import com.mogo.eagle.core.function.hmi.ui.MoGoHmiFragment; import com.mogo.eagle.core.function.notice.receiver.NoticeMessageListener; import com.mogo.module.common.MogoApisHandler; import com.mogo.service.cloud.socket.IMogoLifecycleListener; @@ -28,11 +29,13 @@ import org.jetbrains.annotations.Nullable; public class NoticeProvider implements IMoGoNoticeProvider { private String TAG = "AINotice"; private Context mContext; + private MoGoHmiFragment mMoGoHmiFragment; @Nullable @Override public Fragment createCoverage(@Nullable Context context, @Nullable Bundle data) { - return null; + mMoGoHmiFragment = new MoGoHmiFragment(); + return mMoGoHmiFragment; } @NotNull @@ -55,6 +58,6 @@ public class NoticeProvider implements IMoGoNoticeProvider { @Override public void showNoticeForTrafficWithData(NoticePushData pushData) { - + mMoGoHmiFragment.showNoticeForTrafficWithData(pushData); } } diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.java deleted file mode 100644 index 204382c0ff..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.mogo.eagle.core.function.notice.test; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -import com.mogo.eagle.core.data.notice.NoticePushData; -import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; -import com.mogo.utils.logger.Logger; - -/** - * @author Jing - * @description 描述 - * @since: 10/28/21 - */ -public class TestNoticeBroadcastReceiver extends BroadcastReceiver { - private String TAG = "notice"; - private Context mContext; - - @Override - public void onReceive(Context context, Intent intent) { - try { - this.mContext = context; - int sceneType = intent.getIntExtra("sceneType", 0); - Logger.d(TAG, "textPanelOpenType:" + sceneType); - // 分发场景 - dispatchSceneTest(sceneType); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private void dispatchSceneTest(int sceneType) { - if (sceneType == 301001) { - NoticePushData pushData = new NoticePushData(); - pushData.setMsg("交警测试公告"); - pushData.setContent("交警测试公告内容"); -// CallerHmiManager.showTrafficBanner(pushData); - } - } - -} diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.kt b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.kt new file mode 100644 index 0000000000..940972464c --- /dev/null +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.kt @@ -0,0 +1,39 @@ +package com.mogo.eagle.core.function.notice.test + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import com.mogo.eagle.core.data.notice.NoticePushData +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.utils.logger.Logger + +/** + * @author Jing + * @description 测试类 + * @since: 10/29/21 + */ +class TestNoticeBroadcastReceiver: BroadcastReceiver() { + private val TAG = "notice" + private var mContext: Context? = null + + override fun onReceive(context: Context?, intent: Intent) { + try { + mContext = context + val sceneType = intent.getIntExtra("sceneType", 0) + Logger.d(TAG, "textPanelOpenType:$sceneType") + // 分发场景 + dispatchSceneTest(sceneType) + } catch (e: Exception) { + e.printStackTrace() + } + } + + private fun dispatchSceneTest(sceneType: Int) { + if (sceneType == 301001) { + val pushData = NoticePushData() + pushData.msg = "交警测试公告" + pushData.content = "交警测试公告内容" + CallerHmiManager.showTrafficBanner(pushData) + } + } +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index dde11c55d2..7aaa7f35b7 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -133,8 +133,9 @@ object CallerHmiManager : CallerBase() { * * @param pushData */ - fun showTrafficBanner(pushData: NoticePushData) { + fun showTrafficBanner(pushData: NoticePushData?) { noticeProviderApi.showNoticeForTrafficWithData(pushData) } + } \ No newline at end of file From 100d2fe80ffc0a9bce6d076d216367cca54b9f24 Mon Sep 17 00:00:00 2001 From: liujing Date: Fri, 29 Oct 2021 14:43:25 +0800 Subject: [PATCH 2/5] no message --- .../com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt | 4 ++++ .../eagle/core/function/hmi/ui/widget/SpeedChartView.java | 1 + 2 files changed, 5 insertions(+) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index 970fe13bec..9dd9b171d2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -15,6 +15,7 @@ import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.notification.WarningFloat import com.mogo.eagle.core.function.hmi.notification.anim.DefaultAnimator import com.mogo.eagle.core.function.hmi.notification.enums.SidePattern +import com.mogo.eagle.core.function.hmi.ui.notice.NoticeBannerView import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView import com.mogo.module.common.enums.EventTypeEnum import com.mogo.utils.logger.Logger @@ -212,7 +213,10 @@ class MoGoHmiFragment : MvpFragment * @param pushData */ override fun showNoticeForTrafficWithData(pushData: NoticePushData) { + activity.let { + val noticeBannerView = this.getContext()?.let { it1 -> NoticeBannerView(it1) } + } } } \ 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/widget/SpeedChartView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedChartView.java index f6d69a53ee..6560fadda6 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedChartView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedChartView.java @@ -13,6 +13,7 @@ import android.view.View; import androidx.annotation.Nullable; import com.mogo.eagle.core.function.hmi.R; +import com.mogo.eagle.core.function.hmi.ui.notice.NoticeBannerView; /** From 59c5d66cfe271f8cc0241d816957e66899952099 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Fri, 29 Oct 2021 15:03:24 +0800 Subject: [PATCH 3/5] fixed conflict --- .../core/data/notice/NoticeNormalData.kt | 36 +++++++++++++++++++ .../data/notice/NoticeNormalDetailData.kt | 22 ++++++++++++ .../api/notice/IMoGoNoticeProvider.java | 9 +++++ .../function/call/hmi/CallerHmiManager.kt | 8 +++++ 4 files changed, 75 insertions(+) create mode 100644 core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/notice/NoticeNormalData.kt create mode 100644 core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/notice/NoticeNormalDetailData.kt diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/notice/NoticeNormalData.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/notice/NoticeNormalData.kt new file mode 100644 index 0000000000..9c8b94a339 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/notice/NoticeNormalData.kt @@ -0,0 +1,36 @@ +package com.mogo.eagle.core.data.notice + +import androidx.annotation.Keep + +/** + * @description 普通公告数据类型 + * + * @author lixiaopeng + * @since 2021/10/29 + */ +@Keep +data class NoticeNormalData( + var appIcon: String = "", //目标app icon图标地址 + var title: String = "", //标题 + var content: String = "", //内容 + var dbId: String = "", //公告id + var imageUrl: String = "", //图片地址 + var videoUrl: String = "", //视频地址 + var fileType: Int = 0, // 1图片,2视频 + val tts: String = "", //语音播报词 + val speedLimit: Int = 0, //超过速度后延迟显示 + var showTimeout: Int = 0, //显示等待时长 + var showTimeoutShadow: Int = 0, // 显示等待时长备份 + var QRCode: String = "", //二维码地址 + var mainSchema: String = "", //schema跳转协议 + val mainVoiceCmd: List? = null, //触发主schema 命令词 + val cancelVoiceCmd: List? = null, //隐藏当前push命令词 + val buttons: List