[add] 1.测试Reciver kotlin类 2.添加hmi模块调起业务模块下的view展示层notice相关方法添加

This commit is contained in:
liujing
2021-10-29 12:12:10 +08:00
parent 08291c3882
commit e6c41d85cc
7 changed files with 51 additions and 55 deletions

3
.idea/gradle.xml generated
View File

@@ -4,7 +4,7 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
@@ -81,6 +81,7 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@@ -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')
}
}

View File

@@ -2,13 +2,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.eagle.core.function.notice">
<application>
<receiver android:name=".test.TestNoticeBroadcastReceiver">
<intent-filter>
<action android:name="com.notice.test_panel_control" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
<application></application>
</manifest>

View File

@@ -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);
}
}

View File

@@ -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);
}
}
}

View File

@@ -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)
}
}
}

View File

@@ -133,8 +133,9 @@ object CallerHmiManager : CallerBase() {
*
* @param pushData
*/
fun showTrafficBanner(pushData: NoticePushData) {
fun showTrafficBanner(pushData: NoticePushData?) {
noticeProviderApi.showNoticeForTrafficWithData(pushData)
}
}