[add] 1.添加push推送数据体bean 2.添加caller调hmi UI调起流程相关java类文件

This commit is contained in:
liujing
2021-10-28 20:09:04 +08:00
parent f1be75c2f6
commit f4e5949b4e
10 changed files with 224 additions and 73 deletions

View File

@@ -9,6 +9,7 @@ import android.view.animation.OvershootInterpolator
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.notice.NoticePushData
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
@@ -25,7 +26,7 @@ import kotlinx.android.synthetic.main.fragment_hmi.*
* 预警图层
*/
class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>(),
MoGoWarningContract.View {
MoGoWarningContract.View {
var mWarningFloat: WarningFloat.Builder? = null
@@ -51,11 +52,11 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
*/
@Synchronized
override fun showWarningV2X(
v2xType: Int,
alertContent: String?,
ttsContent: String?,
tag: String?,
listenerIMoGo: IMoGoWarningStatusListener?
v2xType: Int,
alertContent: String?,
ttsContent: String?,
tag: String?,
listenerIMoGo: IMoGoWarningStatusListener?
) {
activity?.let {
@@ -64,9 +65,9 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
notificationView.setWarningIcon(EventTypeEnum.getWarningIcon(v2xType.toString()))
notificationView.setWarningContent(
alertContent ?: EventTypeEnum.getWarningContent(
v2xType.toString()
)
alertContent ?: EventTypeEnum.getWarningContent(
v2xType.toString()
)
)
if (mWarningFloat != null && mWarningFloat!!.config.floatTag != tag) {
@@ -74,47 +75,47 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
}
mWarningFloat = WarningFloat.with(it)
.setTag(tag)
.setLayout(notificationView)
.setSidePattern(SidePattern.TOP)
.setCountDownTime(5000)
.setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110)
.setImmersionStatusBar(true)
.addWarningStatusListener(listenerIMoGo)
.addWarningStatusListener(object : IMoGoWarningStatusListener {
override fun onShow() {
// 创建弹窗成功才进行TTS播报
Logger.d(
"MoGoWarningFragment",
"mWarningFloat = $mWarningFloat---ttsContent = $ttsContent"
)
if (mWarningFloat != null && !TextUtils.isEmpty(ttsContent)) {
Logger.d("MoGoWarningFragment", "---> ttsContent = $ttsContent")
AIAssist.getInstance(activity)
.speakTTSVoice(ttsContent)
}
}
})
.setAnimator(object : DefaultAnimator() {
override fun enterAnim(
view: View,
params: WindowManager.LayoutParams,
windowManager: WindowManager,
sidePattern: SidePattern
): Animator? =
super.enterAnim(view, params, windowManager, sidePattern)?.apply {
interpolator = OvershootInterpolator()
.setTag(tag)
.setLayout(notificationView)
.setSidePattern(SidePattern.TOP)
.setCountDownTime(5000)
.setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110)
.setImmersionStatusBar(true)
.addWarningStatusListener(listenerIMoGo)
.addWarningStatusListener(object : IMoGoWarningStatusListener {
override fun onShow() {
// 创建弹窗成功才进行TTS播报
Logger.d(
"MoGoWarningFragment",
"mWarningFloat = $mWarningFloat---ttsContent = $ttsContent"
)
if (mWarningFloat != null && !TextUtils.isEmpty(ttsContent)) {
Logger.d("MoGoWarningFragment", "---> ttsContent = $ttsContent")
AIAssist.getInstance(activity)
.speakTTSVoice(ttsContent)
}
}
})
.setAnimator(object : DefaultAnimator() {
override fun enterAnim(
view: View,
params: WindowManager.LayoutParams,
windowManager: WindowManager,
sidePattern: SidePattern
): Animator? =
super.enterAnim(view, params, windowManager, sidePattern)?.apply {
interpolator = OvershootInterpolator()
}
override fun exitAnim(
view: View,
params: WindowManager.LayoutParams,
windowManager: WindowManager,
sidePattern: SidePattern
): Animator? =
super.exitAnim(view, params, windowManager, sidePattern)?.setDuration(200)
})
.show()
override fun exitAnim(
view: View,
params: WindowManager.LayoutParams,
windowManager: WindowManager,
sidePattern: SidePattern
): Animator? =
super.exitAnim(view, params, windowManager, sidePattern)?.setDuration(200)
})
.show()
}
}
@@ -205,4 +206,13 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
override fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
flV2XWarningView.showWarning(direction, closeTime)
}
/**
* 展示云公告顶部弹窗
* @param pushData
*/
override fun showNoticeForTrafficWithData(pushData: NoticePushData) {
}
}

View File

@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.hmi.ui
import com.mogo.commons.mvp.IView
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.notice.NoticePushData
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
@@ -22,11 +23,11 @@ interface MoGoWarningContract {
* @param tag tag绑定弹窗的标志
*/
fun showWarningV2X(
v2xType: Int,
alertContent: String?,
ttsContent: String?,
tag: String?,
listenerIMoGo: IMoGoWarningStatusListener?
v2xType: Int,
alertContent: String?,
ttsContent: String?,
tag: String?,
listenerIMoGo: IMoGoWarningStatusListener?
)
/**
@@ -95,5 +96,11 @@ interface MoGoWarningContract {
* @param closeTime 倒计时
*/
fun showWarning(direction: WarningDirectionEnum, closeTime: Long)
/**
* 展示云公告顶部弹窗
* @param pushData
*/
fun showNoticeForTrafficWithData(pushData: NoticePushData)
}
}

View File

@@ -2,4 +2,13 @@
<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>
</manifest>

View File

@@ -8,7 +8,9 @@ import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.annotation.Route;
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.notice.receiver.NoticeMessageListener;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.cloud.socket.IMogoLifecycleListener;
@@ -51,4 +53,8 @@ public class NoticeProvider implements IMoGoNoticeProvider {
NoticeSocketManager.getInstance().registerSocketMessageListener(context);
}
@Override
public void showNoticeForTrafficWithData(NoticePushData pushData) {
}
}

View File

@@ -33,13 +33,13 @@ class NoticeSocketManager {
mContext = context;
mNoticeMessageListener = new NoticeMessageListener();
MogoApisHandler.getInstance().getApis().getSocketManagerApi(context).
registerOnMessageListener(100, mNoticeMessageListener);
registerOnMessageListener(301001, mNoticeMessageListener);
}
public void unRegisterSocketMessageListener() {
if (mNoticeMessageListener != null) {
MogoApisHandler.getInstance().getApis().getSocketManagerApi(mContext).
unregisterOnMessageListener(100, mNoticeMessageListener);
unregisterOnMessageListener(301001, mNoticeMessageListener);
}
}
}

View File

@@ -0,0 +1,42 @@
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);
}
}
}