[V2X]移除无用场景
This commit is contained in:
@@ -5,7 +5,6 @@ import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.text.TextUtils
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -17,7 +16,6 @@ import androidx.lifecycle.lifecycleScope
|
||||
import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
|
||||
import com.mogo.eagle.core.function.hmi.notification.anim.DefaultAnimator
|
||||
@@ -25,7 +23,6 @@ import com.mogo.eagle.core.function.hmi.notification.enums.SidePattern
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView
|
||||
import com.mogo.eagle.core.function.main.MainLauncherActivity
|
||||
import com.mogo.eagle.core.utilcode.kotlin.shape
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.reminder.Reminder
|
||||
import com.mogo.eagle.core.utilcode.reminder.api.impl.ActivityReminder
|
||||
import com.mogo.eagle.core.utilcode.reminder.api.impl.PopupWindowReminder
|
||||
|
||||
@@ -582,70 +582,68 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
* @param tag tag绑定弹窗的标志
|
||||
*/
|
||||
@Synchronized
|
||||
override fun showWarningV2X(v2xType: Int, alertContent: String?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long) {
|
||||
activity?.let {
|
||||
val floatWindow = mWarningFloat
|
||||
val showTag = floatWindow?.config?.floatTag
|
||||
if (floatWindow == null || TextUtils.isEmpty(showTag)) {
|
||||
val notificationView = V2XNotificationView(it)
|
||||
notificationView.setWarningIcon(EventTypeEnum.getWarningIcon(v2xType.toString()))
|
||||
val warningContent = alertContent ?: EventTypeEnum.getWarningContent(v2xType.toString())
|
||||
if (warningContent.isEmpty()) {
|
||||
Logger.e(TAG, "Show warningContent is null or empty!")
|
||||
return
|
||||
override fun showWarningV2X(v2xType: Int, alertContent: CharSequence?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long) {
|
||||
lifecycleScope.launchWhenResumed {
|
||||
activity?.let {
|
||||
val floatWindow = mWarningFloat
|
||||
val showTag = floatWindow?.config?.floatTag
|
||||
if (floatWindow == null || TextUtils.isEmpty(showTag) || !floatWindow.isShow()) {
|
||||
val notificationView = V2XNotificationView(it)
|
||||
notificationView.setWarningIcon(EventTypeEnum.getWarningIcon(v2xType.toString()))
|
||||
val warningContent = alertContent ?: EventTypeEnum.getWarningContent(v2xType.toString())
|
||||
if (warningContent.isEmpty()) {
|
||||
Logger.e(TAG, "Show warningContent is null or empty!")
|
||||
return@launchWhenResumed
|
||||
} else {
|
||||
notificationView.setWarningContent(warningContent)
|
||||
}
|
||||
if (mWarningFloat != null && mWarningFloat!!.config.floatTag != tag) {
|
||||
WarningFloat.dismiss(mWarningFloat!!.config.floatTag, true)
|
||||
}
|
||||
mWarningFloat = WarningFloat.with(it)
|
||||
.setTag(tag)
|
||||
.setLayout(notificationView)
|
||||
.setSidePattern(SidePattern.RESULT_TOP)
|
||||
.setCountDownTime(expireTime)
|
||||
.setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110)
|
||||
.setImmersionStatusBar(true)
|
||||
.isEnqueue(true)
|
||||
.addWarningStatusListener(listenerIMoGo)
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
// 创建弹窗成功才进行TTS播报
|
||||
Logger.d(
|
||||
"MoGoWarningFragment",
|
||||
"mWarningFloat = $mWarningFloat---ttsContent = $ttsContent"
|
||||
)
|
||||
if (mWarningFloat != null && !TextUtils.isEmpty(ttsContent) && playTts) {
|
||||
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()
|
||||
} else {
|
||||
notificationView.setWarningContent(warningContent)
|
||||
}
|
||||
|
||||
if (mWarningFloat != null && mWarningFloat!!.config.floatTag != tag) {
|
||||
WarningFloat.dismiss(mWarningFloat!!.config.floatTag, true)
|
||||
}
|
||||
|
||||
mWarningFloat = WarningFloat.with(it)
|
||||
.setTag(tag)
|
||||
.setLayout(notificationView)
|
||||
.setSidePattern(SidePattern.RESULT_TOP)
|
||||
.setCountDownTime(expireTime)
|
||||
.setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110)
|
||||
.setImmersionStatusBar(true)
|
||||
.isEnqueue(true)
|
||||
.addWarningStatusListener(listenerIMoGo)
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
// 创建弹窗成功才进行TTS播报
|
||||
Logger.d(
|
||||
"MoGoWarningFragment",
|
||||
"mWarningFloat = $mWarningFloat---ttsContent = $ttsContent"
|
||||
)
|
||||
if (mWarningFloat != null && !TextUtils.isEmpty(ttsContent) && playTts) {
|
||||
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()
|
||||
} else {
|
||||
if (floatWindow.isShow()) {
|
||||
val notification = floatWindow.config.layoutView as? V2XNotificationView
|
||||
if (alertContent?.isNotEmpty() == true) {
|
||||
notification?.setWarningContent(alertContent)
|
||||
@@ -747,6 +745,10 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
flV2XWarningView?.showWarning(direction, closeTime)
|
||||
}
|
||||
|
||||
override fun dismissWarning(direction: WarningDirectionEnum) {
|
||||
flV2XWarningView?.dismissWarning(direction)
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示云公告顶部弹窗
|
||||
* @param trafficStylePushData
|
||||
|
||||
@@ -39,7 +39,7 @@ class V2XNotificationView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun setWarningContent(@Nullable warningContent: String) {
|
||||
fun setWarningContent(@Nullable warningContent: CharSequence) {
|
||||
UiThreadHandler.post {
|
||||
tvWaringContent.text = warningContent
|
||||
}
|
||||
|
||||
@@ -2,10 +2,21 @@ package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.RelativeLayout
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_ALL
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_BOTTOM
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_LEFT
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_NON
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_RIGHT
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_TOP
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_TOP_LEFT
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
@@ -25,7 +36,7 @@ class V2XWarningView @JvmOverloads constructor(
|
||||
|
||||
private val closeWarningTask: Runnable = Runnable {
|
||||
Logger.d("V2XWarningView", "预警红边:倒计时结束")
|
||||
showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
showWarning(ALERT_WARNING_NON)
|
||||
}
|
||||
|
||||
init {
|
||||
@@ -52,67 +63,67 @@ class V2XWarningView @JvmOverloads constructor(
|
||||
UiThreadHandler.post {
|
||||
|
||||
// 如果传入的不是关闭显示,则设置倒计时,定时关闭红框警示
|
||||
if (direction != WarningDirectionEnum.ALERT_WARNING_NON) {
|
||||
if (direction != ALERT_WARNING_NON) {
|
||||
removeCallbacks(closeWarningTask)
|
||||
postDelayed(closeWarningTask, closeTime)
|
||||
}
|
||||
when (direction) {
|
||||
WarningDirectionEnum.ALERT_WARNING_NON -> {
|
||||
ALERT_WARNING_NON -> {
|
||||
removeCallbacks(closeWarningTask)
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_TOP -> {
|
||||
ALERT_WARNING_TOP -> {
|
||||
hmiWarningTopImg.visibility = View.VISIBLE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_RIGHT -> {
|
||||
ALERT_WARNING_RIGHT -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.VISIBLE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_BOTTOM -> {
|
||||
ALERT_WARNING_BOTTOM -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.VISIBLE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_LEFT -> {
|
||||
ALERT_WARNING_LEFT -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.VISIBLE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT -> {
|
||||
ALERT_WARNING_TOP_RIGHT -> {
|
||||
hmiWarningTopImg.visibility = View.VISIBLE
|
||||
hmiWarningRightImg.visibility = View.VISIBLE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT -> {
|
||||
ALERT_WARNING_BOTTOM_RIGHT -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.VISIBLE
|
||||
hmiWarningBottomImg.visibility = View.VISIBLE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT -> {
|
||||
ALERT_WARNING_BOTTOM_LEFT -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.VISIBLE
|
||||
hmiWarningLeftImg.visibility = View.VISIBLE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_TOP_LEFT -> {
|
||||
ALERT_WARNING_TOP_LEFT -> {
|
||||
hmiWarningTopImg.visibility = View.VISIBLE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.VISIBLE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_ALL -> {
|
||||
ALERT_WARNING_ALL -> {
|
||||
hmiWarningTopImg.visibility = View.VISIBLE
|
||||
hmiWarningRightImg.visibility = View.VISIBLE
|
||||
hmiWarningBottomImg.visibility = View.VISIBLE
|
||||
@@ -121,4 +132,50 @@ class V2XWarningView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun dismissWarning(direction: WarningDirectionEnum) {
|
||||
if (direction == ALERT_WARNING_NON) {
|
||||
return
|
||||
}
|
||||
removeCallbacks(closeWarningTask)
|
||||
when (direction) {
|
||||
ALERT_WARNING_TOP -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
}
|
||||
ALERT_WARNING_RIGHT -> {
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
}
|
||||
ALERT_WARNING_BOTTOM -> {
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
}
|
||||
ALERT_WARNING_LEFT -> {
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
ALERT_WARNING_TOP_RIGHT -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
}
|
||||
ALERT_WARNING_BOTTOM_RIGHT -> {
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
}
|
||||
ALERT_WARNING_BOTTOM_LEFT -> {
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
ALERT_WARNING_TOP_LEFT -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
ALERT_WARNING_ALL -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
else -> {
|
||||
Log.d("XXX", "Not Support Direction")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,6 @@ import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshCallback
|
||||
import com.mogo.eagle.core.function.v2x.events.observer.V2XOptimalRouteObserver
|
||||
import com.mogo.eagle.core.function.v2x.events.receiver.SceneBroadcastReceiver
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.V2XScenarioManager
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.park.V2XIllegalParkWindow
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.*
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
@@ -133,12 +132,6 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
return false
|
||||
}
|
||||
})
|
||||
it.registerMogoMarkerClickListener(MODULE_NAME, object : IMogoMarkerClickListener {
|
||||
override fun onMarkerClicked(marker: IMogoMarker?): Boolean {
|
||||
handleIllegalParkMarkerClick(marker)
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
BridgeApi.statusManager()?.let {
|
||||
it.registerStatusChangedListener(MODULE_NAME, ACC_STATUS, this)
|
||||
@@ -187,22 +180,6 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
return accState == 1
|
||||
}
|
||||
|
||||
private fun handleIllegalParkMarkerClick(marker: IMogoMarker?) {
|
||||
try {
|
||||
marker ?: return
|
||||
val markerExploreWay = (marker.getObject() as? MarkerShowEntity)?.bindObj as? MarkerExploreWay
|
||||
Logger.d(MODULE_NAME, "V2X===违章停车:onMarkerClicked=$markerExploreWay")
|
||||
|
||||
//直接展示弹窗
|
||||
markerExploreWay?.let {
|
||||
val parkScenario = V2XIllegalParkWindow()
|
||||
parkScenario.show(it, false)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleRoadConditionMarkerClick(marker: IMogoMarker?) {
|
||||
Log.d(TAG, "onMarkerClicked2222") //点击的marker的具体数据
|
||||
//点击的marker的具体数据
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XEventUgcVH;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XFatigueDrivingVH;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XIllegalParkVH;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XLiveVideoVH;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XOtherSeekHelpVH;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XPushEventVH;
|
||||
//import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XRoadEventVH;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XRecommendRouteVH;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/3/11 4:05 PM
|
||||
* desc : V2X 场景事件列表中的数据适配器
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private List<V2XEventShowEntity> itemList;
|
||||
|
||||
// 当前展示条目绑定的window
|
||||
private IV2XWindow mV2XWindow;
|
||||
|
||||
public V2XRoadEventAdapter(List<V2XEventShowEntity> itemList, IV2XWindow v2XWindow) {
|
||||
this.itemList = itemList;
|
||||
this.mV2XWindow = v2XWindow;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
RecyclerView.ViewHolder holder = null;
|
||||
switch (viewType) {
|
||||
// 直播
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING:
|
||||
holder = new V2XLiveVideoVH(parent, mV2XWindow);
|
||||
break;
|
||||
// //道路事件详情
|
||||
// case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
|
||||
// holder = new V2XRoadEventVH(parent, mV2XWindow);
|
||||
// break;
|
||||
//违章停车
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
|
||||
holder = new V2XIllegalParkVH(parent, mV2XWindow);
|
||||
break;
|
||||
//推送展示
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
|
||||
holder = new V2XPushEventVH(parent, mV2XWindow);
|
||||
break;
|
||||
//疲劳驾驶
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
|
||||
holder = new V2XFatigueDrivingVH(parent, mV2XWindow);
|
||||
break;
|
||||
//他人故障求助
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
|
||||
holder = new V2XOtherSeekHelpVH(parent, mV2XWindow);
|
||||
break;
|
||||
//道路事件UGC
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
|
||||
holder = new V2XEventUgcVH(parent, mV2XWindow);
|
||||
break;
|
||||
//线路推荐
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE:
|
||||
holder = new V2XRecommendRouteVH(parent, mV2XWindow);
|
||||
break;
|
||||
}
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (holder instanceof V2XLiveVideoVH) {
|
||||
((V2XLiveVideoVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
// if (holder instanceof V2XRoadEventVH) {
|
||||
// ((V2XRoadEventVH) holder).initView(itemList.get(position));
|
||||
// }
|
||||
if (holder instanceof V2XIllegalParkVH) {
|
||||
((V2XIllegalParkVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
if (holder instanceof V2XPushEventVH) {
|
||||
((V2XPushEventVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
if (holder instanceof V2XFatigueDrivingVH) {
|
||||
((V2XFatigueDrivingVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
if (holder instanceof V2XEventUgcVH) {
|
||||
((V2XEventUgcVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
if (holder instanceof V2XOtherSeekHelpVH) {
|
||||
((V2XOtherSeekHelpVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
if (holder instanceof V2XRecommendRouteVH) {
|
||||
((V2XRecommendRouteVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return itemList.get(position).getViewType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return itemList == null ? 0 : itemList.size();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,247 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter.holder;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.ChartingUtil;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.RoadConditionUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.TrackUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.V2XEventZanData;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||
import com.zhidao.carchattingprovider.ICarsChattingProvider;
|
||||
import com.zhidao.carchattingprovider.MogoDriverInfo;
|
||||
|
||||
/**
|
||||
* V2X展示视图公用的实现
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public abstract class V2XBaseViewHolder<T>
|
||||
extends RecyclerView.ViewHolder
|
||||
implements IMogoNaviListener {
|
||||
|
||||
private static final String TAG = "V2XBaseViewHolder";
|
||||
private ICarsChattingProvider mCarsChattingProvider;
|
||||
|
||||
// 当前展示条目绑定的window
|
||||
protected IV2XWindow mV2XWindow;
|
||||
|
||||
public V2XBaseViewHolder(@NonNull View itemView, IV2XWindow v2XWindow) {
|
||||
super(itemView);
|
||||
mV2XWindow = v2XWindow;
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充View视图
|
||||
*
|
||||
* @param viewData 与视图绑定的数据
|
||||
*/
|
||||
public abstract void initView(T viewData);
|
||||
|
||||
/**
|
||||
* 延迟关闭窗体视图
|
||||
*/
|
||||
public void delayedCloseWindow() {
|
||||
itemView.post(() -> {
|
||||
if (mV2XWindow != null) {
|
||||
mV2XWindow.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 点赞
|
||||
*/
|
||||
public void triggerZan(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice("已点赞", null);
|
||||
showTip("已点赞");
|
||||
if (noveltyInfo != null) {
|
||||
// 调用网络API接口
|
||||
|
||||
V2XRefreshModel refreshModel = BridgeApi.INSTANCE.refreshModel();
|
||||
if (refreshModel != null) {
|
||||
refreshModel.giveLikeLiveVideo(null, noveltyInfo.getSn());
|
||||
}
|
||||
V2XEventZanData v2XEventZanData = new V2XEventZanData();
|
||||
v2XEventZanData.setEventId(noveltyInfo.getInfoId());
|
||||
v2XEventZanData.setTriggerTime(TimeUtils.getNowMills());
|
||||
V2XSQLiteUtils.saveEventZanLocalStory(v2XEventZanData);
|
||||
|
||||
|
||||
// 上报数据统计
|
||||
TrackUtils.trackV2xRoadEvent(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getSn(),
|
||||
V2XConst.V2X_ROAD_ZAN);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
public void triggerIVReportHead(MarkerExploreWay noveltyInfo) {
|
||||
Log.d(TAG, "点击头像" + mCarsChattingProvider);
|
||||
try {
|
||||
mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation();
|
||||
MogoDriverInfo mogoDriverInfo = new MogoDriverInfo();
|
||||
int ageNumber = noveltyInfo.getUserInfo().getAgeNumber();
|
||||
mogoDriverInfo.setAge(ageNumber);
|
||||
String gender = noveltyInfo.getUserInfo().getGender();
|
||||
mogoDriverInfo.setGender(gender);
|
||||
String sn = noveltyInfo.getUserInfo().getSn();
|
||||
mogoDriverInfo.setSn(sn != null ? sn : "");
|
||||
String name = noveltyInfo.getUserInfo().getUserName();
|
||||
mogoDriverInfo.setUserName(name != null ? name : "");
|
||||
mogoDriverInfo.setUserHead(noveltyInfo.getUserInfo().getUserHead());
|
||||
if (mCarsChattingProvider != null) {
|
||||
mCarsChattingProvider.showUserWindow(MODULE_NAME, mogoDriverInfo, this.itemView.getContext());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "点击头像发生错误--triggerIVReportHead" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打电话
|
||||
*/
|
||||
public void triggerCallChart(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(noveltyInfo.getLocation().getLat());
|
||||
location.setLon(noveltyInfo.getLocation().getLon());
|
||||
|
||||
ChartingUtil.callChatting(noveltyInfo.getUserInfo(), location);
|
||||
|
||||
TrackUtils.trackV2xRoadEvent(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getSn(),
|
||||
V2XConst.V2X_ROAD_CHAT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
TipToast.tip("用户信息异常");
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况错误
|
||||
*/
|
||||
public void triggerReportErr(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getPoiType(),
|
||||
3);
|
||||
|
||||
TrackUtils.trackV2xRoadEvent(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getSn(),
|
||||
V2XConst.V2X_ROAD_REPORT_ERROR);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
TipToast.tip("路况信息异常");
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况正确
|
||||
*/
|
||||
public void triggerReportTrue(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getPoiType(),
|
||||
2);
|
||||
|
||||
TrackUtils.trackV2xRoadEvent(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getSn(),
|
||||
V2XConst.V2X_ROAD_REPORT_RIGHT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
TipToast.tip("路况信息异常");
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
public void triggerCancel(){
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 显示自定义 Toast
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public void showTip(String msg) {
|
||||
TipToast.tip(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviFailure() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
Logger.w(TAG, "onCalculateSuccess");
|
||||
IMogoRegisterCenter registerCenter = BridgeApi.INSTANCE.registerCenter();
|
||||
|
||||
if (registerCenter != null) {
|
||||
registerCenter.unregisterMogoNaviListener(MODULE_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onoCalculateFailed() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,209 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter.holder;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/3/11 4:35 PM
|
||||
* desc : 道路事件UGC
|
||||
* 需求地址
|
||||
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XEventUgcVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
private final String TAG = "V2XEventUgcVH";
|
||||
|
||||
// 语音控制反馈 YES
|
||||
private V2XVoiceCallbackListener mFeedBackYes = (command, intent) -> manualMarkingTrafficJam(1);
|
||||
// 语音控制反馈 NO
|
||||
private V2XVoiceCallbackListener mFeedBackNo = (command, intent) -> manualMarkingTrafficJam(0);
|
||||
|
||||
|
||||
private ImageView ivEventTypeIcon;
|
||||
private TextView tvEventUgcTitle;
|
||||
private ImageView ivEventReportTrue;
|
||||
private ImageView ivEventReportErr;
|
||||
|
||||
// 当前的新鲜事儿信息
|
||||
private MarkerExploreWay mNoveltyInfo;
|
||||
private V2XRoadEventEntity mV2XRoadEventEntity;
|
||||
private V2XEventShowEntity mV2XEventShowEntity;
|
||||
|
||||
public V2XEventUgcVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.item_v2x_event_ugc, viewGroup, false)
|
||||
, v2XWindow);
|
||||
ivEventTypeIcon = itemView.findViewById(R.id.ivEventTypeIcon);
|
||||
tvEventUgcTitle = itemView.findViewById(R.id.tvEventUgcTitle);
|
||||
ivEventReportTrue = itemView.findViewById(R.id.ivEventReportTrue);
|
||||
ivEventReportErr = itemView.findViewById(R.id.ivEventReportErr);
|
||||
|
||||
// 设置视图状态监听
|
||||
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
|
||||
@Override
|
||||
public void onViewAttachedToWindow(View v) {
|
||||
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(View v) {
|
||||
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewDetachedFromWindow");
|
||||
unRegisterVoice();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void unRegisterVoice() {
|
||||
// 反注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_YONG_DU_YES_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_YONG_DU_NO_UN_WAKEUP)
|
||||
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_FENG_LU_YES_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_FENG_LU_NO_UN_WAKEUP)
|
||||
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GU_YES_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GU_NO_UN_WAKEUP)
|
||||
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_YES_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XEventShowEntity) {
|
||||
try {
|
||||
Log.w(MODULE_NAME + "_" + TAG, "v2XEventShowEntity=" + GsonUtil.jsonFromObject(v2XEventShowEntity));
|
||||
if (v2XEventShowEntity == null) {
|
||||
return;
|
||||
}
|
||||
mV2XEventShowEntity = v2XEventShowEntity;
|
||||
mV2XRoadEventEntity = v2XEventShowEntity.getV2XRoadEventEntity();
|
||||
|
||||
if (mV2XRoadEventEntity == null) {
|
||||
return;
|
||||
}
|
||||
mNoveltyInfo = mV2XRoadEventEntity.getNoveltyInfo();
|
||||
|
||||
if (mNoveltyInfo != null) {
|
||||
|
||||
Object[] ugcTitleStr = EventTypeEnum.getUgcTitleStr(mNoveltyInfo.getPoiType());
|
||||
|
||||
if (ugcTitleStr != null) {
|
||||
tvEventUgcTitle.setText(((String) ugcTitleStr[0]).replace("####", mNoveltyInfo.getAddr()));
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice((String) ugcTitleStr[1], new IMogoVoiceCmdCallBack() {
|
||||
@Override
|
||||
public void onSpeakEnd(String speakText) {
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.registerUnWakeVoice((String) ugcTitleStr[3], mFeedBackYes)
|
||||
.registerUnWakeVoice((String) ugcTitleStr[4], mFeedBackNo);
|
||||
}
|
||||
});
|
||||
ivEventTypeIcon.setImageResource((Integer) ugcTitleStr[2]);
|
||||
|
||||
// UGC 问答数据统计
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("content", (String) ugcTitleStr[1]);
|
||||
IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics();
|
||||
if (analytics != null) {
|
||||
analytics.track(V2XConst.V2X_ASK_ALERT, properties);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ivEventReportTrue.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
manualMarkingTrafficJam(1);
|
||||
}
|
||||
});
|
||||
ivEventReportErr.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
manualMarkingTrafficJam(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// UGC 提问回答或消失
|
||||
private void dataStatistics(int result) {
|
||||
IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics();
|
||||
if (analytics == null) {
|
||||
return;
|
||||
}
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("result", result);
|
||||
analytics.track(V2XConst.V2X_ASK_RESULT, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对道路事件进行反馈
|
||||
*/
|
||||
void manualMarkingTrafficJam(int status) {
|
||||
unRegisterVoice();
|
||||
|
||||
if (status == 1) {
|
||||
// // 上报事故
|
||||
// TanluUploadParams params =
|
||||
// new TanluUploadParams(
|
||||
// mNoveltyInfo.getPoiType(),
|
||||
// IMogoTanluProvider.UPLOAD_FROM_STRATEGY_UGC,
|
||||
// mNoveltyInfo.getInfoIdInt(),
|
||||
// new MogoLatLng(mNoveltyInfo.getLocation().getLat(),
|
||||
// mNoveltyInfo.getLocation().getLon())
|
||||
// );
|
||||
// IMogoTanluProvider tanlu = BridgeApi.INSTANCE.tanlu();
|
||||
// if (tanlu != null) {
|
||||
// tanlu.uploadRoadCondition(params);
|
||||
// }
|
||||
dataStatistics(1);
|
||||
} else if (status == 0) {
|
||||
dataStatistics(2);
|
||||
}
|
||||
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice("谢谢,您的反馈将帮助更多车友。", null);
|
||||
V2XRefreshModel v2XRefreshModel = BridgeApi.INSTANCE.refreshModel();
|
||||
v2XRefreshModel
|
||||
.manualMarkingTrafficJam(
|
||||
mNoveltyInfo.getInfoId(),
|
||||
status,
|
||||
"0");
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter.holder;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.LocationUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
|
||||
import com.mogo.eagle.core.utilcode.util.SpanUtils;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.service.Utils;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
|
||||
/**
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/3/11 4:35 PM
|
||||
* desc : 疲劳驾驶
|
||||
* version: 1.0
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XFatigueDrivingVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
|
||||
private TextView mTvAddress, mTvAddressDistance;
|
||||
private ImageView mIvClose;
|
||||
private MarkerExploreWay mNoveltyInfo;
|
||||
private V2XPushMessageEntity mV2XPushMessageEntity;
|
||||
|
||||
// 语音控制导航
|
||||
private V2XVoiceCallbackListener mNaviCancel = (command, intent) -> triggerCancel();
|
||||
|
||||
public V2XFatigueDrivingVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.item_v2x_fatigue_driving, viewGroup, false)
|
||||
, v2XWindow);
|
||||
mTvAddress = itemView.findViewById(R.id.tvAddress);
|
||||
mTvAddressDistance = itemView.findViewById(R.id.tvAddressDistance);
|
||||
mIvClose = itemView.findViewById(R.id.ivClose);
|
||||
mIvClose.setOnClickListener(v -> delayedCloseWindow());
|
||||
|
||||
// 设置视图状态监听
|
||||
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
|
||||
@Override
|
||||
public void onViewAttachedToWindow(View v) {
|
||||
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow");
|
||||
V2XVoiceManager.INSTANCE
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_CANCEL_NAVI_UN_WAKEUP,mNaviCancel);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(View v) {
|
||||
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewDetachedFromWindow");
|
||||
// 反注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP);
|
||||
V2XVoiceManager.INSTANCE
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_V2X_CANCEL_NAVI_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_CANCEL_NAVI_UN_WAKEUP);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XEventShowEntity) {
|
||||
mV2XPushMessageEntity = v2XEventShowEntity.getV2XPushMessageEntity();
|
||||
try {
|
||||
MarkerLocation markerLocation = new MarkerLocation();
|
||||
markerLocation.setLon(mV2XPushMessageEntity.getLon());
|
||||
markerLocation.setLat(mV2XPushMessageEntity.getLat());
|
||||
mNoveltyInfo = new MarkerExploreWay();
|
||||
mNoveltyInfo.setLocation(markerLocation);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(mV2XPushMessageEntity.getAddress())) {
|
||||
mTvAddress.setText(mV2XPushMessageEntity.getAddress());
|
||||
} else {
|
||||
mTvAddress.setText("");
|
||||
}
|
||||
// 计算距离
|
||||
float calculateDistance = Utils.calculateLineDistance(
|
||||
new MogoLatLng(mV2XPushMessageEntity.getLat(), mV2XPushMessageEntity.getLon()),
|
||||
LocationUtils.getCurrentLatLon()
|
||||
);
|
||||
mV2XPushMessageEntity.setDistance(calculateDistance);
|
||||
|
||||
SpanUtils.with(mTvAddressDistance)
|
||||
.append("" + (int) mV2XPushMessageEntity.getDistance())
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
|
||||
.append("米")
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
|
||||
.create();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter.holder;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.RoadConditionUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.view.HeartLikeView;
|
||||
import com.mogo.eagle.core.function.v2x.events.view.HeartUnLikeView;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
/**
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/3/11 4:35 PM
|
||||
* desc : 违章停车弹窗
|
||||
* version: 1.0
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XIllegalParkVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
private TextView mAddressTv;
|
||||
private TextView mIllegalNumTv;
|
||||
private HeartLikeView mIlIllegalParkingLike;
|
||||
private HeartUnLikeView mIIllegalParkingUnLike;
|
||||
|
||||
private MarkerExploreWay mExploreWay;
|
||||
|
||||
// 反馈按钮语音操控
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackYouYongListener = (command, intent) -> roadReportTrue();
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackMeiYongListener = (command, intent) -> roadReportErr();
|
||||
|
||||
public V2XIllegalParkVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(BridgeApi.INSTANCE.statusManager() != null && BridgeApi.INSTANCE.statusManager().isVrMode() ?
|
||||
R.layout.item_v2x_illegal_parking_vr :
|
||||
R.layout.item_v2x_illegal_parking, viewGroup, false)
|
||||
, v2XWindow);
|
||||
|
||||
mAddressTv = itemView.findViewById(R.id.tvAddress);
|
||||
mIllegalNumTv = itemView.findViewById(R.id.tvIllegalNum);
|
||||
mIlIllegalParkingLike = itemView.findViewById(R.id.llIllegalParkingLike);
|
||||
mIIllegalParkingUnLike = itemView.findViewById(R.id.llIllegalParkingUnLike);
|
||||
|
||||
// 设置视图状态监听
|
||||
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
|
||||
@Override
|
||||
public void onViewAttachedToWindow(View v) {
|
||||
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow");
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP,
|
||||
v2XVoiceCallbackYouYongListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP,
|
||||
v2XVoiceCallbackMeiYongListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(View v) {
|
||||
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewDetachedFromWindow");
|
||||
IMogoRegisterCenter registerCenter = BridgeApi.INSTANCE.registerCenter();
|
||||
if (registerCenter != null) {
|
||||
registerCenter.unregisterMogoNaviListener(MODULE_NAME);
|
||||
}
|
||||
// 反注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XEventShowEntity) {
|
||||
mExploreWay = v2XEventShowEntity.getV2XIllegalPark();
|
||||
mAddressTv.setText(mExploreWay.getAddr());
|
||||
try {
|
||||
mIllegalNumTv.setText("违章人数:" + (int) mExploreWay.getItems().get(0).getIllegalCount());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
mIlIllegalParkingLike.setOnClickCallListener(v -> {
|
||||
Logger.d(V2XConst.MODULE_NAME, "反馈有用");
|
||||
roadReportTrue();
|
||||
});
|
||||
|
||||
mIIllegalParkingUnLike.setOnClickCallListener(v -> {
|
||||
Logger.d(V2XConst.MODULE_NAME, "反馈无用");
|
||||
roadReportErr();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 延迟关闭窗体
|
||||
*/
|
||||
@Override
|
||||
public void delayedCloseWindow() {
|
||||
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
|
||||
v2XHistoryScenarioData.setScenarioType(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING);
|
||||
v2XHistoryScenarioData.setEventJsonData(GsonUtil.jsonFromObject(mExploreWay));
|
||||
v2XHistoryScenarioData.setEventJsonDataHashCode(mExploreWay.hashCode());
|
||||
//V2XSQLiteUtils.updateScenarioHistoryDataIsDispose(v2XHistoryScenarioData);
|
||||
super.delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况正确
|
||||
*/
|
||||
private void roadReportTrue() {
|
||||
if (mExploreWay != null) {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
mExploreWay.getInfoId(),
|
||||
mExploreWay.getPoiType(),
|
||||
2);
|
||||
}
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
if (!isVrMode) {
|
||||
delayedCloseWindow();
|
||||
} else {
|
||||
mIlIllegalParkingLike.setClickable(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况错误
|
||||
*/
|
||||
private void roadReportErr() {
|
||||
if (mExploreWay != null) {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
mExploreWay.getInfoId(),
|
||||
mExploreWay.getPoiType(),
|
||||
3);
|
||||
}
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
if (!isVrMode) {
|
||||
delayedCloseWindow();
|
||||
} else {
|
||||
mIIllegalParkingUnLike.setClickable(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter.holder;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.TrackUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.view.V2XLiveGSYVideoView;
|
||||
import com.mogo.module.common.entity.MarkerCarInfo;
|
||||
import com.mogo.module.common.entity.MarkerUserInfo;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XLiveCarInfoEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/3/11 4:35 PM
|
||||
* desc : 直播类型的卡片
|
||||
* version: 1.0
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XLiveVideoVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
|
||||
private V2XLiveGSYVideoView videoPlayer;
|
||||
private MogoImageView ivReportHead;
|
||||
|
||||
// 上传事件的用户信息
|
||||
private MarkerUserInfo mUserInfo = new MarkerUserInfo();
|
||||
// 直播车机数据
|
||||
private V2XLiveCarInfoEntity mV2XLiveCarEntity;
|
||||
// 预警的道路事件数据
|
||||
private V2XRoadEventEntity mV2XRoadEventEntity;
|
||||
|
||||
public V2XLiveVideoVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
|
||||
super(LayoutInflater.from(viewGroup.getContext()).inflate(BridgeApi.INSTANCE.statusManager() != null && BridgeApi.INSTANCE.statusManager().isVrMode() ?
|
||||
R.layout.item_v2x_live_video_vr : R.layout.item_v2x_live_video, viewGroup, false), v2XWindow);
|
||||
videoPlayer = itemView.findViewById(R.id.videoPlayer);
|
||||
ivReportHead = itemView.findViewById(R.id.ivReportHead);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XLiveCarEntity) {
|
||||
mV2XRoadEventEntity = v2XLiveCarEntity.getV2XRoadEventEntity();
|
||||
mV2XLiveCarEntity = v2XLiveCarEntity.getV2XLiveCarInfoRes();
|
||||
initView(mV2XLiveCarEntity);
|
||||
}
|
||||
|
||||
public void initView(V2XLiveCarInfoEntity v2XLiveCarEntity) {
|
||||
mV2XLiveCarEntity = v2XLiveCarEntity;
|
||||
// 由于车机自身推流的原因,这里为了浪费用户不必要的流量,用户滑动到了那个view展示了再进行直播信息的获取及展示
|
||||
MarkerCarInfo.CarLiveInfo carLiveInfo = new MarkerCarInfo.CarLiveInfo();
|
||||
carLiveInfo.setVideoSn(v2XLiveCarEntity.getSn());
|
||||
videoPlayer.setCarLiveInfo(carLiveInfo);
|
||||
TrackUtils.trackV2xRoadEvent(mV2XRoadEventEntity.getNoveltyInfo().getInfoId(), v2XLiveCarEntity.getSn(), V2XConst.V2X_ROAD_VIDEO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,231 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter.holder;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.ChartingUtil;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.V2XUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
|
||||
import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform;
|
||||
import com.mogo.eagle.core.utilcode.util.SpanUtils;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerUserInfo;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/3/11 4:35 PM
|
||||
* desc : 他人故障求助Window
|
||||
* version: 1.0
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
|
||||
private Context mContext;
|
||||
private MogoImageView ivHead;
|
||||
private TextView tvName;
|
||||
private TextView tvDistance;
|
||||
private TextView tvEventTime;
|
||||
private ImageView ivCall;
|
||||
|
||||
private V2XPushMessageEntity mV2XPushMessageEntity;
|
||||
private MarkerExploreWay mNoveltyInfo;
|
||||
|
||||
// 上传事件的用户信息
|
||||
private MarkerUserInfo mUserInfo = new MarkerUserInfo();
|
||||
// 语音控制拨打电话
|
||||
private V2XVoiceCallbackListener mCallChartingCb = (command, intent) -> {
|
||||
try {
|
||||
mNoveltyInfo.setUserInfo(mUserInfo);
|
||||
triggerCallChart(mNoveltyInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
};
|
||||
// 查看车辆信息
|
||||
private V2XVoiceCallbackListener mVoiceOpenCarInfoLis = ((command, intent) -> triggerIVReportHead(mNoveltyInfo));
|
||||
|
||||
public V2XOtherSeekHelpVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(BridgeApi.INSTANCE.statusManager() != null && BridgeApi.INSTANCE.statusManager().isVrMode() ?
|
||||
R.layout.item_v2x_fault_help_vr :
|
||||
R.layout.item_v2x_fault_help, viewGroup, false)
|
||||
, v2XWindow);
|
||||
mContext = viewGroup.getContext();
|
||||
ivHead = itemView.findViewById(R.id.ivFaultHelpHead);
|
||||
tvName = itemView.findViewById(R.id.tvFaultHelpName);
|
||||
tvDistance = itemView.findViewById(R.id.tvFaultHelpDistance);
|
||||
tvEventTime = itemView.findViewById(R.id.tvFaultHelpEventTime);
|
||||
ivCall = itemView.findViewById(R.id.ivFaultHelpEventCall);
|
||||
|
||||
// 设置视图状态监听
|
||||
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
|
||||
@Override
|
||||
public void onViewAttachedToWindow(View v) {
|
||||
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow");
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING,
|
||||
mCallChartingCb)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP,
|
||||
mCallChartingCb)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_CAR_INFO_UN_WAKEUP,
|
||||
mVoiceOpenCarInfoLis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(View v) {
|
||||
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewDetachedFromWindow");
|
||||
// 反注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_CAR_INFO_UN_WAKEUP);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XEventShowEntity) {
|
||||
mV2XPushMessageEntity = v2XEventShowEntity.getV2XPushMessageEntity();
|
||||
try {
|
||||
mUserInfo.setSn(mV2XPushMessageEntity.getSn());
|
||||
mUserInfo.setUserHead(mV2XPushMessageEntity.getHeadImgUrl());
|
||||
mUserInfo.setUserName(mV2XPushMessageEntity.getDisplayName());
|
||||
mUserInfo.setGender(mV2XPushMessageEntity.getSex());
|
||||
mUserInfo.setAge(30);
|
||||
|
||||
MarkerLocation markerLocation = new MarkerLocation();
|
||||
markerLocation.setLon(mV2XPushMessageEntity.getLon());
|
||||
markerLocation.setLat(mV2XPushMessageEntity.getLat());
|
||||
mNoveltyInfo = new MarkerExploreWay();
|
||||
mNoveltyInfo.setLocation(markerLocation);
|
||||
mNoveltyInfo.setUserInfo(mUserInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// M1低配车机限制
|
||||
// 不展示打电话按钮
|
||||
// 不能查看用户详情
|
||||
if (DebugConfig.isMapBased()) {
|
||||
ivHead.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
triggerIVReportHead(mNoveltyInfo);
|
||||
}
|
||||
});
|
||||
// 只有自研车机才会 有车聊聊通话
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
||||
// 判断是否可以打电话
|
||||
ChartingUtil.isCanCall(b -> {
|
||||
if (b) {
|
||||
// 判断是否可以打电话
|
||||
ChartingUtil.isOnLine(mV2XPushMessageEntity.getSn(), b1 -> {
|
||||
if (b1) {
|
||||
ivCall.setVisibility(VISIBLE);
|
||||
} else {
|
||||
ivCall.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ivCall.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
|
||||
ivCall.setOnClickListener(v -> {
|
||||
V2XRefreshModel v2XRefreshModel = BridgeApi.INSTANCE.refreshModel();
|
||||
if (v2XRefreshModel != null) {
|
||||
v2XRefreshModel.respondingToHelp(mUserInfo.getSn());
|
||||
}
|
||||
|
||||
if (!V2XUtils.isFastClick()) {
|
||||
try {
|
||||
triggerCallChart(mNoveltyInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (!TextUtils.isEmpty(mV2XPushMessageEntity.getHeadImgUrl())) {
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
if (isVrMode) {
|
||||
Glide.with(mContext).load(mV2XPushMessageEntity.getHeadImgUrl()).apply(RequestOptions.bitmapTransform(
|
||||
new GlideRoundedCornersTransform(20, GlideRoundedCornersTransform.CornerType.LEFT))).into(ivHead);
|
||||
} else {
|
||||
IMogoImageloader imageLoader = BridgeApi.INSTANCE.imageLoader();
|
||||
if (imageLoader != null) {
|
||||
imageLoader.displayImage(mV2XPushMessageEntity.getHeadImgUrl(), ivHead);
|
||||
}
|
||||
}
|
||||
}
|
||||
tvName.setText(mV2XPushMessageEntity.getDisplayName());
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
if (mV2XPushMessageEntity.getDistance() > 1000) {
|
||||
|
||||
SpanUtils.with(tvDistance)
|
||||
.append("" + (int) mV2XPushMessageEntity.getDistance() / 1000)
|
||||
.setFontSize((int) itemView.getResources().getDimension(isVrMode ? R.dimen.module_v2x_fault_help_distance_text_size : R.dimen.module_v2x_event_distance_text))
|
||||
.append("公里")
|
||||
.setFontSize((int) itemView.getResources().getDimension(isVrMode ? R.dimen.dp_42 : R.dimen.module_v2x_event_distance_title))
|
||||
.create();
|
||||
} else {
|
||||
SpanUtils.with(tvDistance)
|
||||
.append("" + (int) mV2XPushMessageEntity.getDistance())
|
||||
.setFontSize((int) itemView.getResources().getDimension(isVrMode ? R.dimen.module_v2x_fault_help_distance_text_size : R.dimen.module_v2x_event_distance_text))
|
||||
.append("米")
|
||||
.setFontSize((int) itemView.getResources().getDimension(
|
||||
isVrMode ?
|
||||
R.dimen.dp_42 : R.dimen.module_v2x_event_distance_title))
|
||||
.create();
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA);
|
||||
String eventTime = String.format("%s发布求助信息",
|
||||
sdf.format(new Date(mV2XPushMessageEntity.getCreateTime())));
|
||||
tvEventTime.setText(eventTime);
|
||||
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter.holder;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerUserInfo;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/3/11 4:35 PM
|
||||
* desc : TODO 这里是前瞻演示需求,推送的消息,
|
||||
* version: 1.0
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
private MogoImageView ivImg;
|
||||
private MogoImageView ivReportHead;
|
||||
|
||||
// 控制按钮
|
||||
private ImageView ivRoadReportTrue;
|
||||
private ImageView ivRoadReportErr;
|
||||
private ImageView ivRoadCallChart;
|
||||
private ImageView ivRoadEventLike;
|
||||
|
||||
// 上传事件的用户信息
|
||||
private MarkerUserInfo mUserInfo = new MarkerUserInfo();
|
||||
|
||||
private V2XPushMessageEntity mV2XRoadEventEntity;
|
||||
private MarkerExploreWay mNoveltyInfo;
|
||||
|
||||
// 语音控制拨打电话
|
||||
private V2XVoiceCallbackListener mCallChartingCb = (command, intent) -> {
|
||||
try {
|
||||
mUserInfo.setSn(mV2XRoadEventEntity.getSn());
|
||||
mUserInfo.setUserHead(mV2XRoadEventEntity.getHeadImgUrl());
|
||||
mUserInfo.setUserName("蘑菇用户");
|
||||
mUserInfo.setGender("男");
|
||||
mUserInfo.setAge(30);
|
||||
mNoveltyInfo.setUserInfo(mUserInfo);
|
||||
triggerCallChart(mNoveltyInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
};
|
||||
// 点赞语音回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackLickListener = (command, intent) -> triggerZan(mNoveltyInfo);
|
||||
|
||||
public V2XPushEventVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.item_v2x_push_event_detail, viewGroup, false)
|
||||
, v2XWindow);
|
||||
ivImg = itemView.findViewById(R.id.ivImg);
|
||||
ivReportHead = itemView.findViewById(R.id.ivReportHead);
|
||||
|
||||
ivRoadReportTrue = itemView.findViewById(R.id.ivRoadReportTrue);
|
||||
ivRoadReportErr = itemView.findViewById(R.id.ivRoadReportErr);
|
||||
ivRoadCallChart = itemView.findViewById(R.id.ivRoadCallChart);
|
||||
ivRoadEventLike = itemView.findViewById(R.id.ivRoadEventLike);
|
||||
|
||||
ivRoadCallChart.setOnClickListener(v -> {
|
||||
try {
|
||||
mUserInfo.setSn(mV2XRoadEventEntity.getSn());
|
||||
mUserInfo.setUserHead(mV2XRoadEventEntity.getHeadImgUrl());
|
||||
mUserInfo.setUserName("蘑菇用户");
|
||||
mUserInfo.setGender("男");
|
||||
mUserInfo.setAge(30);
|
||||
mNoveltyInfo.setUserInfo(mUserInfo);
|
||||
triggerCallChart(mNoveltyInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
ivRoadEventLike.setOnClickListener(v -> triggerZan(mNoveltyInfo));
|
||||
|
||||
// 设置视图状态监听
|
||||
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
|
||||
@Override
|
||||
public void onViewAttachedToWindow(View v) {
|
||||
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow");
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING,
|
||||
mCallChartingCb)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP,
|
||||
mCallChartingCb)
|
||||
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN,
|
||||
v2XVoiceCallbackLickListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP,
|
||||
v2XVoiceCallbackLickListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(View v) {
|
||||
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewDetachedFromWindow");
|
||||
IMogoRegisterCenter registerCenter = BridgeApi.INSTANCE.registerCenter();
|
||||
if (registerCenter != null) {
|
||||
registerCenter.unregisterMogoNaviListener(MODULE_NAME);
|
||||
}
|
||||
// 反注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP)
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP)
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN)
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REPORT)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_TRUE)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_ERROR)
|
||||
.unRegisterPagingCallback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XEventShowEntity) {
|
||||
mV2XRoadEventEntity = v2XEventShowEntity.getV2XPushMessageEntity();
|
||||
mNoveltyInfo = new MarkerExploreWay();
|
||||
mNoveltyInfo.setSn(mV2XRoadEventEntity.getSn());
|
||||
mNoveltyInfo.setInfoId(mV2XRoadEventEntity.getSceneId());
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(mV2XRoadEventEntity.getLat());
|
||||
location.setLon(mV2XRoadEventEntity.getLon());
|
||||
mNoveltyInfo.setLocation(location);
|
||||
|
||||
if (!TextUtils.isEmpty(mV2XRoadEventEntity.getMsgImgUrl())) {
|
||||
IMogoImageloader imageloader = BridgeApi.INSTANCE.imageLoader();
|
||||
if (imageloader != null) {
|
||||
imageloader.displayImage(mV2XRoadEventEntity.getMsgImgUrl(), ivImg);
|
||||
}
|
||||
}
|
||||
if (!TextUtils.isEmpty(mV2XRoadEventEntity.getHeadImgUrl())) {
|
||||
IMogoImageloader imageloader = BridgeApi.INSTANCE.imageLoader();
|
||||
if (imageloader != null) {
|
||||
imageloader.displayImage(mV2XRoadEventEntity.getHeadImgUrl(), ivReportHead);
|
||||
}
|
||||
}
|
||||
|
||||
switch (mV2XRoadEventEntity.getSceneId()) {
|
||||
case "100015"://取快递
|
||||
case "100016"://顺风车
|
||||
ivRoadCallChart.setVisibility(View.VISIBLE);
|
||||
ivRoadReportTrue.setVisibility(View.GONE);
|
||||
ivRoadReportErr.setVisibility(View.GONE);
|
||||
ivRoadEventLike.setVisibility(View.GONE);
|
||||
break;
|
||||
|
||||
case "100017"://政府公告
|
||||
case "100018"://故障车辆推送
|
||||
ivRoadEventLike.setVisibility(View.VISIBLE);
|
||||
ivRoadCallChart.setVisibility(View.GONE);
|
||||
ivRoadReportTrue.setVisibility(View.GONE);
|
||||
ivRoadReportErr.setVisibility(View.GONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
package com.mogo.module.v2x.adapter.holder
|
||||
|
||||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.commons.voice.VoicePreemptType
|
||||
import com.mogo.eagle.core.function.v2x.R
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XBaseViewHolder
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.mogo.module.common.entity.MarkerExploreWay
|
||||
import com.mogo.module.common.entity.MarkerLocation
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager.registerUnWakeVoice
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager.unRegisterUnWakeVoice
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
/**
|
||||
* created by wujifei on 2020/12/31 16:10
|
||||
* describe:
|
||||
*/
|
||||
class V2XRecommendRouteVH(viewGroup: ViewGroup, v2XWindow: IV2XWindow<*>) : V2XBaseViewHolder<V2XEventShowEntity>(
|
||||
LayoutInflater.from(viewGroup.context).inflate(R.layout.item_v2x_recommend_route, viewGroup, false), v2XWindow), V2XVoiceCallbackListener {
|
||||
private var mTvAddress: TextView? = null
|
||||
private var mIvClose: ImageView? = null
|
||||
private var mNoveltyInfo: MarkerExploreWay? = null
|
||||
private val mainScope = MainScope()
|
||||
|
||||
init {
|
||||
mTvAddress = itemView.findViewById(R.id.tvAddress)
|
||||
mIvClose = itemView.findViewById(R.id.ivClose)
|
||||
mIvClose?.setOnClickListener { delayedCloseWindow() }
|
||||
itemView.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
|
||||
override fun onViewAttachedToWindow(view: View) {
|
||||
registerUnwakeNavi()
|
||||
mainScope.launch {
|
||||
delay(1000 * 20)
|
||||
delayedCloseWindow()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewDetachedFromWindow(view: View) {
|
||||
unRegisterUnwakeNavi()
|
||||
AIAssist.getInstance(Utils.getApp()).breakOffSpeak()
|
||||
mainScope.cancel()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
override fun initView(viewData: V2XEventShowEntity?) {
|
||||
viewData?.let {
|
||||
val markerLocation = MarkerLocation()
|
||||
markerLocation.lon = it.getV2XRecommendRouteEntity().toPoint.get(0)
|
||||
markerLocation.lat = it.getV2XRecommendRouteEntity().toPoint.get(1)
|
||||
mNoveltyInfo = MarkerExploreWay()
|
||||
mNoveltyInfo?.setLocation(markerLocation)
|
||||
mTvAddress!!.text = "前往 ${it.getV2XRecommendRouteEntity().formatAddress}"
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice(it.getV2XRecommendRouteEntity().tts, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, null)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onCallback(command: String?, intent: Intent?) {
|
||||
when (command) {
|
||||
V2XVoiceConstants.V2X_CANCLE_ACTION -> delayedCloseWindow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun registerUnwakeNavi() {
|
||||
registerUnWakeVoice(V2XVoiceConstants.V2X_CONFIRM_ACTION, this)
|
||||
registerUnWakeVoice(V2XVoiceConstants.V2X_CANCLE_ACTION, this)
|
||||
}
|
||||
|
||||
private fun unRegisterUnwakeNavi() {
|
||||
unRegisterUnWakeVoice(V2XVoiceConstants.V2X_CONFIRM_ACTION)
|
||||
unRegisterUnWakeVoice(V2XVoiceConstants.V2X_CANCLE_ACTION)
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,6 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.alarm;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.DrivingDirectionUtils;
|
||||
import com.mogo.eagle.core.utilcode.constant.TimeConstants;
|
||||
@@ -12,9 +8,6 @@ import com.mogo.eagle.core.utilcode.util.TimeUtils;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.service.Utils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
@@ -39,65 +32,6 @@ public class V2XAlarmServer {
|
||||
// 记录违章停车播报事件
|
||||
private static final HashMap<MarkerExploreWay, String> mAlertIllegalParkEventList = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 获取车辆的前方的违章停车事件
|
||||
*/
|
||||
public static MarkerExploreWay getIllegalParkAlarmEvent(
|
||||
ArrayList<MarkerExploreWay> v2XExploreWayEntityList,
|
||||
MogoLocation currentLocation) {
|
||||
try {
|
||||
Logger.w(MODULE_NAME, "V2X预警--车辆状态:" + currentLocation);
|
||||
// 60(km/h)
|
||||
if (currentLocation != null && v2XExploreWayEntityList != null) {
|
||||
// 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告
|
||||
for (MarkerExploreWay markerExploreWay : v2XExploreWayEntityList) {
|
||||
// 计算车辆距离
|
||||
float distance = Utils.calculateLineDistance(
|
||||
new MogoLatLng(markerExploreWay.getLocation().getLat(), markerExploreWay.getLocation().getLon()),
|
||||
new MogoLatLng(currentLocation.getLatitude(), currentLocation.getLongitude())
|
||||
);
|
||||
|
||||
Logger.w(MODULE_NAME, "V2X预警--车辆与违章道路信息:" +
|
||||
"\n当前车辆距离违章停车点:" + distance);
|
||||
|
||||
// 判断是否到达了触发距离,50 米
|
||||
if (distance <= 50) {
|
||||
Logger.w(MODULE_NAME, "V2X预警--车辆与违章道路信息:" +
|
||||
"\n违章道路名称:" + markerExploreWay.getAddr() +
|
||||
"\n车头角度:" + currentLocation.getBearing());
|
||||
|
||||
// 判断是否已经提示过道路事件
|
||||
boolean isAlreadyAlert = false;
|
||||
String lastTime = mAlertIllegalParkEventList.get(markerExploreWay);
|
||||
Logger.w(MODULE_NAME,
|
||||
"V2X预警--事件ID:" + markerExploreWay.getInfoId() +
|
||||
"\n上一次预警时间:" + lastTime);
|
||||
if (!TextUtils.isEmpty(lastTime)) {
|
||||
long timeSpan = Math.abs(TimeUtils.getTimeSpanByNow(lastTime, TimeConstants.MIN));
|
||||
Logger.w(MODULE_NAME,
|
||||
"V2X预警--事件ID:" + markerExploreWay.getInfoId() +
|
||||
"\n距离当前时间:" + timeSpan);
|
||||
// 5分钟内不重复提醒
|
||||
if (timeSpan < 5) {
|
||||
isAlreadyAlert = true;
|
||||
}
|
||||
}
|
||||
// 进行提醒
|
||||
if (!isAlreadyAlert) {
|
||||
mAlertIllegalParkEventList.put(markerExploreWay, TimeUtils.getNowString());
|
||||
return markerExploreWay;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前车辆前方距离最近的道路事件
|
||||
*/
|
||||
|
||||
@@ -73,8 +73,6 @@ internal object BridgeApi {
|
||||
|
||||
fun statusManager(): IMogoStatusManager? = apis?.statusManagerApi
|
||||
|
||||
fun topViewManager() = apis?.topViewManager
|
||||
|
||||
fun analytics() = apis?.analyticsApi
|
||||
|
||||
fun overlay() = apis?.mapServiceApi?.getOverlayManager(context())
|
||||
|
||||
@@ -48,14 +48,4 @@ public class MoGoV2XServicePaths {
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_V2X_STOP_POLYLINE_MANAGER = "/v2xStopPolylineManager/api";
|
||||
|
||||
|
||||
/**
|
||||
* V2X 云端数据处理
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_V2X_WARN_CLOUND_DATA_MANAGER = "/v2xWarnCloundDataManager/api";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,21 +9,10 @@ package com.mogo.eagle.core.function.v2x.events.consts;
|
||||
*/
|
||||
public class V2XConst {
|
||||
|
||||
public static final String T_SCENARIO_HISTORY = "t_search_poi";
|
||||
/**
|
||||
* V2X面板名称
|
||||
*/
|
||||
public static final String MODULE_NAME = "V2X_UI";
|
||||
/**
|
||||
* V2X模块地址
|
||||
*/
|
||||
public static final String PATH_V2X_UI = "/v2x/ui";
|
||||
|
||||
/**
|
||||
* 事件面板名称
|
||||
*/
|
||||
public static final String MODULE_NAME_EVENT_PANEL = "MODULE_EVENT_PANEL";
|
||||
|
||||
|
||||
/**
|
||||
* V2X 场景广播 Action
|
||||
@@ -38,7 +27,6 @@ public class V2XConst {
|
||||
|
||||
|
||||
public static final String BROADCAST_SCENE_ACTION = "com.v2x.scene_local_broadcast";
|
||||
public static final String SEEK_HELP_TIME = "seek_help_time";
|
||||
public static final String V2X_ACC_ON_TIME_STR = "v2x_acc_on_time_str";
|
||||
public static final String V2X_ACC_OFF_TIME_STR = "v2x_acc_off_time_str";
|
||||
public static final String V2X_STRATEGY_PUSH = "v2x_strategy_push";
|
||||
@@ -51,83 +39,23 @@ public class V2XConst {
|
||||
public static final String V2X_ROAD_EVET = "v2x_road_event";
|
||||
public static final String V2X_ROAD_EVET_HISTORY_BUTTON = "V2X_button_click";
|
||||
public static final String V2X_ROAD_PRODUCE = "v2x_road_produce";
|
||||
public static final String V2X_ASK_ALERT = "v2x_ask_alert";//UGC 提问
|
||||
public static final String V2X_ASK_RESULT = "v2x_ask_result";//UGC 提问回答或消失
|
||||
public static final String LAUNCHER_ICON_CLICK = "Launcher_Icon_Click";
|
||||
/**
|
||||
* V2X 道路事件操作类型
|
||||
*/
|
||||
public static final String V2X_ROAD_ZAN = "1";
|
||||
public static final String V2X_ROAD_CHAT = "2";
|
||||
public static final String V2X_ROAD_VIDEO = "3";
|
||||
public static final String V2X_ROAD_NAVI = "4";
|
||||
public static final String V2X_ROAD_REPORT_RIGHT = "5";
|
||||
public static final String V2X_ROAD_REPORT_ERROR = "6";
|
||||
|
||||
/**
|
||||
* V2X 地图上发出警告的POI
|
||||
*/
|
||||
public static final String V2X_ILLEGAL_PARK_POI = "V2X_ILLEGAL_PARK_POI";
|
||||
|
||||
/**
|
||||
* V2X 地图上发出警告的POI
|
||||
*/
|
||||
public static final String V2X_EVENT_ALARM_POI = "V2X_EVENT_ALARM_POI";
|
||||
|
||||
/**
|
||||
* V2X 探路数据
|
||||
*/
|
||||
public static final String V2X_CARD_TYPE_ROAD_CONDITION = "V2X_CARD_TYPE_ROAD_CONDITION";
|
||||
|
||||
/**
|
||||
* V2X 用户数据
|
||||
*/
|
||||
public static final String V2X_CARD_TYPE_USER_DATA = "V2X_CARD_TYPE_USER_DATA";
|
||||
|
||||
/**
|
||||
* V2X 新鲜事
|
||||
*/
|
||||
public static final String V2X_CARD_TYPE_NOVELTY = "V2X_CARD_TYPE_NOVELTY";
|
||||
|
||||
/**
|
||||
* V2X 特殊车辆
|
||||
*/
|
||||
public static final String V2X_MARKER_SPECIAL_CAR = "V2X_MARKER_SPECIAL_CAR";
|
||||
|
||||
/**
|
||||
* V2X 可直播车辆
|
||||
*/
|
||||
public static final String V2X_MARKER_LIVE_CAR = "V2X_MARKER_LIVE_CAR";
|
||||
|
||||
/**
|
||||
* V2X 取快递
|
||||
*/
|
||||
public static final String V2X_MARKER_EXPRESS = "V2X_MARKER_EXPRESS";
|
||||
|
||||
/**
|
||||
* V2X 顺风车
|
||||
*/
|
||||
public static final String V2X_MARKER_TAXI = "V2X_MARKER_TAXI";
|
||||
|
||||
/**
|
||||
* V2X 政府推送消息
|
||||
*/
|
||||
public static final String V2X_MARKER_GOVERNMENT = "V2X_MARKER_GOVERNMENT";
|
||||
|
||||
/**
|
||||
* 绿波车速marker
|
||||
*/
|
||||
public static final String V2X_OPTIMAL_SPEED_MARKER = "V2X_OPTIMAL_SPEED_MARKER";
|
||||
|
||||
/*
|
||||
*V2X 车路云前方预警-识别物
|
||||
* */
|
||||
public static final String V2X_FRONT_WARNING_MARKER = "V2X_FRONT_WARNING_MARKER";
|
||||
|
||||
/*
|
||||
*V2X 车路云前方预警-线
|
||||
* */
|
||||
public static final String V2X_FRONT_STOP_LINE = "V2X_FRONT_STOP_LINE";
|
||||
/**
|
||||
* V2X预警日志tag
|
||||
*/
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.listener;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
*/
|
||||
public interface AdapterCallback {
|
||||
//分享列表加载更多
|
||||
void loadMoreShareEventList();
|
||||
//分享列表首次刷新
|
||||
void getShareEventResponse();
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.listener;
|
||||
|
||||
import android.view.View;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/8/10
|
||||
*/
|
||||
public interface SurroundingDetailItemListener {
|
||||
|
||||
void onItemClickListener(View v, int position, MarkerExploreWay exploreWay);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.listener;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.SurroundingConstruction;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/8/10
|
||||
*/
|
||||
public interface SurroundingItemClickListener {
|
||||
void onItemClickListener(View v, int position, SurroundingConstruction construction);
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.listener;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.ChartingUtil;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/7 7:13 PM
|
||||
* desc :
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XMarkerClickListener implements IMogoMarkerClickListener {
|
||||
|
||||
private static V2XMarkerClickListener markerClickListener;
|
||||
|
||||
// 最后一次选中的气泡
|
||||
private IMogoMarker mLastCheckMarker;
|
||||
|
||||
private V2XMarkerClickListener() {
|
||||
}
|
||||
|
||||
public synchronized static V2XMarkerClickListener getInstance() {
|
||||
synchronized (V2XMarkerClickListener.class) {
|
||||
if (markerClickListener == null) {
|
||||
markerClickListener = new V2XMarkerClickListener();
|
||||
}
|
||||
}
|
||||
return markerClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
try {
|
||||
if (mLastCheckMarker != null) {
|
||||
// 判断点击的是否是同一个
|
||||
if (marker.equals(mLastCheckMarker)) {
|
||||
Logger.d(MODULE_NAME, "onMarkerClicked 与上一次点击的Marker一样,不做处理:" + marker);
|
||||
// 判断是在线车辆的时候处理打电话场景
|
||||
try {
|
||||
Object object = marker.getObject();
|
||||
if (object != null) {
|
||||
// 修改数据
|
||||
MarkerShowEntity showEntity = (MarkerShowEntity) object;
|
||||
if (showEntity.getMarkerType().equals(ServiceConst.CARD_TYPE_USER_DATA)) {
|
||||
Object bindObj = showEntity.getBindObj();
|
||||
if (bindObj instanceof MarkerOnlineCar) {
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLon(marker.getPosition().getLon());
|
||||
location.setLat(marker.getPosition().getLat());
|
||||
ChartingUtil.callChatting(
|
||||
((MarkerOnlineCar) bindObj).getUserInfo(),
|
||||
location
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// 关闭上次的气泡
|
||||
IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker();
|
||||
if (v2xMarker != null) {
|
||||
v2xMarker.closeMarker(BridgeApi.INSTANCE.context(), mLastCheckMarker);
|
||||
}
|
||||
}
|
||||
// 将当前的Marker设置为选中
|
||||
IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker();
|
||||
if (v2xMarker != null) {
|
||||
mLastCheckMarker = v2xMarker.openMarker(BridgeApi.INSTANCE.context(), marker);
|
||||
}
|
||||
|
||||
// marker点击展示上半部分的浮窗,只加了道路事件
|
||||
Object nov = marker.getObject();
|
||||
Logger.d(MODULE_NAME, "marker点击====" + nov);
|
||||
if (nov != null) {
|
||||
MarkerShowEntity showEntity = (MarkerShowEntity) nov;
|
||||
if (showEntity.getMarkerType().equals(ServiceConst.CARD_TYPE_NOVELTY)) {
|
||||
Object bindObj = showEntity.getBindObj();
|
||||
if (bindObj instanceof MarkerExploreWay) {
|
||||
MarkerExploreWay noveltyInfo = (MarkerExploreWay) bindObj;
|
||||
Logger.d(MODULE_NAME, "新鲜事marker点击===" + bindObj);
|
||||
V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity();
|
||||
v2XRoadEventEntity.setLocation(noveltyInfo.getLocation());
|
||||
v2XRoadEventEntity.setPoiType(noveltyInfo.getPoiType());
|
||||
v2XRoadEventEntity.setNoveltyInfo(noveltyInfo);
|
||||
v2XRoadEventEntity.setExpireTime(20000);
|
||||
v2XRoadEventEntity.setDistance(1000);
|
||||
//V2XServiceManager.getMoGoV2XScenarioManager().showRoadEventWindow(v2XRoadEventEntity, false);
|
||||
return true;
|
||||
}
|
||||
} else if (showEntity.getMarkerType().equals(ServiceConst.CARD_TYPE_ROAD_CONDITION)) {
|
||||
Object bindObj = showEntity.getBindObj();
|
||||
if (bindObj instanceof MarkerExploreWay) {
|
||||
MarkerExploreWay markerExploreWay = (MarkerExploreWay) bindObj;
|
||||
if (markerExploreWay.getItems().size() > 0
|
||||
&& !TextUtils.isEmpty(markerExploreWay.getItems().get(0).getUrl())) {
|
||||
Logger.d(MODULE_NAME, "MarkerExploreWay点击===" + bindObj);
|
||||
// 记录道路事件
|
||||
V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity();
|
||||
v2XRoadEventEntity.setLocation(markerExploreWay.getLocation());
|
||||
// 探路目前只有上报拥堵
|
||||
v2XRoadEventEntity.setPoiType(EventTypeEnum.FOURS_BLOCK_UP.getPoiType());
|
||||
|
||||
v2XRoadEventEntity.setDistance(1000);
|
||||
v2XRoadEventEntity.setNoveltyInfo(markerExploreWay);
|
||||
v2XRoadEventEntity.setExpireTime(20000);
|
||||
//V2XServiceManager.getMoGoV2XScenarioManager().showRoadEventWindow(v2XRoadEventEntity, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.listener;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/15 10:20 AM
|
||||
* desc : V2X 窗体状态回调
|
||||
* version: 1.0
|
||||
*/
|
||||
public interface V2XWindowStatusListener {
|
||||
void onViewShow();
|
||||
|
||||
void onViewClose();
|
||||
}
|
||||
@@ -3,16 +3,13 @@ package com.mogo.eagle.core.function.v2x.events.receiver;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar.V2XVoiceCallLiveBiz;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.TestOnLineCarUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
@@ -23,9 +20,7 @@ import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.zhidao.carchattingprovider.ICarsChattingProvider;
|
||||
import com.zhidao.carchattingprovider.MogoDriverInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static android.text.style.TtsSpan.GENDER_MALE;
|
||||
|
||||
/**
|
||||
@@ -104,9 +99,9 @@ public class TestPanelBroadcastReceiver extends BroadcastReceiver {
|
||||
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
|
||||
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
|
||||
} else if (sceneType == 6) {//查看前车直播
|
||||
V2XVoiceCallLiveBiz.getInstance().getFrontCarLive();
|
||||
//V2XVoiceCallLiveBiz.getInstance().getFrontCarLive();
|
||||
} else if (sceneType == 7) {//查看前方路口直播
|
||||
V2XVoiceCallLiveBiz.getInstance().getOpenRoadCameraLive();
|
||||
//V2XVoiceCallLiveBiz.getInstance().getOpenRoadCameraLive();
|
||||
} else if (sceneType == 8) {//触发疲劳驾驶
|
||||
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
|
||||
TestOnLineCarUtils.getV2XScenarioFatigueDrivingData();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario;
|
||||
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
|
||||
/**
|
||||
@@ -22,26 +21,6 @@ public interface IV2XScenario {
|
||||
*/
|
||||
void close();
|
||||
|
||||
/**
|
||||
* 展示Window
|
||||
*/
|
||||
void showWindow();
|
||||
|
||||
/**
|
||||
* 关闭Window
|
||||
*/
|
||||
void closeWindow();
|
||||
|
||||
/**
|
||||
* 展示按钮
|
||||
*/
|
||||
default void showButton() {}
|
||||
|
||||
/**
|
||||
* 关闭按钮
|
||||
*/
|
||||
default void closeButton() {}
|
||||
|
||||
/**
|
||||
* 绘制POI
|
||||
*/
|
||||
@@ -59,13 +38,4 @@ public interface IV2XScenario {
|
||||
* @return true-相同的场景,false-不同场景
|
||||
*/
|
||||
boolean isSameScenario(V2XMessageEntity v2XMessageEntity);
|
||||
|
||||
/**
|
||||
* 调用小智语音播放TTS
|
||||
*
|
||||
* @param msg 消息
|
||||
* @param callBack 播放回调
|
||||
*/
|
||||
void speakTTSVoice(String msg, IMogoVoiceCmdCallBack callBack);
|
||||
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
*/
|
||||
public abstract class AbsV2XScenario<T> implements IV2XScenario {
|
||||
protected String TAG = "AbsV2XScenario";
|
||||
private IV2XWindow mV2XWindow;
|
||||
private IV2XButton mV2XButton;
|
||||
private IV2XMarker mV2XMarker;
|
||||
private V2XMessageEntity<T> mV2XMessageEntity;
|
||||
|
||||
@@ -36,8 +34,6 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
closeButton();
|
||||
closeWindow();
|
||||
clearPOI();
|
||||
}
|
||||
|
||||
@@ -46,39 +42,13 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
|
||||
*/
|
||||
public void release() {
|
||||
mV2XMessageEntity = null;
|
||||
mV2XWindow = null;
|
||||
mV2XButton = null;
|
||||
mV2XMarker = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void speakTTSVoice(@Nullable String msg, IMogoVoiceCmdCallBack callBack) {
|
||||
if (!TextUtils.isEmpty(msg)) {
|
||||
Logger.d(TAG, "调用TTS播放语音:" + msg);
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice(msg, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, callBack);
|
||||
}
|
||||
}
|
||||
|
||||
public IV2XWindow getV2XWindow() {
|
||||
return mV2XWindow;
|
||||
}
|
||||
|
||||
public void setV2XWindow(@Nullable IV2XWindow mV2XWindow) {
|
||||
this.mV2XWindow = mV2XWindow;
|
||||
}
|
||||
|
||||
public IV2XMarker getV2XMarker() {
|
||||
return mV2XMarker;
|
||||
}
|
||||
|
||||
public IV2XButton getV2XButton() {
|
||||
return mV2XButton;
|
||||
}
|
||||
|
||||
public void setV2XButton(@Nullable IV2XButton mV2XButton) {
|
||||
this.mV2XButton = mV2XButton;
|
||||
}
|
||||
|
||||
public void setV2XMarker(@Nullable IV2XMarker mV2XMarker) {
|
||||
this.mV2XMarker = mV2XMarker;
|
||||
}
|
||||
|
||||
@@ -1,25 +1,16 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.impl;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_PARKING;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.IV2XScenarioManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.fatigue.V2XFatigueDrivingScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.help.V2XCarForHelpScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar.V2XPushLiveCarScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar.V2XVoiceCallLiveScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.park.V2XIllegalParkScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.push.V2XPushEventScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.road.V2XRoadEventScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.route.V2XOptimalRouteVREventScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.seek.V2XSeekHelpScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.ugc.V2XEventUgcScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.warning.V2XFrontWarningScenario;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
@@ -28,7 +19,6 @@ import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.scenario.scene.destination.V2XRecommendRouteScenario;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
|
||||
/**
|
||||
@@ -76,39 +66,6 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
|
||||
mV2XScenario = new V2XRoadEventScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
|
||||
mV2XScenario = new V2XSeekHelpScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
|
||||
case ALERT_RECOMMEND_PARKING:
|
||||
mV2XScenario = new V2XFatigueDrivingScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
|
||||
mV2XScenario = new V2XPushEventScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING:
|
||||
mV2XScenario = new V2XPushLiveCarScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP:
|
||||
mV2XScenario = new V2XCarForHelpScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
|
||||
mV2XScenario = new V2XIllegalParkScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
mV2XScenario = isVrMode ? null : new V2XEventUgcScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW:
|
||||
mV2XScenario = new V2XVoiceCallLiveScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE:
|
||||
mV2XScenario = new V2XRecommendRouteScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW:
|
||||
mV2XScenario = new V2XOptimalRouteVREventScenario();
|
||||
break;
|
||||
@@ -130,12 +87,8 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
TipToast.tip("当前V2X消息类型未定义");
|
||||
return;
|
||||
}
|
||||
|
||||
// 展示最新的消息
|
||||
if (mV2XScenario != null) {
|
||||
if (v2XMessageEntity.getType() != V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP) {
|
||||
hidOtherPanel();
|
||||
}
|
||||
mV2XScenario.init(v2XMessageEntity);
|
||||
}
|
||||
}
|
||||
@@ -156,8 +109,4 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
mapUiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void hidOtherPanel() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,19 +2,14 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.service.v2x.IV2XWindowManagerListener;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 12/11/20 10:35 AM
|
||||
*/
|
||||
public class V2XBasWindow extends RelativeLayout implements IV2XWindowManagerListener {
|
||||
public class V2XBasWindow extends RelativeLayout {
|
||||
private final String TAG = "V2XBasWindow";
|
||||
|
||||
public V2XBasWindow(Context context) {
|
||||
@@ -48,13 +43,4 @@ public class V2XBasWindow extends RelativeLayout implements IV2XWindowManagerLis
|
||||
protected void release() {
|
||||
Logger.w(TAG, "release……");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeTipWindowByListener() {
|
||||
Log.d(TAG, "removeAllTipWindow");
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeView(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.mogo.module.v2x.scenario.scene.destination
|
||||
|
||||
import android.view.ViewGroup
|
||||
import com.mogo.eagle.core.function.v2x.R
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.mogo.module.common.entity.V2XMessageEntity
|
||||
import com.mogo.module.common.entity.V2XRecommendRouteEntity
|
||||
|
||||
/**
|
||||
* created by wujifei on 2020/12/29 17:57
|
||||
* describe:基于目的地预判的道路事件提醒、路线推荐
|
||||
*/
|
||||
class V2XRecommendRouteScenario : AbsV2XScenario<V2XRecommendRouteEntity>() {
|
||||
|
||||
init {
|
||||
v2XWindow = V2XRecommendRouteWindow()
|
||||
}
|
||||
|
||||
override fun init(v2XMessageEntity: V2XMessageEntity<V2XRecommendRouteEntity>?) {
|
||||
v2XMessageEntity?.content?.let {
|
||||
if (v2XMessageEntity.isShowState) {
|
||||
if (!isSameScenario(v2XMessageEntity)) {
|
||||
setV2XMessageEntity(v2XMessageEntity)
|
||||
show()
|
||||
} else {
|
||||
setV2XMessageEntity(v2XMessageEntity)
|
||||
}
|
||||
} else {
|
||||
close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun show() {
|
||||
if (BridgeApi.statusManager()?.isMainPageOnResume == true) {
|
||||
showWindow()
|
||||
}
|
||||
}
|
||||
|
||||
override fun showWindow() {
|
||||
v2XWindow?.let {
|
||||
val layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
Utils.getApp().resources.getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground).toInt())
|
||||
BridgeApi.topViewManager()?.addView(it.view, layoutParams)
|
||||
it.show(v2XMessageEntity.content)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun closeWindow() {
|
||||
v2XWindow?.let {
|
||||
it.close()
|
||||
}
|
||||
}
|
||||
|
||||
override fun showButton() {}
|
||||
|
||||
override fun closeButton() {}
|
||||
|
||||
override fun drawPOI() {}
|
||||
|
||||
override fun clearPOI() {}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
package com.mogo.module.v2x.scenario.scene.destination
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.PagerSnapHelper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.function.v2x.R
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity
|
||||
import com.mogo.module.common.entity.V2XMessageEntity
|
||||
import com.mogo.module.common.entity.V2XRecommendRouteEntity
|
||||
|
||||
/**
|
||||
* created by wujifei on 2020/12/25 11:45
|
||||
* describe:基于目的地预判的道路事件场景弹窗
|
||||
*/
|
||||
class V2XRecommendRouteWindow @JvmOverloads constructor(
|
||||
context: Context = BridgeApi.context(),
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0) : V2XBasWindow(context, attrs, defStyleAttr), IV2XWindow<V2XRecommendRouteEntity?> {
|
||||
|
||||
private var rvRoadEventList: RecyclerView? = null
|
||||
private var mV2XRoadEventAdapter: V2XRoadEventAdapter? = null
|
||||
|
||||
// 列表展示
|
||||
private val mItemList = mutableListOf<V2XEventShowEntity>()
|
||||
|
||||
init {
|
||||
initView(context)
|
||||
}
|
||||
|
||||
private fun initView(context: Context) {
|
||||
// 填充布局
|
||||
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this)
|
||||
rvRoadEventList = findViewById(R.id.rvRoadEventList);
|
||||
mV2XRoadEventAdapter = V2XRoadEventAdapter(mItemList, this)
|
||||
rvRoadEventList?.setAdapter(mV2XRoadEventAdapter)
|
||||
// 设置切换样式
|
||||
PagerSnapHelper().attachToRecyclerView(rvRoadEventList)
|
||||
// 配置列表朝向
|
||||
val layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
||||
rvRoadEventList?.setLayoutManager(layoutManager)
|
||||
}
|
||||
|
||||
|
||||
override fun close() {
|
||||
//移除窗体
|
||||
BridgeApi.topViewManager()?.removeView(this)
|
||||
}
|
||||
|
||||
override fun getView(): View {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun setWindowStatusListener(listener: V2XWindowStatusListener) {
|
||||
|
||||
}
|
||||
|
||||
override fun show(entity: V2XRecommendRouteEntity?) {
|
||||
entity.let {
|
||||
// 清空数据
|
||||
mItemList.clear()
|
||||
val v2XEventShowEntity = V2XEventShowEntity()
|
||||
v2XEventShowEntity.v2XRecommendRouteEntity = entity
|
||||
v2XEventShowEntity.viewType = V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE
|
||||
mItemList.add(v2XEventShowEntity)
|
||||
// 刷新列表
|
||||
mV2XRoadEventAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.fatigue;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 5:37 PM
|
||||
* desc : 疲劳驾驶/目的地停车场推荐场景
|
||||
* 目的地停车场他推荐:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48958095
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XFatigueDrivingScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
|
||||
|
||||
public V2XFatigueDrivingScenario() {
|
||||
setV2XWindow(new V2XFatigueDrivingWindow());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
|
||||
boolean isVrMode = false;
|
||||
boolean isMainPageOnResume = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
isMainPageOnResume = statusManager.isMainPageOnResume();
|
||||
}
|
||||
if (isVrMode) {
|
||||
return;
|
||||
}
|
||||
if (!isSameScenario(v2XMessageEntity)) {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
if (v2XMessageEntity != null) {
|
||||
if (v2XMessageEntity.isShowState()
|
||||
&& isMainPageOnResume) {
|
||||
show();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
Logger.w(MODULE_NAME, "疲劳驾驶场景,要处理的场景已经存在,丢弃这次初始化");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
showWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
ViewGroup.LayoutParams layoutParams =
|
||||
new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground));
|
||||
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
}
|
||||
getV2XWindow().show(getV2XMessageEntity().getContent());
|
||||
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setFatigueDrivingWindowShow(TAG, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
Logger.d(MODULE_NAME, "疲劳驾驶场景 展示 Window 动画结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
Logger.d(MODULE_NAME, "疲劳驾驶场景 关闭 Window 动画结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
Logger.d(MODULE_NAME, "疲劳驾驶场景 展示 Window 开始");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
Logger.d(MODULE_NAME, "疲劳驾驶场景 关闭 Window 开始");
|
||||
// 重置场景提示的消息
|
||||
setV2XMessageEntity(null);
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setFatigueDrivingWindowShow(TAG, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.fatigue;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/24 11:34 AM
|
||||
* desc : 疲劳驾驶场景Window
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XFatigueDrivingWindow extends V2XBasWindow
|
||||
implements IV2XWindow<V2XPushMessageEntity> {
|
||||
// 展示列表
|
||||
private RecyclerView mRecyclerView;
|
||||
// 列表数据适配器
|
||||
private V2XRoadEventAdapter mV2XRoadEventAdapter;
|
||||
// 列表展示
|
||||
private List<V2XEventShowEntity> mItemList = new ArrayList<>();
|
||||
|
||||
// 直播30秒自动关闭
|
||||
private static Handler handlerV2XEvent = new Handler();
|
||||
private static Runnable runnableV2XEvent;
|
||||
|
||||
// 推荐的停车场
|
||||
private V2XPushMessageEntity mV2XPushMessageEntity;
|
||||
|
||||
public V2XFatigueDrivingWindow() {
|
||||
this(BridgeApi.INSTANCE.context(), null);
|
||||
}
|
||||
|
||||
public V2XFatigueDrivingWindow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XFatigueDrivingWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XFatigueDrivingWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public void initView(Context context) {
|
||||
//Logger.w(MODULE_NAME, "V2X-初始化疲劳驾驶");
|
||||
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
|
||||
// 详情列表
|
||||
mRecyclerView = findViewById(R.id.rvRoadEventList);
|
||||
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList,this);
|
||||
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
|
||||
// 设置切换样式
|
||||
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
|
||||
// 配置列表朝向
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
if (recyclerView.getChildCount() > 0) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
// 用户处于交互的时候延后隐藏时间
|
||||
countDownV2XEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 展示道路事件详情Windows
|
||||
*/
|
||||
@Override
|
||||
public void show(V2XPushMessageEntity entity) {
|
||||
if (entity != null) {
|
||||
mV2XPushMessageEntity = entity;
|
||||
// 清空数据
|
||||
mItemList.clear();
|
||||
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
|
||||
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
|
||||
v2XEventShowEntity.setV2XPushMessageEntity(mV2XPushMessageEntity);
|
||||
v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING);
|
||||
mItemList.add(v2XEventShowEntity);
|
||||
// 刷新列表
|
||||
mV2XRoadEventAdapter.notifyDataSetChanged();
|
||||
|
||||
countDownV2XEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
// 停止倒计时
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
|
||||
//移除窗体
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeView(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 窗体倒计时
|
||||
*/
|
||||
public void countDownV2XEvent() {
|
||||
if (mV2XPushMessageEntity != null) {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
//Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。");
|
||||
// 移出Window详细信息
|
||||
close();
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
int expireTime = mV2XPushMessageEntity.getExpireTime();
|
||||
//Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + expireTime);
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, expireTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,232 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.help;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.os.CountDownTimer;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
/**
|
||||
* @ProjectName: MoGoModulSafeDriving
|
||||
* @Package: com.mogo.module.v2x.scenario.scene
|
||||
* @ClassName: V2XCarForHelpScenario
|
||||
* @Description: 自车求助场景
|
||||
* @Author: fenghl
|
||||
* @CreateDate: 2020/5/25 11:44
|
||||
* @UpdateUser: 更新者:
|
||||
* @UpdateDate: 2020/5/25 11:44
|
||||
* @UpdateRemark: 更新说明:
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IMogoStatusChangedListener {
|
||||
private static final String TAG = MODULE_NAME + "_" + V2XCarForHelpScenario.class.getSimpleName();
|
||||
private volatile static V2XCarForHelpScenario mV2XCarForHelpScenario;
|
||||
private CountDownTimer mMySeekHelpCountDown;
|
||||
private V2XSeekHelpDialog v2xFaultHelpDialog;
|
||||
private V2XSeekHelpButton mV2XSeekHelpButton;
|
||||
|
||||
public V2XCarForHelpScenario() {
|
||||
mV2XSeekHelpButton = new V2XSeekHelpButton();
|
||||
setV2XButton(mV2XSeekHelpButton);
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
statusManager.registerStatusChangedListener(TAG, StatusDescriptor.SEEK_HELPING, this);
|
||||
statusManager.registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<Boolean> v2XMessageEntity) {
|
||||
// 设置Button的显示
|
||||
if (v2XMessageEntity == null) {
|
||||
return;
|
||||
}
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
Boolean isShow = getV2XMessageEntity().getContent();
|
||||
if (isShow) {
|
||||
showButton();
|
||||
mySeekHelpCountDownTimerCancel();
|
||||
mySeekHelpCountDownTimerStart();
|
||||
unregisterSeekHelpButtonCmd();
|
||||
V2XVoiceManager.INSTANCE.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP, cancelCb);
|
||||
V2XVoiceManager.INSTANCE.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CANCEL_FOR_HELP_UN_WAKEUP, cancelCb);
|
||||
} else {
|
||||
closeButton();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
showButton();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
}
|
||||
|
||||
private V2XVoiceCallbackListener cancelCb = null;
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
Logger.d(TAG, "打开自车求助按钮!");
|
||||
// 设置Button的显示
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().setOnActionListener(this::showDialog);
|
||||
getV2XButton().show();
|
||||
// V2XServiceManager.getMogoEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP, R.drawable.module_v2x_left_notice_seek_help, "正在发起求助...");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
boolean isSeekHelping = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isSeekHelping = statusManager.isSeekHelping();
|
||||
}
|
||||
if (isSeekHelping) {
|
||||
Logger.d(TAG, "关闭自车求助按钮!");
|
||||
statusManager.setSeekHelping(TAG, false);
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().close();
|
||||
SharedPrefsMgr.getInstance(Utils.getApp()).putLong(V2XConst.SEEK_HELP_TIME, 0);
|
||||
}
|
||||
|
||||
mySeekHelpCountDownTimerCancel();
|
||||
}
|
||||
boolean isOtherSeekHelpPOIShow = false;
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
isOtherSeekHelpPOIShow = v2xStatus.isOtherSeekHelpPOIShow();
|
||||
}
|
||||
if (isOtherSeekHelpPOIShow) {
|
||||
// 移除线
|
||||
IMoGoV2XPolylineManager v2xPolyline = BridgeApi.INSTANCE.v2xPolyline();
|
||||
if (v2xPolyline != null) {
|
||||
v2xPolyline.clearLine();
|
||||
}
|
||||
|
||||
IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker();
|
||||
if (v2xMarker != null) {
|
||||
// 绘制上次的数据
|
||||
v2xMarker.drawableLastAllPOI();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
//无Poi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
//无Poi
|
||||
}
|
||||
|
||||
|
||||
private void mySeekHelpCountDownTimerStart() {
|
||||
long seekHelpTimeStart = SharedPrefsMgr.getInstance(BridgeApi.INSTANCE.context()).getLong(V2XConst.SEEK_HELP_TIME, 0);
|
||||
if (seekHelpTimeStart == 0) {
|
||||
return;
|
||||
}
|
||||
long curTime = System.currentTimeMillis();
|
||||
long timeOut = 10 * 60_000;
|
||||
//超时时间
|
||||
if (curTime - seekHelpTimeStart < timeOut) {
|
||||
long min30 = 30 * 60 * 1000;
|
||||
//long min30 = 10_000;
|
||||
long countDown = seekHelpTimeStart + min30 - curTime;
|
||||
//从自车故障时间起 30分钟后弹框提醒
|
||||
if (mMySeekHelpCountDown == null) {
|
||||
mMySeekHelpCountDown = new CountDownTimer(countDown, countDown) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
showDialog();
|
||||
}
|
||||
};
|
||||
mMySeekHelpCountDown.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void mySeekHelpCountDownTimerCancel() {
|
||||
if (mMySeekHelpCountDown != null) {
|
||||
mMySeekHelpCountDown.cancel();
|
||||
mMySeekHelpCountDown = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void showDialog() {
|
||||
if (v2xFaultHelpDialog == null) {
|
||||
v2xFaultHelpDialog = new V2XSeekHelpDialog(BridgeApi.INSTANCE.context());
|
||||
}
|
||||
// v2xFaultHelpDialog.setOnClickListener(new V2XSeekHelpDialog.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClickLeft() {
|
||||
// //放弃求助
|
||||
// /* if (V2XServiceManager.getMoGoStatusManager().isSeekHelping()) {
|
||||
// V2XServiceManager.getMoGoStatusManager().setSeekHelping(TAG, false);
|
||||
// }*/
|
||||
// closeButton();
|
||||
// v2xFaultHelpDialog.dismiss();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onClickRight() {
|
||||
// //继续求助
|
||||
// v2xFaultHelpDialog.dismiss();
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// v2xFaultHelpDialog.show();
|
||||
closeButton();
|
||||
|
||||
}
|
||||
|
||||
private void unregisterSeekHelpButtonCmd() {
|
||||
V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP);
|
||||
V2XVoiceManager.INSTANCE.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CANCEL_FOR_HELP_UN_WAKEUP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
if (descriptor == StatusDescriptor.SEEK_HELPING) {
|
||||
V2XMessageEntity<Boolean> entity = new V2XMessageEntity<>();
|
||||
entity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP);
|
||||
entity.setContent(isTrue);
|
||||
init(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.help;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshCallback;
|
||||
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XButton;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XButtonListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
|
||||
/**
|
||||
* @ProjectName: MoGoModulSafeDriving
|
||||
* @Package: com.mogo.module.v2x.scenario.view
|
||||
* @ClassName: V2XSeekHelpButton
|
||||
* @Description: 自车求助按钮
|
||||
* @Author: fenghl
|
||||
* @CreateDate: 2020/5/18 10:46
|
||||
* @UpdateUser: 更新者:
|
||||
* @UpdateDate: 2020/5/18 10:46
|
||||
* @UpdateRemark: 更新说明:
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class V2XSeekHelpButton implements IV2XButton {
|
||||
private TextView tv;
|
||||
private IV2XButtonListener mListener;
|
||||
private V2XVoiceCallbackListener cancelCb = (String command, Intent intent) -> {
|
||||
doAction();
|
||||
};
|
||||
private View topView;
|
||||
|
||||
|
||||
private void doAction() {
|
||||
if (mListener != null) {
|
||||
mListener.onAction();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnActionListener(IV2XButtonListener listener) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
registerVoice();
|
||||
}
|
||||
|
||||
public void showTopView() {
|
||||
topView = View.inflate(BridgeApi.INSTANCE.context(), R.layout.window_carforhelp_detail, null);
|
||||
TextView tvCancel = topView.findViewById(R.id.tv_cancel);
|
||||
tvCancel.setOnClickListener(v -> {
|
||||
doAction();
|
||||
});
|
||||
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_car_for_help_window_height));
|
||||
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addView(topView, layoutParams);
|
||||
}
|
||||
}
|
||||
|
||||
public void closeTopView() {
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeView(topView);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
if (tv != null) {
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice("已取消", null);
|
||||
tv.setVisibility(View.GONE);
|
||||
closeTopView();
|
||||
V2XRefreshModel v2XRefreshModel = BridgeApi.INSTANCE.refreshModel();
|
||||
v2XRefreshModel.cancelHelpSignal(new V2XRefreshCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData result) {
|
||||
tv.setVisibility(View.GONE);
|
||||
closeTopView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String msg) {
|
||||
tv.setVisibility(View.VISIBLE);
|
||||
showTopView();
|
||||
}
|
||||
});
|
||||
mListener = null;
|
||||
}
|
||||
unRegisterVoice();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerVoice() {
|
||||
V2XVoiceManager.INSTANCE.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP, cancelCb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unRegisterVoice() {
|
||||
V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP);
|
||||
}
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.help;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
/**
|
||||
* @ProjectName: MoGoModulSafeDriving
|
||||
* @Package: com.mogo.module.v2x.window
|
||||
* @ClassName: V2XDialog
|
||||
* @Description: java类作用描述
|
||||
* @Author: fenghl
|
||||
* @CreateDate: 2020/4/22 14:27
|
||||
* @UpdateUser: 更新者:
|
||||
* @UpdateDate: 2020/4/22 14:27
|
||||
* @UpdateRemark: 更新说明:
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class V2XSeekHelpDialog extends ConstraintLayout implements View.OnClickListener {
|
||||
public static final String TAG = "V2XDialog";
|
||||
private TextView tvContent;
|
||||
private TextView tvLeft;
|
||||
private TextView tvRight;
|
||||
private Context mContext;
|
||||
|
||||
public V2XSeekHelpDialog(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XSeekHelpDialog(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XSeekHelpDialog(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
mContext = context;
|
||||
LayoutInflater.from(context).inflate(R.layout.dialog_v2x_seek_help, this);
|
||||
tvContent = findViewById(R.id.tvDialogContent);
|
||||
tvLeft = findViewById(R.id.tvDialogLeft);
|
||||
tvRight = findViewById(R.id.tvDialogRight);
|
||||
tvContent.setText("确定解除求助状态?");
|
||||
tvLeft.setText("确定");
|
||||
tvRight.setText("取消");
|
||||
tvLeft.setOnClickListener(this);
|
||||
tvRight.setOnClickListener(this);
|
||||
|
||||
}
|
||||
|
||||
private OnClickListener mListener;
|
||||
|
||||
public void setOnClickListener(OnClickListener listener) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
public interface OnClickListener {
|
||||
void onClickLeft();
|
||||
|
||||
void onClickRight();
|
||||
}
|
||||
|
||||
private WindowManagerView windowManager;
|
||||
|
||||
public void show() {
|
||||
try {
|
||||
Logger.d(TAG, "使用windowManager实现");
|
||||
// if ( windowManager == null ) {
|
||||
// windowManager = new WindowManagerView.Builder(
|
||||
// V2XServiceManager.getMogoEntranceButtonController().getButton(ButtonIndex.BUTTON2).getContext()
|
||||
// ).contentView(this).build();
|
||||
// }
|
||||
// AIAssist.getInstance(Utils.getApp()).speakTTSVoice("确定要解除求助状态吗");
|
||||
// unRegisterVoiceCmd();
|
||||
// registerVoiceCmd();
|
||||
// windowManager.show();
|
||||
handleLeft();
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice("已取消");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private V2XVoiceCallbackListener voiceRightCb = (String command, Intent intent) -> {
|
||||
//继续求助
|
||||
handleRight();
|
||||
};
|
||||
private V2XVoiceCallbackListener voiceLeftCb = (String command, Intent intent) -> {
|
||||
|
||||
//放弃求助
|
||||
handleLeft();
|
||||
};
|
||||
|
||||
public void dismiss() {
|
||||
if (windowManager != null) {
|
||||
windowManager.dismiss();
|
||||
}
|
||||
windowManager = null;
|
||||
}
|
||||
|
||||
//放弃求助
|
||||
private void handleLeft() {
|
||||
if (mListener != null) {
|
||||
mListener.onClickLeft();
|
||||
}
|
||||
// unRegisterVoiceCmd();
|
||||
}
|
||||
|
||||
//继续求助
|
||||
private void handleRight() {
|
||||
if (mListener != null) {
|
||||
mListener.onClickRight();
|
||||
}
|
||||
// unRegisterVoiceCmd();
|
||||
}
|
||||
|
||||
private void registerVoiceCmd() {
|
||||
V2XVoiceManager.INSTANCE.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_COMMON_CONFIRM, voiceLeftCb);
|
||||
V2XVoiceManager.INSTANCE.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_COMMON_CANCEL, voiceRightCb);
|
||||
V2XVoiceManager.INSTANCE.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CONFIRM_UN_WAKEUP, voiceLeftCb);
|
||||
V2XVoiceManager.INSTANCE.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CANCEL_UN_WAKEUP, voiceRightCb);
|
||||
}
|
||||
|
||||
private void unRegisterVoiceCmd() {
|
||||
V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_COMMON_CONFIRM);
|
||||
V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_COMMON_CANCEL);
|
||||
V2XVoiceManager.INSTANCE.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CONFIRM_UN_WAKEUP);
|
||||
V2XVoiceManager.INSTANCE.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CANCEL_UN_WAKEUP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int vId = v.getId();
|
||||
if (vId == R.id.tvDialogLeft) {
|
||||
handleLeft();
|
||||
} else if (vId == R.id.tvDialogRight) {
|
||||
handleRight();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.ADASUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 5:37 PM
|
||||
* desc : TODO 推送直播场景 非演示
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XPushLiveCarScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
|
||||
|
||||
public V2XPushLiveCarScenario() {
|
||||
setV2XWindow(new V2XPushLiveCarWindow());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
|
||||
boolean isMainPageOnResume = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isMainPageOnResume = statusManager.isMainPageOnResume();
|
||||
}
|
||||
if (!isSameScenario(v2XMessageEntity)
|
||||
&& isMainPageOnResume) {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
if (v2XMessageEntity != null &&
|
||||
(v2XMessageEntity.getContent().getVideoSn() != null ||
|
||||
!TextUtils.isEmpty(v2XMessageEntity.getContent().getVideoUrl()))) {
|
||||
show();
|
||||
} else {
|
||||
TipToast.shortTip("附近没有可直播车机");
|
||||
}
|
||||
} else {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
showWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
int width = (int) Utils.getApp().getResources().getDimension(isVrMode ?
|
||||
R.dimen.module_v2x_event_window_width_vr : R.dimen.module_v2x_event_window_width);
|
||||
int height = (int) Utils.getApp().getResources().getDimension(isVrMode ?
|
||||
R.dimen.module_v2x_event_see_live_window_height_vr : R.dimen.module_v2x_event_see_live_window_height);
|
||||
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(width, height);
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (isVrMode) {
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addViewNoLinkage(getV2XWindow().getView(), layoutParams, this);
|
||||
}
|
||||
} else {
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
}
|
||||
}
|
||||
getV2XWindow().show(getV2XMessageEntity().getContent());
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setLiveCarWindowShow(TAG,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().close();
|
||||
}
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setLiveCarWindowShow(TAG, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().clearPOI();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
ADASUtils.broadcastToADAS(BridgeApi.INSTANCE.context(), getV2XMessageEntity().getContent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
// 重置场景提示的消息
|
||||
setV2XMessageEntity(null);
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setLiveCarWindowShow(TAG, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.view.V2XLiveGSYVideoView;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.entity.MarkerCarInfo;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/24 11:34 AM
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XPushLiveCarWindow extends V2XBasWindow implements IV2XWindow<V2XPushMessageEntity> {
|
||||
|
||||
private V2XLiveGSYVideoView mV2XLiveGSYVideoView;
|
||||
private MogoImageView mIvReportHead;
|
||||
|
||||
// 弹窗状态监听
|
||||
private V2XWindowStatusListener mV2XWindowStatusListener;
|
||||
|
||||
// 直播30秒自动关闭
|
||||
private static final Handler handlerV2XEvent = new Handler();
|
||||
private static Runnable runnableV2XEvent;
|
||||
|
||||
public V2XPushLiveCarWindow() {
|
||||
this(BridgeApi.INSTANCE.context(), null);
|
||||
}
|
||||
|
||||
public V2XPushLiveCarWindow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XPushLiveCarWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XPushLiveCarWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public void initView(Context context) {
|
||||
//Logger.w(MODULE_NAME, "初始化直播小窗口View。。。。。");
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
LayoutInflater.from(context).inflate(isVrMode
|
||||
? R.layout.item_v2x_push_live_video_vr
|
||||
: R.layout.item_v2x_push_live_video, this);
|
||||
// 详情列表
|
||||
mV2XLiveGSYVideoView = findViewById(R.id.videoPlayer);
|
||||
mIvReportHead = findViewById(R.id.ivReportHead);
|
||||
ImageView pushVideoClose = findViewById(R.id.pushVideoClose);
|
||||
pushVideoClose.setOnClickListener(v -> close());
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示道路事件详情Windows
|
||||
*/
|
||||
@Override
|
||||
public void show(V2XPushMessageEntity entity) {
|
||||
if (entity != null) {
|
||||
//Logger.w(MODULE_NAME, "更新直播信息。。。。。" + entity);
|
||||
|
||||
if (!TextUtils.isEmpty(entity.getHeadImgUrl())) {
|
||||
mIvReportHead.setVisibility(VISIBLE);
|
||||
IMogoImageloader imageLoader = BridgeApi.INSTANCE.imageLoader();
|
||||
if (imageLoader != null) {
|
||||
imageLoader.displayImage(entity.getHeadImgUrl(), mIvReportHead);
|
||||
}
|
||||
}
|
||||
// 启动播放
|
||||
MarkerCarInfo.CarLiveInfo carLiveInfo = new MarkerCarInfo.CarLiveInfo();
|
||||
carLiveInfo.setVideoChannel(entity.getVideoChannel());
|
||||
carLiveInfo.setVideoSn(entity.getVideoSn());
|
||||
carLiveInfo.setVideoUrl(entity.getVideoUrl());
|
||||
mV2XLiveGSYVideoView.startLive(carLiveInfo);
|
||||
countDownV2XEvent(entity);
|
||||
|
||||
if (mV2XWindowStatusListener != null) {
|
||||
mV2XWindowStatusListener.onViewShow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
// 修改地图比例
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
statusManager.setUserInteractionStatus(MODULE_NAME, true, false);
|
||||
}
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
|
||||
if (mapUiController != null) {
|
||||
mapUiController.loseLockMode();
|
||||
}
|
||||
// 如果窗体处于展示的时候
|
||||
if (mV2XWindowStatusListener != null) {
|
||||
mV2XWindowStatusListener.onViewClose();
|
||||
}
|
||||
// 停止倒计时
|
||||
if (runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
this.mV2XWindowStatusListener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* 窗体倒计时
|
||||
*/
|
||||
public void countDownV2XEvent(V2XPushMessageEntity v2XPushMessageEntity) {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
//Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。");
|
||||
//移出Window详细信息
|
||||
runnableV2XEvent = this::close;
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
int expireTime = v2XPushMessageEntity.getExpireTime();
|
||||
//Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + expireTime);
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, expireTime);
|
||||
}
|
||||
|
||||
//移除窗体
|
||||
private void remove(){
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (isVrMode) {
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeViewNoLinkage(this);
|
||||
}
|
||||
} else {
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeView(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/29 11:16 AM
|
||||
* desc : 道路预警中的直播场景
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XRoadLiveCarScenario extends AbsV2XScenario<List<V2XEventShowEntity>> implements IMogoTopViewStatusListener {
|
||||
private static final String TAG = "V2XRoadEventScenario";
|
||||
private static V2XRoadLiveCarScenario mV2XRoadLiveCarScenario;
|
||||
|
||||
private V2XRoadLiveCarScenario() {
|
||||
}
|
||||
|
||||
public static V2XRoadLiveCarScenario getInstance() {
|
||||
if (mV2XRoadLiveCarScenario == null) {
|
||||
synchronized (V2XRoadLiveCarScenario.class) {
|
||||
if (mV2XRoadLiveCarScenario == null) {
|
||||
mV2XRoadLiveCarScenario = new V2XRoadLiveCarScenario();
|
||||
}
|
||||
}
|
||||
}
|
||||
return mV2XRoadLiveCarScenario;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(V2XMessageEntity<List<V2XEventShowEntity>> v2XMessageEntity) {
|
||||
try {
|
||||
List<V2XEventShowEntity> v2XRoadEventEntity = v2XMessageEntity.getContent();
|
||||
if (v2XRoadEventEntity != null) {
|
||||
if (v2XMessageEntity.isShowState()) {
|
||||
mV2XRoadLiveCarScenario.setV2XWindow(new V2XRoadLiveCarWindow());
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
show();
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) {
|
||||
showWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
IV2XWindow window = getV2XWindow();
|
||||
Log.d(TAG, window.toString());
|
||||
if (window != null) {
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
boolean isVrMode = false;
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
int width = (int) Utils.getApp().getResources().getDimension(isVrMode ?
|
||||
R.dimen.module_v2x_event_window_width_vr : R.dimen.module_v2x_event_window_width);
|
||||
int height = (int) Utils.getApp().getResources().getDimension(isVrMode ?
|
||||
R.dimen.module_v2x_event_see_live_window_height_vr : R.dimen.module_v2x_event_see_live_window_height);
|
||||
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(width, height);
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addViewNoLinkage(window.getView(), layoutParams, this);
|
||||
}
|
||||
window.show(getV2XMessageEntity().getContent());
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setRoadLiveCarWindowShow(TAG, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().close();
|
||||
}
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setRoadLiveCarWindowShow(TAG, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().clearPOI();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
Logger.d(MODULE_NAME, "展示 Window 动画结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
Logger.d(MODULE_NAME, "关闭 Window 动画结束");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
Logger.d(MODULE_NAME, "展示 Window 开始");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
Logger.d(MODULE_NAME, "关闭 Window 开始");
|
||||
// 警报状态,true-警报中,false-警报结束
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setRoadLiveCarWindowShow(TAG, false);
|
||||
}
|
||||
// 打开直播后,窗口倒计时暂停关闭,直播被关闭后继续倒计时
|
||||
// V2XRoadEventWindow window = (V2XRoadEventWindow) V2XRoadEventScenario.getInstance().getV2XWindow();
|
||||
// window.startCountDown();
|
||||
// 重置场景提示的消息
|
||||
setV2XMessageEntity(null);
|
||||
// 关闭场景提示
|
||||
clearPOI();
|
||||
}
|
||||
}
|
||||
@@ -1,235 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoicePagingListener;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/24 11:34 AM
|
||||
* desc : 道路预警中的直播场景
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XRoadLiveCarWindow extends V2XBasWindow
|
||||
implements IV2XWindow<List<V2XEventShowEntity>> {
|
||||
private String TAG = "V2XRoadEventDetailWindow";
|
||||
private TextView mTvEventStubClose;
|
||||
// 展示列表
|
||||
private RecyclerView mRecyclerView;
|
||||
// 列表数据适配器
|
||||
private V2XRoadEventAdapter mV2XRoadEventAdapter;
|
||||
// 列表展示
|
||||
private List<V2XEventShowEntity> mItemList = new ArrayList<>();
|
||||
// 当前展示的位置
|
||||
private int mCurPosition;
|
||||
// 处理道路事件,30秒倒计时
|
||||
private Handler handlerV2XEvent = new Handler();
|
||||
private Runnable runnableV2XEvent;
|
||||
private int countDownTime = 30;
|
||||
// 关闭弹窗回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackCloseWindowListener = (command, intent) -> close();
|
||||
// 翻页回调监听
|
||||
private V2XVoicePagingListener v2XVoicePagingCallbackListener = new V2XVoicePagingListener() {
|
||||
|
||||
@Override
|
||||
public void onNextCallback() {
|
||||
if (mRecyclerView != null && mCurPosition >= 0 && mCurPosition < mV2XRoadEventAdapter.getItemCount() - 1) {
|
||||
mRecyclerView.scrollToPosition(mCurPosition + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrevCallback() {
|
||||
if (mRecyclerView != null && mCurPosition > 0 && mCurPosition <= mV2XRoadEventAdapter.getItemCount() - 1) {
|
||||
mRecyclerView.scrollToPosition(mCurPosition - 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public V2XRoadLiveCarWindow() {
|
||||
this(BridgeApi.INSTANCE.context(), null);
|
||||
}
|
||||
|
||||
public V2XRoadLiveCarWindow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XRoadLiveCarWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XRoadLiveCarWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化视图
|
||||
*/
|
||||
private void initView(Context context) {
|
||||
//Logger.w(MODULE_NAME, "V2X===初始化道路直播视图");
|
||||
// 填充布局
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
LayoutInflater.from(context).inflate(isVrMode ?
|
||||
R.layout.item_v2x_road_live_car_detail_vr : R.layout.item_v2x_road_live_car_detail, this);
|
||||
mTvEventStubClose = findViewById(R.id.tvEventStubClose);
|
||||
mRecyclerView = findViewById(R.id.rvRoadEventList);
|
||||
mTvEventStubClose.setOnClickListener(v -> {
|
||||
close();
|
||||
});
|
||||
|
||||
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
|
||||
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
|
||||
// 设置切换样式
|
||||
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
|
||||
// 配置列表朝向
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
if (recyclerView.getChildCount() > 0) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
//获得当前显示在第一个item的位置
|
||||
mCurPosition = layoutManager.findFirstCompletelyVisibleItemPosition();
|
||||
// 用户处于交互的时候延后隐藏时间
|
||||
countDownV2XEvent(30000);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示道路事件详情Windows
|
||||
*/
|
||||
@Override
|
||||
public void show(List<V2XEventShowEntity> entity) {
|
||||
//Logger.d(MODULE_NAME, "V2X===道路事件直播:展示 Window :" + GsonUtil.jsonFromObject(entity));
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW,
|
||||
v2XVoiceCallbackCloseWindowListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP,
|
||||
v2XVoiceCallbackCloseWindowListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_LIVE_UN_WAKEUP,
|
||||
v2XVoiceCallbackCloseWindowListener)
|
||||
.registerPagingCallback(v2XVoicePagingCallbackListener);
|
||||
// 更新头部的窗体视图
|
||||
updateTopWindowInfo(entity);
|
||||
// 倒计时
|
||||
countDownV2XEvent(30000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新头部的窗体视图
|
||||
*/
|
||||
private void updateTopWindowInfo(List<V2XEventShowEntity> v2XRoadEventEntity) {
|
||||
// 清空数据
|
||||
mItemList.clear();
|
||||
mItemList.addAll(v2XRoadEventEntity);
|
||||
// 刷新列表
|
||||
mV2XRoadEventAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭详情展示框
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
//Logger.d(MODULE_NAME, "V2X===关闭Window");
|
||||
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW);
|
||||
V2XVoiceManager.INSTANCE.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP);
|
||||
V2XVoiceManager.INSTANCE.unRegisterPagingCallback();
|
||||
V2XVoiceManager.INSTANCE
|
||||
.unRegisterWakeCmd(
|
||||
V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING)
|
||||
.unRegisterWakeCmd(
|
||||
V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN)
|
||||
.unRegisterWakeCmd(
|
||||
V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REPORT)
|
||||
.unRegisterUnWakeVoice(
|
||||
V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(
|
||||
V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(
|
||||
V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_TRUE)
|
||||
.unRegisterUnWakeVoice(
|
||||
V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_ERROR);
|
||||
|
||||
// 停止倒计时
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
|
||||
//移除窗体
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeView(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 窗体倒计时
|
||||
*/
|
||||
public void countDownV2XEvent(int expireTime) {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
// 移出Window详细信息
|
||||
mTvEventStubClose.setText((countDownTime--) + "s");
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, 1000);
|
||||
if (countDownTime <= 0) {
|
||||
close();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
//Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + expireTime);
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.live.manager.LiveStreamManagerImpl;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.cloud.trafficlive.api.ITrafficIntersectionLiveCallBack;
|
||||
import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.V2XScenarioManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
import static com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants.COMMAND_ZHIDAO_V2X_AHEAD_LIVE;
|
||||
import static com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP;
|
||||
import static com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CROSSROADS_LIVE;
|
||||
import static com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_ROAD_CAMERA_LIVE_UN_WAKEUP;
|
||||
import static com.mogo.map.marker.MarkerType.MAP_STATIC;
|
||||
import static com.mogo.map.marker.MarkerType.MAP_STATIC_TRAFFIC;
|
||||
import static com.mogo.service.statusmanager.StatusDescriptor.MAIN_PAGE_RESUME;
|
||||
|
||||
/**
|
||||
* author : unknown
|
||||
* desc : 语音呼叫查看直播车辆 或者 路口实况 业务模块
|
||||
*/
|
||||
public class V2XVoiceCallLiveBiz implements IMogoMarkerClickListener {
|
||||
|
||||
private static final String REGISTER_LIFECYCLE_TAG = "V2XVoiceCallLiveBiz";
|
||||
|
||||
private V2XVoiceCallLiveBiz() {
|
||||
|
||||
}
|
||||
|
||||
private static volatile V2XVoiceCallLiveBiz mV2XVoiceCallLiveBiz;
|
||||
|
||||
public static V2XVoiceCallLiveBiz getInstance() {
|
||||
if (mV2XVoiceCallLiveBiz == null) {
|
||||
synchronized (V2XVoiceCallLiveBiz.class) {
|
||||
if (mV2XVoiceCallLiveBiz == null) {
|
||||
mV2XVoiceCallLiveBiz = new V2XVoiceCallLiveBiz();
|
||||
}
|
||||
}
|
||||
}
|
||||
return mV2XVoiceCallLiveBiz;
|
||||
}
|
||||
|
||||
private Context mContext;
|
||||
|
||||
//语音词指令 查看前车视频回调
|
||||
private final V2XVoiceCallbackListener v2XVoiceCallbackFrontLiveCarListener = (command, intent) -> {
|
||||
Logger.d(MODULE_NAME, "语音词指令 查看前车视频回调");
|
||||
getFrontCarLive();
|
||||
};
|
||||
|
||||
//语音词指令 查看路口实况回调
|
||||
private final V2XVoiceCallbackListener v2XVoiceCallbackOpenRoadCameraListener = (command, intent) -> {
|
||||
Logger.d(MODULE_NAME, "语音词指令 查看路口实况回调");
|
||||
AIAssist.getInstance(mContext).speakTTSVoice(mContext.getString(R.string.v2x_voice_see_crossroad_live));
|
||||
getOpenRoadCameraLive();
|
||||
};
|
||||
|
||||
public void init(Context context) {
|
||||
Logger.d(MODULE_NAME, "init");
|
||||
this.mContext = context;
|
||||
registerLifecycleChange();
|
||||
registerVoice();
|
||||
registerMarkerClick();
|
||||
}
|
||||
|
||||
private void registerMarkerClick() {
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoStaticMarkerClickListener(MAP_STATIC, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图上静态marker点击,现在仅点击摄像头
|
||||
*
|
||||
* @param marker
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean onStaticMarkerClicked(IMogoMarker marker) {
|
||||
Log.d(REGISTER_LIFECYCLE_TAG, "onStaticMarkerClicked marker");
|
||||
boolean isLongSight = false;
|
||||
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
|
||||
if (mapUiController != null) {
|
||||
isLongSight = mapUiController.getCurrentMapVisualAngle().isLongSight();
|
||||
}
|
||||
if (isLongSight) {
|
||||
Log.d(REGISTER_LIFECYCLE_TAG, "onStaticMarkerClicked marker is on LongSight, so don't response");
|
||||
return false;
|
||||
}
|
||||
//拉近地图视角为近景
|
||||
if (mapUiController != null) {
|
||||
mapUiController.changeMapVisualAngle(VisualAngleMode.MODE_CLOSE_SIGHT, marker.getPosition());
|
||||
}
|
||||
String assInfo = marker.getMarkerAssInfo();
|
||||
Log.d(REGISTER_LIFECYCLE_TAG, "onStaticMarkerClicked marker assInfo : " + assInfo);
|
||||
if (TextUtils.isEmpty(assInfo) || !assInfo.contains(MAP_STATIC_TRAFFIC)) {
|
||||
return false;
|
||||
} else {
|
||||
//点击地图上marker返回assInfo,得到路口摄像头Id,获取直播
|
||||
getSpecifiedOpenCameraLive(assInfo);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void registerLifecycleChange() {
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
statusManager.registerStatusChangedListener(REGISTER_LIFECYCLE_TAG, MAIN_PAGE_RESUME, (descriptor, isTrue) -> {
|
||||
if (descriptor == StatusDescriptor.MAIN_PAGE_RESUME) {
|
||||
if (isTrue) {
|
||||
registerVoice();
|
||||
} else {
|
||||
unRegisterVoice();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void registerVoice() {
|
||||
V2XVoiceManager.INSTANCE.registerUnWakeVoice(COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP, v2XVoiceCallbackFrontLiveCarListener)
|
||||
.registerUnWakeVoice(COMMAND_ZHIDAO_V2X_OPEN_ROAD_CAMERA_LIVE_UN_WAKEUP, v2XVoiceCallbackOpenRoadCameraListener)
|
||||
.registerWakeCmd(COMMAND_ZHIDAO_V2X_AHEAD_LIVE, v2XVoiceCallbackFrontLiveCarListener)
|
||||
.registerWakeCmd(COMMAND_ZHIDAO_V2X_CROSSROADS_LIVE, v2XVoiceCallbackOpenRoadCameraListener);
|
||||
}
|
||||
|
||||
private void unRegisterVoice() {
|
||||
V2XVoiceManager.INSTANCE.unRegisterUnWakeVoice(COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(COMMAND_ZHIDAO_V2X_OPEN_ROAD_CAMERA_LIVE_UN_WAKEUP)
|
||||
.unRegisterWakeCmd(COMMAND_ZHIDAO_V2X_AHEAD_LIVE).unRegisterWakeCmd(COMMAND_ZHIDAO_V2X_CROSSROADS_LIVE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看前方车辆直播,同方向角 200米范围
|
||||
*/
|
||||
public void getFrontCarLive() {
|
||||
LiveStreamManagerImpl.getInstance(AbsMogoApplication.getApp(),
|
||||
MoGoAiCloudClientConfig.getInstance().getThirdPartyDeviceId(), false);
|
||||
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(null, null, V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW);
|
||||
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看前方路口摄像头直播,同方向角 1公里范围
|
||||
*/
|
||||
public void getOpenRoadCameraLive() {
|
||||
IMogoLocationClient locationClient = BridgeApi.INSTANCE.locationClient();
|
||||
if (locationClient == null) {
|
||||
return;
|
||||
}
|
||||
MogoLocation mogoLocation = locationClient.getLastKnowLocation();
|
||||
MoGoAiCloudTrafficLive.viewFrontIntersectionLive(mogoLocation.getLatitude(), mogoLocation.getLongitude(), ((int) mogoLocation.getBearing()), new ITrafficIntersectionLiveCallBack() {
|
||||
@Override
|
||||
public void liveUrlResult(String liveUrl) {
|
||||
if (!TextUtils.isEmpty(liveUrl)) {
|
||||
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(null, liveUrl, V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING);
|
||||
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
|
||||
} else {
|
||||
Logger.d(MODULE_NAME, "getOpenRoadCameraLive 路口实况直播地址为空");
|
||||
ToastUtils.showShort(R.string.v2x_front_live_url_null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String errorMsg) {
|
||||
Logger.d(MODULE_NAME, "getOpenRoadCameraLive : " + errorMsg);
|
||||
ToastUtils.showShort(R.string.v2x_front_live_url_null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取特定路口摄像头直播
|
||||
*
|
||||
* @param assInfo 路口摄像头Id
|
||||
*/
|
||||
private void getSpecifiedOpenCameraLive(String assInfo) {
|
||||
MoGoAiCloudTrafficLive.viewDesignativeIntersectionLive(assInfo, new ITrafficIntersectionLiveCallBack() {
|
||||
@Override
|
||||
public void liveUrlResult(String liveUrl) {
|
||||
if (!TextUtils.isEmpty(liveUrl)) {
|
||||
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(null, liveUrl, V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING);
|
||||
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
|
||||
} else {
|
||||
Logger.d(MODULE_NAME, "getOpenRoadCameraLive 路口实况直播地址为空");
|
||||
ToastUtils.showShort(R.string.v2x_specific_live_url_null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String errorMsg) {
|
||||
Logger.d(MODULE_NAME, "getSpecifiedOpenCameraLive : " + errorMsg);
|
||||
ToastUtils.showShort(R.string.v2x_specific_live_url_null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建直播参数
|
||||
*
|
||||
* @param sn 直播车机sn
|
||||
* @param liveUrl 直播Url
|
||||
* @return {@link V2XMessageEntity<V2XPushMessageEntity>}
|
||||
*/
|
||||
private V2XMessageEntity<V2XPushMessageEntity> buildCallLiveParams(String sn, String liveUrl, int type) {
|
||||
V2XPushMessageEntity v2XPushMessageEntity = new V2XPushMessageEntity();
|
||||
v2XPushMessageEntity.setVideoSn(sn);
|
||||
v2XPushMessageEntity.setVideoUrl(liveUrl);
|
||||
v2XPushMessageEntity.setShowWindow(true);
|
||||
v2XPushMessageEntity.setExpireTime(1000 * 30);
|
||||
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = new V2XMessageEntity<>();
|
||||
v2XMessageEntity.setType(type);
|
||||
v2XMessageEntity.setContent(v2XPushMessageEntity);
|
||||
v2XMessageEntity.setShowState(true);
|
||||
return v2XMessageEntity;
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoStaticMarkerClickListener(MAP_STATIC, this);
|
||||
}
|
||||
}
|
||||
@@ -1,164 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.view.CarZegoLiveVideoView;
|
||||
import com.mogo.module.common.entity.MarkerCarInfo;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
public class V2XVoiceCallLiveCarWindow extends V2XBasWindow
|
||||
implements IV2XWindow<V2XPushMessageEntity> {
|
||||
|
||||
private static final int COUNT_DOWN_TIMER = 1_000;
|
||||
private static final int ALL_EXPIRE_TIMER = 1_000 * 30;
|
||||
private static int EXPIRE_TIMER = ALL_EXPIRE_TIMER;
|
||||
|
||||
private TextView tvCountDown;
|
||||
private ImageView ivVideoPlayingSign;
|
||||
private boolean isVideoPlay = false;
|
||||
|
||||
// 处理道路事件,30秒倒计时
|
||||
private final Handler handlerV2XEvent = new Handler();
|
||||
private Runnable runnableV2XEvent;
|
||||
|
||||
public V2XVoiceCallLiveCarWindow() {
|
||||
this(BridgeApi.INSTANCE.context(), null);
|
||||
}
|
||||
|
||||
public V2XVoiceCallLiveCarWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XVoiceCallLiveCarWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
private void initView(Context context) {
|
||||
Logger.w(MODULE_NAME, "V2X===初始化语音呼叫直播视图");
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
|
||||
LayoutInflater.from(context).inflate(isVrMode
|
||||
? R.layout.window_see_carlive_video_vr
|
||||
: R.layout.window_see_carlive_video, this);
|
||||
CarZegoLiveVideoView mV2XCarLiveVideoView = findViewById(R.id.videoPlayer);
|
||||
tvCountDown = findViewById(R.id.tvCountDown);
|
||||
// ImageView ivLiveVideoClose = findViewById(R.id.liveVideoClose);
|
||||
ivVideoPlayingSign = findViewById(R.id.ivVideoPlayingSign);
|
||||
mV2XCarLiveVideoView.addOnVideoStatusChangeListener(videoPlaying -> {
|
||||
isVideoPlay = videoPlaying;
|
||||
if (isVideoPlay) {
|
||||
startCountDown();
|
||||
} else {
|
||||
stopCountDown();
|
||||
}
|
||||
});
|
||||
// ivLiveVideoClose.setOnClickListener(v -> close());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(V2XPushMessageEntity entity) {
|
||||
if (entity != null) {
|
||||
Logger.w(MODULE_NAME, "更新直播信息。。。。。" + entity);
|
||||
// 启动播放
|
||||
MarkerCarInfo.CarLiveInfo carLiveInfo = new MarkerCarInfo.CarLiveInfo();
|
||||
carLiveInfo.setVideoChannel(entity.getVideoChannel());
|
||||
carLiveInfo.setVideoSn(entity.getVideoSn());
|
||||
carLiveInfo.setVideoUrl(entity.getVideoUrl());
|
||||
Logger.w(MODULE_NAME, "更新直播信息 END");
|
||||
if (isVideoPlay) {
|
||||
startCountDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
// 停止倒计时
|
||||
stopCountDown();
|
||||
remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 窗体倒计时
|
||||
*/
|
||||
private void startCountDown() {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
EXPIRE_TIMER = EXPIRE_TIMER - COUNT_DOWN_TIMER;
|
||||
tvCountDown.setVisibility(View.VISIBLE);
|
||||
ivVideoPlayingSign.setVisibility(View.VISIBLE);
|
||||
tvCountDown.setText(String.valueOf(EXPIRE_TIMER / COUNT_DOWN_TIMER));
|
||||
if (EXPIRE_TIMER > 0) {
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER);
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER);
|
||||
}
|
||||
|
||||
private void stopCountDown() {
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
tvCountDown.setVisibility(View.GONE);
|
||||
ivVideoPlayingSign.setVisibility(View.GONE);
|
||||
EXPIRE_TIMER = ALL_EXPIRE_TIMER;
|
||||
}
|
||||
}
|
||||
|
||||
//移除窗体
|
||||
private void remove(){
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
if (isVrMode) {
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeViewNoLinkage(this);
|
||||
}
|
||||
}else{
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeView(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
/**
|
||||
* author : unknown
|
||||
* desc : 语音呼叫查看直播场景,包括车辆直播 或者 路口实况 window,区分不同页面window逻辑实现,前方直播车辆由AICloudSdk中实现,上层仅传入SurfaceView和经纬度
|
||||
*/
|
||||
public class V2XVoiceCallLiveScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
|
||||
|
||||
public V2XVoiceCallLiveScenario() {
|
||||
Logger.d(MODULE_NAME, "V2XVoiceCallLiveScenario new()" );
|
||||
setV2XWindow(new V2XVoiceCallLiveCarWindow());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
|
||||
if (v2XMessageEntity == null) {
|
||||
TipToast.shortTip("附近没有可直播车机");
|
||||
return;
|
||||
}
|
||||
if (v2XMessageEntity.isShowState()) {
|
||||
boolean isMainPageOnResume = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isMainPageOnResume = statusManager.isMainPageOnResume();
|
||||
}
|
||||
if (!isSameScenario(v2XMessageEntity)
|
||||
&& isMainPageOnResume) {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
Logger.d(MODULE_NAME, "v2XMessageEntity : " + v2XMessageEntity);
|
||||
show();
|
||||
} else {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
Logger.w(MODULE_NAME, "要处理的场景已经存在,丢弃这次初始化");
|
||||
}
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) {
|
||||
showWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
int width = (int) Utils.getApp().getResources().getDimension(isVrMode ?
|
||||
R.dimen.module_v2x_event_window_width_vr : R.dimen.module_v2x_event_window_width);
|
||||
int height = (int) Utils.getApp().getResources().getDimension(isVrMode ?
|
||||
R.dimen.module_v2x_event_see_live_window_height_vr : R.dimen.module_v2x_event_see_live_window_height);
|
||||
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(width, height);
|
||||
if (isVrMode) {
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addViewNoLinkage(getV2XWindow().getView(), layoutParams, this);
|
||||
}
|
||||
} else {
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
}
|
||||
}
|
||||
getV2XWindow().show(getV2XMessageEntity().getContent());
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setLiveCarWindowShow(TAG, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().close();
|
||||
}
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setLiveCarWindowShow(TAG, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
Logger.d(MODULE_NAME, "展示 Window 动画结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
Logger.d(MODULE_NAME, "关闭 Window 动画结束");
|
||||
getV2XWindow().close();
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setLiveCarWindowShow(TAG, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
Logger.d(MODULE_NAME, "展示 Window 开始");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
Logger.d(MODULE_NAME, "关闭 Window 开始");
|
||||
setV2XMessageEntity(null);
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setLiveCarWindowShow(TAG, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.park;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_EVENT_ALARM_POI;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Handler;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
import com.mogo.module.common.drawer.marker.IMarkerView;
|
||||
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
|
||||
import com.mogo.module.common.drawer.marker.RoadConditionInfoWindow3DAdapter;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.eagle.core.utilcode.util.ViewUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/6/19 17:37 PM
|
||||
* desc : 违章停车场景POI绘制
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XIllegalParkMarker implements IV2XMarker<List<MarkerExploreWay>> {
|
||||
|
||||
public ArrayList<IMogoMarker> mIllegalParkMarkerList;
|
||||
|
||||
// 处理道路事件,30秒倒计时
|
||||
private Handler handlerV2XEvent = new Handler();
|
||||
private Runnable runnableV2XEvent;
|
||||
private int mExpireTime = 30000;
|
||||
|
||||
@Override
|
||||
public void drawPOI(List<MarkerExploreWay> entityList) {
|
||||
try {
|
||||
mIllegalParkMarkerList = new ArrayList<>();
|
||||
// 清除道路事件
|
||||
IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker();
|
||||
if (v2xMarker != null) {
|
||||
v2xMarker.clearALLPOI();
|
||||
}
|
||||
//清除连线
|
||||
IMoGoV2XPolylineManager v2xPolyline = BridgeApi.INSTANCE.v2xPolyline();
|
||||
if (v2xPolyline != null) {
|
||||
v2xPolyline.clearLine();
|
||||
}
|
||||
if (entityList != null) {
|
||||
for (int i = 0; i < entityList.size(); i++) {
|
||||
MarkerExploreWay markerExploreWay = entityList.get(i);
|
||||
|
||||
// 道路事件,或者水波纹扩散效果
|
||||
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
|
||||
.data(markerExploreWay)
|
||||
.latitude(markerExploreWay.getLocation().getLat())
|
||||
.longitude(markerExploreWay.getLocation().getLon());
|
||||
optionsRipple.anchor(0.5f, 0.5f);
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setBindObj(markerExploreWay);
|
||||
markerShowEntity.setChecked(false);
|
||||
markerShowEntity.setTextContent(markerExploreWay.getAddr());
|
||||
markerShowEntity.setMarkerLocation(markerExploreWay.getLocation());
|
||||
markerShowEntity.setMarkerType(ServiceConst.CARD_TYPE_NOVELTY);
|
||||
|
||||
// 进行数据转换,用于Marker展示
|
||||
V2XRoadEventEntity roadEventEntity = new V2XRoadEventEntity();
|
||||
roadEventEntity.setLocation(markerExploreWay.getLocation());
|
||||
roadEventEntity.setBindObj(markerExploreWay);
|
||||
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
IMogoMarker mogoMarker = null;
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
if (isVrMode) {
|
||||
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, null);
|
||||
mogoMarker.setInfoWindowAdapter(new RoadConditionInfoWindow3DAdapter(markerShowEntity, AbsMogoApplication.getApp(), mogoMarker.getMogoMarkerOptions()));
|
||||
mogoMarker.showInfoWindow();
|
||||
} else {
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(AbsMogoApplication.getApp(), markerShowEntity, optionsRipple);
|
||||
Bitmap bitmap = ViewUtils.fromView(markerView.getView());
|
||||
optionsRipple.icon(bitmap);
|
||||
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
|
||||
if (marker != null) {
|
||||
mogoMarker = marker.addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
|
||||
}
|
||||
|
||||
}
|
||||
// 点击监听,天际弹窗展示详情
|
||||
if (mogoMarker != null) {
|
||||
IMogoMarker finalMogoMarker = mogoMarker;
|
||||
mogoMarker.startScaleAnimation(0, 1.2f, 0, 1.2f, 300, new AccelerateInterpolator(), new OnMarkerAnimationListener() {
|
||||
@Override
|
||||
public void onAnimStart() {
|
||||
//Logger.d(MODULE_NAME, " onAnimStart ---1----> ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimEnd() {
|
||||
if (finalMogoMarker.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
finalMogoMarker.startScaleAnimation(1.2f, 1, 1.2f, 1, 100, new LinearInterpolator(), null);
|
||||
}
|
||||
});
|
||||
mogoMarker.setOwner(MODULE_NAME);
|
||||
mogoMarker.setObject(markerShowEntity);
|
||||
mIllegalParkMarkerList.add(mogoMarker);
|
||||
}
|
||||
}, i * 100L);
|
||||
}
|
||||
}
|
||||
|
||||
countDownV2XEvent();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
|
||||
if (mapUiController != null) {
|
||||
mapUiController.loseLockMode();
|
||||
}
|
||||
// 移除违章停车点
|
||||
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
|
||||
if (marker != null) {
|
||||
marker.removeMarkers(ServiceConst.CARD_TYPE_NOVELTY);
|
||||
}
|
||||
// 移除线
|
||||
IMoGoV2XPolylineManager v2xPolyline = BridgeApi.INSTANCE.v2xPolyline();
|
||||
if (v2xPolyline != null) {
|
||||
v2xPolyline.clearLine();
|
||||
}
|
||||
IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker();
|
||||
if (v2xMarker != null) {
|
||||
// 移除事件POI
|
||||
v2xMarker.clearAlarmPOI();
|
||||
// 绘制上次的数据
|
||||
v2xMarker.drawableLastAllPOI();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 倒计时
|
||||
*/
|
||||
public void countDownV2XEvent() {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
//Logger.d(MODULE_NAME, "V2X===违章停车 30秒倒计时结束。。。");
|
||||
// 移出Window详细信息
|
||||
clearPOI();
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
//Logger.d(MODULE_NAME, "V2X===违章停车 POI 展示开始倒计时:" + mExpireTime);
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, mExpireTime);
|
||||
}
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.park;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.events.alarm.V2XAlarmServer;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.ADASUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.TrackUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 5:37 PM
|
||||
* desc : 违章停车
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XIllegalParkScenario extends AbsV2XScenario<List<MarkerExploreWay>> {
|
||||
private static final String TAG = "V2XILLegalParkScenario";
|
||||
|
||||
public V2XIllegalParkScenario() {
|
||||
setV2XWindow(new V2XIllegalParkWindow());
|
||||
setV2XMarker(new V2XIllegalParkMarker());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<List<MarkerExploreWay>> v2XMessageEntity) {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
boolean isMainPageOnResume = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isMainPageOnResume = statusManager.isMainPageOnResume();
|
||||
}
|
||||
if (isMainPageOnResume) {
|
||||
drawPOI();
|
||||
}
|
||||
showWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
MarkerExploreWay markerExploreWay = null;
|
||||
if (getV2XMessageEntity().getContent() != null) {
|
||||
markerExploreWay = V2XAlarmServer
|
||||
.getIllegalParkAlarmEvent(
|
||||
(ArrayList<MarkerExploreWay>) getV2XMessageEntity().getContent(),
|
||||
V2XStatusManager.getInstance().getLocation());
|
||||
}
|
||||
if (markerExploreWay != null) {
|
||||
//弹框
|
||||
// 设置要展开的违章停车事件
|
||||
//((V2XIllegalParkMarker) mV2XMarker).setOpenPoiId(markerExploreWay.getInfoId());
|
||||
// 广播给ADAS
|
||||
V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity();
|
||||
v2XRoadEventEntity.setAlarmContent("违章停车");
|
||||
v2XRoadEventEntity.setExpireTime(20000);
|
||||
v2XRoadEventEntity.setPoiType(EventTypeEnum.ALERT_ILLEGAL_PARK.getPoiType());
|
||||
boolean isMainPageOnResume = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isMainPageOnResume = statusManager.isMainPageOnResume();
|
||||
}
|
||||
if (isMainPageOnResume) {
|
||||
v2XRoadEventEntity.setTts(markerExploreWay.getAddr() + "可能被罚违章停车,您可以说,有用或没用来帮助其它车友。");
|
||||
((V2XIllegalParkWindow) getV2XWindow()).show(markerExploreWay, true);
|
||||
TrackUtils.trackV2xRoadShow(markerExploreWay.getInfoId(), EventTypeEnum.ALERT_ILLEGAL_PARK.getPoiType(), "1");
|
||||
} else {
|
||||
v2XRoadEventEntity.setTts(markerExploreWay.getAddr() + "可能被罚违章停车");
|
||||
TrackUtils.trackV2xRoadShow(markerExploreWay.getInfoId(), EventTypeEnum.ALERT_ILLEGAL_PARK.getPoiType(), "2");
|
||||
}
|
||||
ADASUtils.broadcastToADAS(BridgeApi.INSTANCE.context(), v2XRoadEventEntity);
|
||||
saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING,
|
||||
markerExploreWay);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
IV2XWindow window = getV2XWindow();
|
||||
|
||||
if (topViewManager != null && window != null && window.getView() != null) {
|
||||
topViewManager.removeView(window.getView());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
if (getV2XMessageEntity() != null) {
|
||||
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储本地数据
|
||||
*
|
||||
* @param messageEntity 要存储的场景
|
||||
*/
|
||||
private void saveLocalStory(int scenarioType, MarkerExploreWay messageEntity) {
|
||||
ThreadUtils.getIoPool().execute(() -> {
|
||||
try {
|
||||
V2XSQLiteUtils.saveLocalStory(scenarioType, messageEntity, messageEntity.hashCode());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.park;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 违章停车
|
||||
* 弹窗视图
|
||||
*/
|
||||
public class V2XIllegalParkWindow extends V2XBasWindow implements IV2XWindow<MarkerExploreWay> {
|
||||
private static final String TAG = "V2XIllegalParkWindow";
|
||||
// 展示列表
|
||||
private RecyclerView mRecyclerView;
|
||||
// 列表数据适配器
|
||||
private V2XRoadEventAdapter mV2XRoadEventAdapter;
|
||||
// 列表展示
|
||||
private List<V2XEventShowEntity> mItemList = new ArrayList<>();
|
||||
|
||||
// 处理道路事件,20秒倒计时
|
||||
private Handler handlerV2XEvent = new Handler();
|
||||
private Runnable runnableV2XEvent;
|
||||
private long mExpireTime = 20000;
|
||||
private boolean mIsAutoClose = true;
|
||||
|
||||
private MarkerExploreWay mExploreWay;
|
||||
|
||||
public V2XIllegalParkWindow() {
|
||||
this(BridgeApi.INSTANCE.context(), null);
|
||||
}
|
||||
|
||||
public V2XIllegalParkWindow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XIllegalParkWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XIllegalParkWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化视图
|
||||
*/
|
||||
private void initView(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
|
||||
// 详情列表
|
||||
mRecyclerView = findViewById(R.id.rvRoadEventList);
|
||||
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
|
||||
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
|
||||
// 设置切换样式
|
||||
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
|
||||
// 配置列表朝向
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
if (recyclerView.getChildCount() > 0) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
// 用户处于交互的时候延后隐藏时间
|
||||
countDownV2XEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void show(MarkerExploreWay entity, boolean isAutoClose) {
|
||||
mIsAutoClose = isAutoClose;
|
||||
show(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示道路事件详情Windows
|
||||
*/
|
||||
@Override
|
||||
public void show(MarkerExploreWay entity) {
|
||||
mExploreWay = entity;
|
||||
//Logger.d(V2XConst.MODULE_NAME, "V2X===违章停车:展示 Window=\n" + entity);
|
||||
// 清空数据
|
||||
mItemList.clear();
|
||||
if (mExploreWay != null) {
|
||||
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
|
||||
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
|
||||
v2XEventShowEntity.setV2XIllegalPark(mExploreWay);
|
||||
v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING);
|
||||
mItemList.add(v2XEventShowEntity);
|
||||
}
|
||||
// 刷新列表
|
||||
mV2XRoadEventAdapter.notifyDataSetChanged();
|
||||
// 倒计时
|
||||
if (mIsAutoClose) {
|
||||
countDownV2XEvent();
|
||||
}
|
||||
|
||||
ViewGroup.LayoutParams layoutParams =
|
||||
new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) Utils.getApp()
|
||||
.getResources()
|
||||
.getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground));
|
||||
|
||||
// 添加弹窗
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addView(this, layoutParams);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭详情展示框
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
mIsAutoClose = false;
|
||||
// 停止倒计时
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
|
||||
//移除窗体
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeView(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 窗体倒计时
|
||||
*/
|
||||
public void countDownV2XEvent() {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
//Logger.d(V2XConst.MODULE_NAME, "V2X===20秒倒计时结束。。。");
|
||||
// 移出Window详细信息
|
||||
close();
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
//Logger.d(V2XConst.MODULE_NAME, "V2X===违章停车 Window 展示开始倒计时:" + mExpireTime);
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, mExpireTime);
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.push;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XMarkerClickListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerExploreWayItem;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 5:37 PM
|
||||
* desc : 推送场景
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XPushEventMarker implements IV2XMarker<V2XPushMessageEntity> {
|
||||
@Override
|
||||
public void drawPOI(V2XPushMessageEntity entity) {
|
||||
try {
|
||||
// 清除道路事件
|
||||
IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker();
|
||||
if (v2xMarker != null) {
|
||||
v2xMarker.clearALLPOI();
|
||||
}
|
||||
// 位置信息
|
||||
MarkerLocation markerLocation = new MarkerLocation();
|
||||
markerLocation.setLon(entity.getLon());
|
||||
markerLocation.setLat(entity.getLat());
|
||||
|
||||
// 进行数据转换,用于Marker展示
|
||||
V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity();
|
||||
v2XRoadEventEntity.setLocation(markerLocation);
|
||||
// 探路目前只有上报拥堵
|
||||
v2XRoadEventEntity.setPoiType(EventTypeEnum.ALERT_TRAFFIC_EXPRESS.getPoiType());
|
||||
|
||||
MarkerExploreWay markerNoveltyInfo = new MarkerExploreWay();
|
||||
|
||||
List<MarkerExploreWayItem> items = new ArrayList<>();
|
||||
MarkerExploreWayItem exploreWayItem = new MarkerExploreWayItem();
|
||||
exploreWayItem.setThumbnail(entity.getMsgImgUrl());
|
||||
items.add(exploreWayItem);
|
||||
markerNoveltyInfo.setPoiType(EventTypeEnum.ALERT_TRAFFIC_EXPRESS.getPoiType());
|
||||
markerNoveltyInfo.setItems(items);
|
||||
markerNoveltyInfo.setUploadType("1");
|
||||
|
||||
v2XRoadEventEntity.setNoveltyInfo(markerNoveltyInfo);
|
||||
v2XRoadEventEntity.setExpireTime(20000);
|
||||
|
||||
if (v2xMarker != null) {
|
||||
v2xMarker.drawableAlarmPOI(BridgeApi.INSTANCE.context(),
|
||||
v2XRoadEventEntity,
|
||||
V2XMarkerClickListener.getInstance());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
|
||||
if (mapUiController != null) {
|
||||
mapUiController.loseLockMode();
|
||||
}
|
||||
// 移除线
|
||||
IMoGoV2XPolylineManager v2xPolyline = BridgeApi.INSTANCE.v2xPolyline();
|
||||
if (v2xPolyline != null) {
|
||||
v2xPolyline.clearLine();
|
||||
}
|
||||
IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker();
|
||||
if (v2xMarker != null) {
|
||||
// 移除事件POI
|
||||
v2xMarker.clearAlarmPOI();
|
||||
// 绘制上次的数据
|
||||
v2xMarker.drawableLastAllPOI();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.push;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 5:37 PM
|
||||
* desc : 推送场景
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XPushEventScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
|
||||
|
||||
|
||||
public V2XPushEventScenario() {
|
||||
setV2XMarker(new V2XPushEventMarker());
|
||||
setV2XWindow(new V2XPushEventWindow());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
|
||||
Logger.w(MODULE_NAME, "处理推送场景:" + GsonUtil.jsonFromObject(v2XMessageEntity));
|
||||
|
||||
boolean isMainPageOnResume = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isMainPageOnResume = statusManager.isMainPageOnResume();
|
||||
}
|
||||
if (!isSameScenario(v2XMessageEntity)
|
||||
&& isMainPageOnResume) {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
show();
|
||||
} else {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
Logger.w(V2XConst.MODULE_NAME, "要处理的场景已经存在,丢弃这次初始化");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) {
|
||||
speakTTSVoice(getV2XMessageEntity().getContent().getTts(), null);
|
||||
drawPOI();
|
||||
showWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
ViewGroup.LayoutParams layoutParams =
|
||||
new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_height_ground));
|
||||
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
}
|
||||
getV2XWindow().show(getV2XMessageEntity().getContent());
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setPushWindowShow(TAG, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setPushWindowShow(TAG, false);
|
||||
}
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setPushPOIShow(TAG, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().clearPOI();
|
||||
}
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setPushPOIShow(TAG, false);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
Logger.d(MODULE_NAME, "展示 Window 动画结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
Logger.d(MODULE_NAME, "关闭 Window 动画结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
Logger.d(MODULE_NAME, "展示 Window 开始");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
Logger.d(MODULE_NAME, "关闭 Window 开始");
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setPushWindowShow(TAG, false);
|
||||
}
|
||||
// 重置场景提示的消息
|
||||
setV2XMessageEntity(null);
|
||||
clearPOI();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
@@ -1,209 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.push;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/14 2:37 PM
|
||||
* desc :
|
||||
* TODO 目前前瞻推送使用的消息都在这里展示
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XPushEventWindow extends V2XBasWindow implements IV2XWindow<V2XPushMessageEntity> {
|
||||
private String TAG = "V2XPushEventDetailWindow";
|
||||
// 展示列表
|
||||
private RecyclerView mRecyclerView;
|
||||
// 列表数据适配器
|
||||
private V2XRoadEventAdapter mV2XRoadEventAdapter;
|
||||
// 列表展示
|
||||
private List<V2XEventShowEntity> mItemList = new ArrayList<>();
|
||||
// 处理道路事件,30秒倒计时
|
||||
private Handler handlerV2XEvent = new Handler();
|
||||
private Runnable runnableV2XEvent;
|
||||
private int mExpireTime = 30000;
|
||||
// 关闭弹窗回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackCloseWindowListener = (String command, Intent intent) -> {
|
||||
close();
|
||||
};
|
||||
|
||||
public V2XPushEventWindow() {
|
||||
this(BridgeApi.INSTANCE.context(), null);
|
||||
}
|
||||
|
||||
public V2XPushEventWindow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XPushEventWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XPushEventWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化视图
|
||||
*/
|
||||
private void initView(Context context) {
|
||||
Logger.w(MODULE_NAME, "V2X===初始化推送的消息小窗口View。。。。。");
|
||||
// 填充布局
|
||||
LayoutInflater.from(context).inflate(R.layout.window_push_event_detail, this);
|
||||
// 详情列表
|
||||
mRecyclerView = findViewById(R.id.rvRoadEventList);
|
||||
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
|
||||
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
|
||||
// 设置切换样式
|
||||
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
|
||||
// 配置列表朝向
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
if (recyclerView.getChildCount() > 0) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
// 用户处于交互的时候延后隐藏时间
|
||||
countDownV2XEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新头部的窗体视图
|
||||
*/
|
||||
private void updateTopWindowInfo(V2XPushMessageEntity v2XRoadEventEntity) {
|
||||
// 清空数据
|
||||
mItemList.clear();
|
||||
if (v2XRoadEventEntity != null) {
|
||||
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
|
||||
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
|
||||
v2XEventShowEntity.setV2XPushMessageEntity(v2XRoadEventEntity);
|
||||
v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING);
|
||||
mItemList.add(v2XEventShowEntity);
|
||||
}
|
||||
// 刷新列表
|
||||
mV2XRoadEventAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示道路事件详情Windows
|
||||
*/
|
||||
@Override
|
||||
public void show(V2XPushMessageEntity entity) {
|
||||
Logger.d(MODULE_NAME, "V2X===推送消息:展示 Window=\n" + entity);
|
||||
// 更新头部的窗体视图
|
||||
updateTopWindowInfo(entity);
|
||||
// 倒计时
|
||||
mExpireTime = entity.getExpireTime();
|
||||
countDownV2XEvent();
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW, v2XVoiceCallbackCloseWindowListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP, v2XVoiceCallbackCloseWindowListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭详情展示框
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
Logger.d(MODULE_NAME, "V2X===关闭Window");
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.unRegisterWakeCmd(
|
||||
V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW)
|
||||
.unRegisterUnWakeVoice(
|
||||
V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP)
|
||||
.unRegisterPagingCallback()
|
||||
.unRegisterWakeCmd(
|
||||
V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING)
|
||||
.unRegisterWakeCmd(
|
||||
V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN)
|
||||
.unRegisterWakeCmd(
|
||||
V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REPORT)
|
||||
.unRegisterUnWakeVoice(
|
||||
V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(
|
||||
V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(
|
||||
V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_TRUE)
|
||||
.unRegisterUnWakeVoice(
|
||||
V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_ERROR);
|
||||
// 停止倒计时
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
|
||||
//移除窗体
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeView(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 窗体倒计时
|
||||
*/
|
||||
public void countDownV2XEvent() {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
Logger.d(MODULE_NAME, "V2X===30秒倒计时结束。。。");
|
||||
// 移出Window详细信息
|
||||
close();
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
Logger.d(MODULE_NAME, "V2X===推送消息 Window 展示开始倒计时:" + mExpireTime);
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, mExpireTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road;
|
||||
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum;
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
||||
@@ -12,10 +12,10 @@ import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -35,7 +35,6 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
public void init(V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity) {
|
||||
try {
|
||||
Logger.d(V2XConst.MODULE_NAME, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
|
||||
|
||||
V2XRoadEventEntity v2XRoadEventEntity = v2XMessageEntity.getContent();
|
||||
if (v2XRoadEventEntity != null) {
|
||||
if (v2XMessageEntity.isShowState()) {
|
||||
@@ -46,7 +45,6 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
} else {
|
||||
// 更新要提醒的数据
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
//Logger.w(V2XConst.MODULE_NAME, "要处理的场景已经存在,丢弃这次初始化");
|
||||
}
|
||||
} else {
|
||||
close();
|
||||
@@ -67,20 +65,14 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
// 设置TTS
|
||||
getV2XMessageEntity().getContent().getTts(false);
|
||||
}
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
boolean isMainPageOnResume = false;
|
||||
if (statusManager != null && statusManager.isMainPageOnResume()) {
|
||||
isMainPageOnResume = true;
|
||||
showWindow();
|
||||
}
|
||||
showWindow();
|
||||
IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics();
|
||||
if (analytics != null) {
|
||||
// 地图主动推送/触发消息 埋点
|
||||
String poiType = getV2XMessageEntity().getContent().getPoiType();
|
||||
String lat = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLat());
|
||||
String lon = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLon());
|
||||
String infoId = getV2XMessageEntity().getContent().getNoveltyInfo().getInfoId();
|
||||
String style = isMainPageOnResume ? "1" : "2";
|
||||
String style = "1";
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("dbid", infoId);
|
||||
properties.put("type", poiType);
|
||||
@@ -94,36 +86,12 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
private void showWindow() {
|
||||
V2XMessageEntity<V2XRoadEventEntity> entity = getV2XMessageEntity();
|
||||
V2XRoadEventEntity content = entity != null ? entity.getContent() : null;
|
||||
if (content != null) {
|
||||
CallerHmiManager.INSTANCE.showWarningV2X(entity.getType(), content.getAlarmContent(), content.getTts(), TAG, null, !entity.isOnlyShow(), 5000L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().close();
|
||||
}
|
||||
IMoGoV2XStatusManager statusManager = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (statusManager != null) {
|
||||
statusManager.setRoadEventWindowShow(TAG, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().setOnActionListener(this::showWindow);
|
||||
getV2XButton().show();
|
||||
IMoGoV2XStatusManager statusManager = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (statusManager != null) {
|
||||
statusManager.setRoadEventButtonShow(TAG, true);
|
||||
}
|
||||
//显示警告红边
|
||||
CallerHmiManager.INSTANCE.showWarningV2X(entity.getType(), content.getAlarmContent(), content.getTts(), TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(5));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,10 +116,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
@Override
|
||||
public void onShow() {
|
||||
Logger.d(V2XConst.MODULE_NAME, "弹窗展示");
|
||||
IMoGoV2XStatusManager status = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (status != null) {
|
||||
status.setRoadEventWindowShow(TAG, true);
|
||||
}
|
||||
CallerHmiManager.INSTANCE.showWarning(WarningDirectionEnum.ALERT_WARNING_TOP, TimeUnit.HOURS.toMillis(1));
|
||||
V2XMessageEntity<V2XRoadEventEntity> entity = getV2XMessageEntity();
|
||||
if (entity != null && entity.isNeedAddLine()) {
|
||||
drawPOI();
|
||||
@@ -161,10 +126,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
Logger.d(V2XConst.MODULE_NAME, "弹窗消失");
|
||||
IMoGoV2XStatusManager status = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (status != null) {
|
||||
status.setRoadEventWindowShow(TAG, false);
|
||||
}
|
||||
CallerHmiManager.INSTANCE.dismissWarning(WarningDirectionEnum.ALERT_WARNING_TOP);
|
||||
clearPOI();
|
||||
release();
|
||||
}
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
|
||||
import javax.security.auth.DestroyFailedException;
|
||||
import javax.security.auth.Destroyable;
|
||||
|
||||
public class V2XRoadVideoCarScenario extends AbsV2XScenario<V2XEventShowEntity> implements IMogoTopViewStatusListener, Destroyable {
|
||||
|
||||
private static V2XRoadVideoCarScenario sV2XRoadVideoCarScenario;
|
||||
private static String TAG = "V2XRoadVideoCarScenario";
|
||||
|
||||
public static V2XRoadVideoCarScenario getInstance() {
|
||||
if (sV2XRoadVideoCarScenario == null) {
|
||||
synchronized (V2XRoadVideoCarScenario.class) {
|
||||
if (sV2XRoadVideoCarScenario == null) {
|
||||
sV2XRoadVideoCarScenario = new V2XRoadVideoCarScenario();
|
||||
sV2XRoadVideoCarScenario.setV2XWindow(new V2XRoadVideoWindow());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return sV2XRoadVideoCarScenario;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<V2XEventShowEntity> v2XMessageEntity) {
|
||||
try {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
show();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
showWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
|
||||
getV2XWindow().show(getV2XMessageEntity().getContent());
|
||||
ViewGroup.LayoutParams layoutParams =
|
||||
new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) Utils.getApp().getResources()
|
||||
.getDimension(isVrMode ? R.dimen.dp_394:R.dimen.v2x_video_window_height));
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addViewNoLinkage(getV2XWindow().getView(), layoutParams, this);
|
||||
}
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setV2XAnimationWindowShow(TAG, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().close();
|
||||
}
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setV2XRoadVideoWindowShow(TAG, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
Log.d(TAG, "clearPOI");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void destroy() throws DestroyFailedException {
|
||||
//Log.d(TAG, "destroy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDestroyed() {
|
||||
//Log.d(TAG, "isDestroyed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
//Log.d(TAG, "onViewAdded");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
//Log.d(TAG, "onViewRemoved");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
|
||||
//Log.d(TAG, "beforeViewAddAnim");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
//Log.d(TAG, "beforeViewRemoveAnim");
|
||||
((V2XRoadVideoWindow) getV2XWindow()).pauseVideo();
|
||||
}
|
||||
}
|
||||
@@ -1,298 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.utilcode.util.BitmapHelper;
|
||||
import com.mogo.map.IDestroyable;
|
||||
import com.mogo.module.common.entity.MarkerExploreWayItem;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.view.SimpleCoverVideoPlayer;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
|
||||
import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack;
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType;
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static com.shuyu.gsyvideoplayer.utils.GSYVideoType.SCREEN_MATCH_FULL;
|
||||
|
||||
/**
|
||||
* https://github.com/CarGuo/GSYVideoPlayer/tree/master/doc SimpleCoverVideoPlayer文档
|
||||
*/
|
||||
public class V2XRoadVideoWindow extends V2XBasWindow implements
|
||||
IV2XWindow, IDestroyable {
|
||||
|
||||
private static final String TAG = "V2XRoadVideoWindow";
|
||||
private V2XWindowStatusListener mV2XWindowStatusListener;
|
||||
private ImageView playImageView;
|
||||
private ImageView thumbnailImage;
|
||||
private ImageView closeImage;
|
||||
|
||||
|
||||
private SimpleCoverVideoPlayer simpleCoverVideoPlayer;
|
||||
private Context mContext;
|
||||
|
||||
private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
|
||||
|
||||
|
||||
public V2XRoadVideoWindow() {
|
||||
this(BridgeApi.INSTANCE.context(), null);
|
||||
}
|
||||
|
||||
public V2XRoadVideoWindow(Context context) {
|
||||
this(context, null);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public V2XRoadVideoWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public V2XRoadVideoWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mContext = context;
|
||||
initView(mContext);
|
||||
}
|
||||
|
||||
private void initView(Context context) {
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
LayoutInflater.from(mContext).inflate(isVrMode ? R.layout.window_road_video_layout_vr : R.layout.window_road_video_layout, this);
|
||||
playImageView = this.findViewById(R.id.window_video_play);
|
||||
thumbnailImage = this.findViewById(R.id.thumbnail_image);
|
||||
simpleCoverVideoPlayer = this.findViewById(R.id.roadVideoView);
|
||||
GSYVideoType.setShowType(SCREEN_MATCH_FULL);
|
||||
closeImage = this.findViewById(R.id.roadVideoClose);
|
||||
closeImage.setOnClickListener(v -> {
|
||||
close();
|
||||
});
|
||||
simpleCoverVideoPlayer.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (simpleCoverVideoPlayer.getCurrentState() == GSYVideoView.CURRENT_STATE_PAUSE) {/*播放中*/
|
||||
resume();
|
||||
} else {
|
||||
pause();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始播放
|
||||
*/
|
||||
private void startPlayWithVideoUrl(String videoUrl) {
|
||||
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||
.build(simpleCoverVideoPlayer);
|
||||
simpleCoverVideoPlayer.getStartButton().performClick();
|
||||
thumbnailImage.setVisibility(View.GONE);
|
||||
playImageView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停
|
||||
*/
|
||||
private void pause() {
|
||||
playImageView.setVisibility(View.VISIBLE);
|
||||
thumbnailImage.setVisibility(View.GONE);
|
||||
playImageView.setOnClickListener(v -> {
|
||||
simpleCoverVideoPlayer.onVideoResume();
|
||||
});
|
||||
thumbnailImage.setOnClickListener(v -> {
|
||||
simpleCoverVideoPlayer.onVideoResume();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 继续
|
||||
*/
|
||||
private void resume() {
|
||||
playImageView.setImageResource(R.drawable.v2x_video_pause);
|
||||
playImageView.setVisibility(View.GONE);
|
||||
thumbnailImage.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 播放结束后
|
||||
*/
|
||||
private void complete(Bitmap firstbitmap, String path) {
|
||||
thumbnailImage.setVisibility(View.VISIBLE);
|
||||
thumbnailImage.setImageBitmap(firstbitmap);
|
||||
playImageView.setImageResource(R.drawable.v2x_icon_event_play);
|
||||
playImageView.setVisibility(View.VISIBLE);
|
||||
playImageView.setOnClickListener(v -> {
|
||||
startPlayWithVideoUrl(path);
|
||||
});
|
||||
thumbnailImage.setOnClickListener(v -> {
|
||||
startPlayWithVideoUrl(path);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(Object entity) {
|
||||
V2XEventShowEntity showEntity = (V2XEventShowEntity) entity;
|
||||
V2XRoadEventEntity xRoadEventEntity = showEntity.getV2XRoadEventEntity();
|
||||
ArrayList list = (ArrayList) xRoadEventEntity.getNoveltyInfo().getItems();
|
||||
if (list.size() > 0) {
|
||||
MarkerExploreWayItem item = (MarkerExploreWayItem) list.get(0);
|
||||
String path = item.getUrl();
|
||||
if (path == null) {
|
||||
return;
|
||||
}
|
||||
if (path.contains(".mp4")) {
|
||||
startPlayWithVideoUrl(path);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Bitmap firstBitmap = BitmapHelper.getVideoThumbnail(path);/*获取第一帧图*/
|
||||
simpleCoverVideoPlayer.setVideoAllCallBack(new VideoAllCallBack() {
|
||||
@Override
|
||||
public void onAutoComplete(String url, Object... objects) {
|
||||
complete(firstBitmap, path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickResume(String url, Object... objects) {
|
||||
thumbnailImage.setVisibility(View.GONE);
|
||||
playImageView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickStop(String url, Object... objects) {
|
||||
Log.d(TAG, "onClickStop");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartPrepared(String url, Object... objects) {
|
||||
Log.d(TAG, "onStartPrepared");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepared(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickStartIcon(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickStartError(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickStopFullscreen(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickResumeFullscreen(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickSeekbar(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickSeekbarFullscreen(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnterFullscreen(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQuitFullscreen(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQuitSmallWidget(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnterSmallWidget(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouchScreenSeekVolume(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouchScreenSeekPosition(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouchScreenSeekLight(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayError(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickStartThumb(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickBlank(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickBlankFullscreen(String url, Object... objects) {
|
||||
Log.d(TAG, "onClickBlankFullscreen");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
pauseVideo();
|
||||
//移除窗体
|
||||
IMogoTopViewManager iMogoTopViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (iMogoTopViewManager != null) {
|
||||
iMogoTopViewManager.removeViewNoLinkage(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void pauseVideo() {
|
||||
if (simpleCoverVideoPlayer != null) {
|
||||
simpleCoverVideoPlayer.onVideoPause();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
this.mV2XWindowStatusListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,18 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.route;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -29,28 +24,20 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
*/
|
||||
public class V2XOptimalRouteVREventScenario
|
||||
extends AbsV2XScenario<V2XOptimalRouteDataRes>
|
||||
implements IMogoTopViewStatusListener {
|
||||
implements IMoGoWarningStatusListener {
|
||||
private String TAG = "V2XPushVREventWindow";
|
||||
|
||||
public V2XOptimalRouteVREventScenario() {
|
||||
setV2XMarker(new V2XOptimalRouteVREventMarker());
|
||||
setV2XWindow(new V2XOptimalRouteVREventWindow());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<V2XOptimalRouteDataRes> v2XMessageEntity) {
|
||||
Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "处理推送VR:" + GsonUtil.jsonFromObject(v2XMessageEntity));
|
||||
boolean isMainPageOnResume = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isMainPageOnResume = statusManager.isMainPageOnResume();
|
||||
}
|
||||
if (!isSameScenario(v2XMessageEntity)
|
||||
&& isMainPageOnResume) {
|
||||
if (!isSameScenario(v2XMessageEntity)) {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
show();
|
||||
} else {
|
||||
closeWindow();
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
show();
|
||||
Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "要处理的场景已经存在,丢弃这次初始化");
|
||||
@@ -59,62 +46,20 @@ public class V2XOptimalRouteVREventScenario
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) {
|
||||
speakTTSVoice("已为您选择最优路线", null);
|
||||
drawPOI();
|
||||
showWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
ViewGroup.LayoutParams layoutParams =
|
||||
new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_height_ground));
|
||||
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
V2XMessageEntity<V2XOptimalRouteDataRes> entity = getV2XMessageEntity();
|
||||
if (entity != null) {
|
||||
V2XOptimalRouteDataRes content = entity.getContent();
|
||||
if (content != null) {
|
||||
CallerHmiManager.INSTANCE.showWarningV2X(entity.getType(), "为您推荐最优路线", "已为您选择最优路线", TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(30));
|
||||
}
|
||||
getV2XWindow().show(getV2XMessageEntity().getContent());
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setPushWindowShow(TAG, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setPushWindowShow(TAG, false);
|
||||
}
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
|
||||
IV2XMarker marker = getV2XMarker();
|
||||
if (marker != null) {
|
||||
marker.drawPOI(getV2XMessageEntity().getContent());
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setPushPOIShow(TAG, true);
|
||||
@@ -133,34 +78,13 @@ public class V2XOptimalRouteVREventScenario
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "展示 Window 动画结束");
|
||||
public void onShow() {
|
||||
drawPOI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "关闭 Window 动画结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "展示 Window 开始");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "关闭 Window 开始");
|
||||
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setPushWindowShow(TAG, false);
|
||||
}
|
||||
// 重置场景提示的消息
|
||||
setV2XMessageEntity(null);
|
||||
public void onDismiss() {
|
||||
clearPOI();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.route;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/14 2:37 PM
|
||||
* desc :
|
||||
* TODO 只有VR演示场景使用
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XOptimalRouteVREventWindow
|
||||
extends V2XBasWindow
|
||||
implements IV2XWindow<V2XOptimalRouteDataRes> {
|
||||
private String TAG = "V2XPushVREventWindow";
|
||||
|
||||
// 处理道路事件,30秒倒计时
|
||||
private Handler handlerV2XEvent = new Handler();
|
||||
private Runnable runnableV2XEvent;
|
||||
private int mExpireTime = 30000;
|
||||
|
||||
public V2XOptimalRouteVREventWindow() {
|
||||
this(BridgeApi.INSTANCE.context());
|
||||
}
|
||||
|
||||
public V2XOptimalRouteVREventWindow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XOptimalRouteVREventWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XOptimalRouteVREventWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
// 填充布局
|
||||
LayoutInflater.from(context).inflate(R.layout.vr_window_top_tips, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示道路事件详情Windows
|
||||
*/
|
||||
@Override
|
||||
public void show(V2XOptimalRouteDataRes entity) {
|
||||
|
||||
countDownV2XEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭详情展示框
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=关闭Window");
|
||||
// 停止倒计时
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
|
||||
//移除窗体
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeView(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 窗体倒计时
|
||||
*/
|
||||
public void countDownV2XEvent() {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=30秒倒计时结束。。。");
|
||||
// 移出Window详细信息
|
||||
close();
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=推送消息 Window 展示开始倒计时:" + mExpireTime);
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, mExpireTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,206 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.seek;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.ADASUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 5:37 PM
|
||||
* desc : 故障求助场景
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XSpecialCarRes.V2XMarkerEntity>> implements IMogoTopViewStatusListener {
|
||||
|
||||
|
||||
public V2XSeekHelpScenario() {
|
||||
setV2XWindow(new V2XSeekHelpWindow());
|
||||
// TODO 这里引起了地图的崩溃,由于本次交付不包含此功能,所以先注释掉 2021-12-13
|
||||
//setV2XMarker(new V2XSeekHelpMarker());
|
||||
}
|
||||
|
||||
private List<V2XSpecialCarRes.V2XMarkerEntity> mMarkerEntity;
|
||||
private V2XPushMessageEntity mV2XPushMessageEntity;
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> v2XMessageEntity) {
|
||||
try {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
|
||||
// 广播给ADAS和Launcher卡片
|
||||
V2XRoadEventEntity eventEntity = new V2XRoadEventEntity();
|
||||
eventEntity.setPoiType(EventTypeEnum.ALERT_CAR_TROUBLE_WARNING.getPoiType());
|
||||
eventEntity.setExpireTime(30000);
|
||||
eventEntity.setTts("发现其他车主的求助信息");
|
||||
eventEntity.setAlarmContent("其他车主求助");
|
||||
ADASUtils.broadcastToADAS(BridgeApi.INSTANCE.context(), eventEntity);
|
||||
|
||||
mMarkerEntity = getV2XMessageEntity().getContent();
|
||||
|
||||
V2XSpecialCarRes.V2XMarkerEntity markerEntity = mMarkerEntity.get(0);
|
||||
mV2XPushMessageEntity = new V2XPushMessageEntity();
|
||||
mV2XPushMessageEntity.setLon(markerEntity.getLon());
|
||||
mV2XPushMessageEntity.setLat(markerEntity.getLat());
|
||||
mV2XPushMessageEntity.setDisplayName(markerEntity.getUserInfo().getDisplayName());
|
||||
mV2XPushMessageEntity.setHeadImgUrl(markerEntity.getUserInfo().getHeadImgUrl());
|
||||
mV2XPushMessageEntity.setSex(markerEntity.getUserInfo().getSex());
|
||||
mV2XPushMessageEntity.setSn(markerEntity.getUserInfo().getSn());
|
||||
mV2XPushMessageEntity.setCreateTime(markerEntity.getCreateTime());
|
||||
mV2XPushMessageEntity.setDistance(markerEntity.getDistance());
|
||||
mV2XPushMessageEntity.setExpireTime(20000);
|
||||
saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING, mV2XPushMessageEntity);
|
||||
boolean isMainPageOnResume = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isMainPageOnResume = statusManager.isMainPageOnResume();
|
||||
}
|
||||
boolean isOtherSeekHelpWindowShow = false;
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
isOtherSeekHelpWindowShow = v2xStatus.isOtherSeekHelpWindowShow();
|
||||
}
|
||||
if (isMainPageOnResume) {
|
||||
if (getV2XMessageEntity() != null &&
|
||||
!isOtherSeekHelpWindowShow) {
|
||||
show();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
showWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
if (getV2XWindow() != null && mMarkerEntity != null) {
|
||||
View view = getV2XWindow().getView();
|
||||
//Logger.d(MODULE_NAME, "添加window= " + view);
|
||||
ViewGroup.LayoutParams layoutParams =
|
||||
new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground));
|
||||
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
}
|
||||
getV2XWindow().show(mV2XPushMessageEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
|
||||
boolean isOtherSeekHelpWindowShow = false;
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
isOtherSeekHelpWindowShow = v2xStatus.isOtherSeekHelpWindowShow();
|
||||
}
|
||||
if (isOtherSeekHelpWindowShow) {
|
||||
//Logger.d(MODULE_NAME, "关闭求助车辆的Window!");
|
||||
v2xStatus.setOtherSeekHelpWindowShow(TAG, false);
|
||||
if (getV2XWindow() != null) {
|
||||
View view = getV2XWindow().getView();
|
||||
//Logger.d(MODULE_NAME, "移除window= " + view);
|
||||
getV2XWindow().close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
if (getV2XMarker() != null && mMarkerEntity != null) {
|
||||
getV2XMarker().drawPOI(mMarkerEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().clearPOI();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
//Logger.d(MODULE_NAME, "展示 Window 动画结束");
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setOtherSeekHelpWindowShow(TAG, true);
|
||||
}
|
||||
drawPOI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
//Logger.d(MODULE_NAME, "关闭 Window 动画结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
//Logger.d(MODULE_NAME, "展示 Window 开始");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
//Logger.d(MODULE_NAME, "关闭 Window 开始");
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setOtherSeekHelpWindowShow(TAG, false);
|
||||
}
|
||||
// 重置场景提示的消息
|
||||
setV2XMessageEntity(null);
|
||||
clearPOI();
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储本地数据
|
||||
*
|
||||
* @param messageEntity 要存储的场景
|
||||
*/
|
||||
private void saveLocalStory(int scenarioType, V2XPushMessageEntity messageEntity) {
|
||||
ThreadUtils.getIoPool().execute(() -> {
|
||||
try {
|
||||
V2XSQLiteUtils.saveLocalStory(scenarioType, messageEntity, messageEntity.hashCode());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.seek;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 5:37 PM
|
||||
* desc : 他人发起的故障求助
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XSeekHelpWindow extends V2XBasWindow implements IV2XWindow<V2XPushMessageEntity> {
|
||||
private static final String TAG = "V2XSeekHelpWindow";
|
||||
|
||||
// 展示列表
|
||||
private RecyclerView mRecyclerView;
|
||||
// 列表数据适配器
|
||||
private V2XRoadEventAdapter mV2XRoadEventAdapter;
|
||||
// 列表展示
|
||||
private List<V2XEventShowEntity> mItemList = new ArrayList<>();
|
||||
|
||||
// 直播30秒自动关闭
|
||||
private static Handler handlerV2XEvent = new Handler();
|
||||
private static Runnable runnableV2XEvent;
|
||||
|
||||
// 推荐的停车场
|
||||
private V2XPushMessageEntity mV2XPushMessageEntity;
|
||||
|
||||
public V2XSeekHelpWindow() {
|
||||
this(BridgeApi.INSTANCE.context(), null);
|
||||
}
|
||||
|
||||
public V2XSeekHelpWindow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XSeekHelpWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XSeekHelpWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
private void initView(Context context) {
|
||||
//Logger.w(MODULE_NAME, "初始化道路故障求助窗口View。。。。。");
|
||||
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
|
||||
// 详情列表
|
||||
mRecyclerView = findViewById(R.id.rvRoadEventList);
|
||||
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
|
||||
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
|
||||
// 设置切换样式
|
||||
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
|
||||
// 配置列表朝向
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
if (recyclerView.getChildCount() > 0) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
// 用户处于交互的时候延后隐藏时间
|
||||
countDownV2XEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(V2XPushMessageEntity xPushMessageEntity) {
|
||||
if (xPushMessageEntity != null) {
|
||||
mV2XPushMessageEntity = xPushMessageEntity;
|
||||
// 清空数据
|
||||
mItemList.clear();
|
||||
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
|
||||
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
|
||||
v2XEventShowEntity.setV2XPushMessageEntity(xPushMessageEntity);
|
||||
v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING);
|
||||
mItemList.add(v2XEventShowEntity);
|
||||
// 刷新列表
|
||||
mV2XRoadEventAdapter.notifyDataSetChanged();
|
||||
countDownV2XEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
//Logger.d(TAG, "移除window= " + this);
|
||||
// 停止倒计时
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
//移除窗体
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeView(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 窗体倒计时
|
||||
*/
|
||||
public void countDownV2XEvent() {
|
||||
if (mV2XPushMessageEntity != null) {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
//Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。");
|
||||
// 移出Window详细信息
|
||||
close();
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
int expireTime = mV2XPushMessageEntity.getExpireTime();
|
||||
//Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + expireTime);
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, expireTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.ugc;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 5:37 PM
|
||||
* desc : 道路事件UGC
|
||||
* 需求地址
|
||||
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XEventUgcScenario extends AbsV2XScenario<V2XRoadEventEntity> implements IMogoTopViewStatusListener {
|
||||
|
||||
public V2XEventUgcScenario() {
|
||||
setV2XWindow(new V2XEventUgcWindow());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity) {
|
||||
if (!isSameScenario(v2XMessageEntity)) {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
if (v2XMessageEntity != null) {
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
boolean isMainOnPageOnResume = false;
|
||||
if (statusManager != null) {
|
||||
isMainOnPageOnResume = statusManager.isMainPageOnResume();
|
||||
}
|
||||
if (v2XMessageEntity.isShowState()
|
||||
&& isMainOnPageOnResume) {
|
||||
show();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
Logger.w(V2XConst.MODULE_NAME, "疲劳驾驶场景,要处理的场景已经存在,丢弃这次初始化");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
showWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
ViewGroup.LayoutParams layoutParams =
|
||||
new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground));
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
}
|
||||
getV2XWindow().show(getV2XMessageEntity().getContent());
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setFatigueDrivingWindowShow(TAG, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
//Logger.d(MODULE_NAME, "疲劳驾驶场景 展示 Window 动画结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
//Logger.d(MODULE_NAME, "疲劳驾驶场景 关闭 Window 动画结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
//Logger.d(MODULE_NAME, "疲劳驾驶场景 展示 Window 开始");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
//Logger.d(MODULE_NAME, "疲劳驾驶场景 关闭 Window 开始");
|
||||
// 重置场景提示的消息
|
||||
setV2XMessageEntity(null);
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
v2xStatus.setFatigueDrivingWindowShow(TAG, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.ugc;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/24 11:34 AM
|
||||
* desc : 道路事件UGC
|
||||
* 需求地址
|
||||
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XEventUgcWindow extends V2XBasWindow
|
||||
implements IV2XWindow<V2XRoadEventEntity> {
|
||||
// 展示列表
|
||||
private RecyclerView mRecyclerView;
|
||||
// 列表数据适配器
|
||||
private V2XRoadEventAdapter mV2XRoadEventAdapter;
|
||||
// 列表展示
|
||||
private List<V2XEventShowEntity> mItemList = new ArrayList<>();
|
||||
|
||||
// 直播30秒自动关闭
|
||||
private static Handler handlerV2XEvent = new Handler();
|
||||
private static Runnable runnableV2XEvent;
|
||||
|
||||
//
|
||||
private V2XRoadEventEntity mV2XRoadEventEntity;
|
||||
|
||||
public V2XEventUgcWindow() {
|
||||
this(BridgeApi.INSTANCE.context(), null);
|
||||
}
|
||||
|
||||
public V2XEventUgcWindow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XEventUgcWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XEventUgcWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public void initView(Context context) {
|
||||
Logger.w(MODULE_NAME, "V2X-初始化UGC的Window");
|
||||
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
|
||||
// 详情列表
|
||||
mRecyclerView = findViewById(R.id.rvRoadEventList);
|
||||
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
|
||||
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
|
||||
// 设置切换样式
|
||||
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
|
||||
// 配置列表朝向
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
if (recyclerView.getChildCount() > 0) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
// 用户处于交互的时候延后隐藏时间
|
||||
countDownV2XEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 展示道路事件详情Windows
|
||||
*/
|
||||
@Override
|
||||
public void show(V2XRoadEventEntity entity) {
|
||||
if (entity != null) {
|
||||
mV2XRoadEventEntity = entity;
|
||||
// 清空数据
|
||||
mItemList.clear();
|
||||
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
|
||||
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
|
||||
v2XEventShowEntity.setV2XRoadEventEntity(mV2XRoadEventEntity);
|
||||
v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING);
|
||||
mItemList.add(v2XEventShowEntity);
|
||||
// 刷新列表
|
||||
mV2XRoadEventAdapter.notifyDataSetChanged();
|
||||
|
||||
countDownV2XEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
// 停止倒计时
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
|
||||
//移除窗体
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeView(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 窗体倒计时
|
||||
*/
|
||||
public void countDownV2XEvent() {
|
||||
if (mV2XRoadEventEntity != null) {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
//Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。");
|
||||
// 移出Window详细信息
|
||||
close();
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
int expireTime = mV2XRoadEventEntity.getExpireTime();
|
||||
//Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + expireTime);
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, expireTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +1,39 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.warning;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener;
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 车路云—场景预警-V1.0 前车/行人/摩托车/盲区碰撞预警
|
||||
* @since: 2021/3/24
|
||||
*/
|
||||
public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopViewStatusListener ,IMoGoMapLocationListener{
|
||||
public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapLocationListener, IMoGoWarningStatusListener {
|
||||
private static final String TAG = "V2XWarningMarker";
|
||||
private V2XWarningEntity mMarkerEntity;
|
||||
static private V2XWarningMarker sV2XWarningMarker = new V2XWarningMarker();
|
||||
|
||||
private WarningDirectionEnum mDirection;
|
||||
|
||||
public V2XFrontWarningScenario() {
|
||||
setV2XWindow(new V2XWarningWindow());
|
||||
setV2XMarker(sV2XWarningMarker);
|
||||
}
|
||||
|
||||
@@ -37,18 +41,10 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
public void init(@Nullable V2XMessageEntity v2XMessageEntity) {
|
||||
Log.d(TAG, "----- init -----:\n" + (v2XMessageEntity == null ? "null" : v2XMessageEntity.toString()));
|
||||
try {
|
||||
if (v2XMessageEntity.getContent() != null) {
|
||||
boolean isMainPageOnResume = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isMainPageOnResume = statusManager.isMainPageOnResume();
|
||||
}
|
||||
if (isMainPageOnResume) {
|
||||
mMarkerEntity = (V2XWarningEntity) v2XMessageEntity.getContent();
|
||||
show();
|
||||
}
|
||||
} else {
|
||||
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
if (v2XMessageEntity != null && v2XMessageEntity.getContent() instanceof V2XWarningEntity) {
|
||||
mMarkerEntity = (V2XWarningEntity) v2XMessageEntity.getContent();
|
||||
show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -57,46 +53,46 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
showWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
Log.d(TAG, "----- showWindow --- 1 --:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString()));
|
||||
if (getV2XWindow() != null && mMarkerEntity != null) {
|
||||
Log.d(TAG, "----- showWindow --- 2 --:\n" + mMarkerEntity.toString());
|
||||
ViewGroup.LayoutParams layoutParams =
|
||||
new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground));
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
Log.d(TAG, "----- show --- 1 --:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString()));
|
||||
if (mMarkerEntity != null) {
|
||||
Log.d(TAG, "----- show --- 2 --:\n" + mMarkerEntity);
|
||||
int v2xType = getV2XTypeForFrontWarning(mMarkerEntity);
|
||||
V2XMessageEntity entity = getV2XMessageEntity();
|
||||
if (v2xType != 0) {
|
||||
CallerHmiManager.INSTANCE.showWarningV2X(v2xType, getAlertContentForFrontWarning(mMarkerEntity), mMarkerEntity.getTts(), TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(3));
|
||||
}
|
||||
getV2XWindow().show(mMarkerEntity);
|
||||
getV2XMarker().drawPOI(mMarkerEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
Log.d(TAG, "----- closeWindow -----:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString()));
|
||||
private int getV2XTypeForFrontWarning(V2XWarningEntity entity) {
|
||||
switch (entity.getType()) {
|
||||
case 1:
|
||||
case 11:
|
||||
return 0X2B0201;
|
||||
case 2:
|
||||
case 4:
|
||||
return 0X2B0202;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
Log.d(TAG, "----- showButton -----:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
Log.d(TAG, "----- closeButton -----:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString()));
|
||||
private CharSequence getAlertContentForFrontWarning(V2XWarningEntity entity) {
|
||||
double dis = entity.getDistance();
|
||||
//距离四舍五入保留整数
|
||||
BigDecimal bg = new BigDecimal(dis);
|
||||
double disBig = bg.setScale(0, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
String distance = String.format(Locale.getDefault(), "%.0f", disBig) + "米";
|
||||
String content = entity.getWarningContent();
|
||||
SpannableStringBuilder ssb = new SpannableStringBuilder(content + distance);
|
||||
ssb.setSpan(new ForegroundColorSpan(Color.parseColor("#FF3036")), content.length(), ssb.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return ssb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().drawPOI(mMarkerEntity);
|
||||
IV2XMarker marker = getV2XMarker();
|
||||
if (marker != null && mMarkerEntity != null) {
|
||||
marker.drawPOI(mMarkerEntity);
|
||||
Log.d(TAG, "drawPOI");
|
||||
}
|
||||
}
|
||||
@@ -106,35 +102,42 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
Log.d(TAG, "----- clearPOI -----");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
|
||||
Log.d(TAG, "----- onViewAdded -----");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
Log.d(TAG, "----- onViewRemoved -----");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
Log.d(TAG, "----- beforeViewAddAnim -----");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
Log.d(TAG, "----- beforeViewRemoveAnim -----");
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void onCarLocationChanged2(Location latLng) {
|
||||
// sV2XWarningMarker.onCarLocationChanged2(latLng);
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location) {
|
||||
sV2XWarningMarker.onCarLocationChanged2(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShow() {
|
||||
//预警蒙层
|
||||
WarningDirectionEnum warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_ALL;
|
||||
switch (mMarkerEntity.getDirection()) {
|
||||
case 0:
|
||||
warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_NON;
|
||||
break;
|
||||
case 1:
|
||||
warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_TOP;
|
||||
break;
|
||||
case 2:
|
||||
warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_BOTTOM;
|
||||
break;
|
||||
case 3:
|
||||
warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_LEFT;
|
||||
break;
|
||||
case 4:
|
||||
warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_RIGHT;
|
||||
break;
|
||||
}
|
||||
CallerHmiManager.INSTANCE.showWarning(warningDirectionEnum, TimeUnit.HOURS.toMillis(1));
|
||||
mDirection = warningDirectionEnum;
|
||||
drawPOI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
if (mDirection != null) {
|
||||
CallerHmiManager.INSTANCE.dismissWarning(mDirection);
|
||||
}
|
||||
clearPOI();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,27 +136,6 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
|
||||
}
|
||||
clearAllLine();
|
||||
//预警蒙层
|
||||
WarningDirectionEnum warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_ALL;
|
||||
switch (mCloundWarningInfo.getDirection()) {
|
||||
case 0:
|
||||
warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_NON;
|
||||
break;
|
||||
case 1:
|
||||
warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_TOP;
|
||||
break;
|
||||
case 2:
|
||||
warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_BOTTOM;
|
||||
break;
|
||||
case 3:
|
||||
warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_LEFT;
|
||||
break;
|
||||
case 4:
|
||||
warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_RIGHT;
|
||||
break;
|
||||
}
|
||||
CallerHmiManager.INSTANCE.showWarning(warningDirectionEnum);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.warning;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 车路云—场景预警 http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=52829799
|
||||
* @since: 2021/3/25
|
||||
*/
|
||||
public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow {
|
||||
private static final String TAG = "V2XWarningMarker";
|
||||
private ImageView typeImage;
|
||||
private TextView warningTextView;
|
||||
private TextView distance;
|
||||
private V2XWarningEntity mV2XWarningEntity;
|
||||
|
||||
//倒计时3s弹框取消
|
||||
private static Handler handlerV2XEvent = new Handler();
|
||||
private static Runnable runnableV2XEvent;
|
||||
private static final int COUNT_DOWN_TIMER = 1_000;
|
||||
private static final int ALL_EXPIRE_TIMER = 3_000;
|
||||
private static int EXPIRE_TIMER = ALL_EXPIRE_TIMER;
|
||||
|
||||
public V2XWarningWindow() {
|
||||
this(BridgeApi.INSTANCE.context(), null);
|
||||
}
|
||||
|
||||
public V2XWarningWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XWarningWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
private void initView(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.v2x_road_front_warning_vr, this);
|
||||
typeImage = findViewById(R.id.warning_type_image);
|
||||
|
||||
warningTextView = findViewById(R.id.warning_content_text);
|
||||
distance = findViewById(R.id.warning_distance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(Object entity) {
|
||||
if (entity != null) {
|
||||
mV2XWarningEntity = (V2XWarningEntity) entity;
|
||||
Log.d(TAG, mV2XWarningEntity.toString());
|
||||
//1行人/2自行车/4摩托车
|
||||
switch (mV2XWarningEntity.getType()) {
|
||||
case 1:
|
||||
case 11:
|
||||
typeImage.setImageResource(R.drawable.v2x_road_front_p_warning);
|
||||
break;
|
||||
case 2:
|
||||
case 4:
|
||||
typeImage.setImageResource(R.drawable.v2x_road_front_m_warning);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
double dis = mV2XWarningEntity.getDistance();
|
||||
//距离四舍五入保留整数
|
||||
BigDecimal bg = new BigDecimal(dis);
|
||||
double disBig = bg.setScale(0, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
distance.setText(String.format("%.0f", disBig) + "米");
|
||||
warningTextView.setText(mV2XWarningEntity.getWarningContent());//验证云端数据是否
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice(mV2XWarningEntity.getTts());
|
||||
}
|
||||
//3秒后移除提示弹框
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
EXPIRE_TIMER = EXPIRE_TIMER - COUNT_DOWN_TIMER;
|
||||
if (EXPIRE_TIMER > 0) {
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER);
|
||||
} else {
|
||||
stopCountDown();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
stopCountDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
|
||||
}
|
||||
|
||||
private void stopCountDown() {
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
EXPIRE_TIMER = ALL_EXPIRE_TIMER;
|
||||
}
|
||||
//移除窗体
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeView(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,9 +2,6 @@ package com.mogo.eagle.core.function.v2x.events.scenario.view;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
|
||||
|
||||
/**
|
||||
* @ProjectName: MoGoModulSafeDriving
|
||||
* @Package: com.mogo.module.v2x.statusmanager
|
||||
@@ -35,11 +32,4 @@ public interface IV2XWindow<T> {
|
||||
* @return 当前窗体
|
||||
*/
|
||||
View getView();
|
||||
|
||||
/**
|
||||
* 设置Window状态监听
|
||||
*
|
||||
* @param listener 监听器
|
||||
*/
|
||||
void setWindowStatusListener(V2XWindowStatusListener listener);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.utils;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes;
|
||||
@@ -188,6 +190,7 @@ public class TestOnLineCarUtils {
|
||||
|
||||
// 加载数据源
|
||||
V2XWarningEntity warningEntity = GsonUtil.objectFromJson(baos.toString(), V2XWarningEntity.class);
|
||||
Log.d("XXX", GsonUtil.jsonFromObject(warningEntity));
|
||||
V2XMessageEntity messageEntity = new V2XMessageEntity();
|
||||
messageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS);
|
||||
messageEntity.setContent(warningEntity);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
android:id="@+id/warning_type_image"
|
||||
android:layout_width="@dimen/module_v2x_event_warning_type_image_size"
|
||||
android:layout_height="@dimen/module_v2x_event_warning_type_image_size"
|
||||
android:src="@drawable/v2x_optimal_route_warning"
|
||||
android:src="@drawable/icon_warning_v2x_optimal_route"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -52,7 +52,7 @@ interface IMoGoWaringProvider {
|
||||
* @param ttsContent tts语音播报消息
|
||||
* @param tag tag绑定弹窗的标志
|
||||
*/
|
||||
fun showWarningV2X(v2xType: Int, alertContent: String?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long)
|
||||
fun showWarningV2X(v2xType: Int, alertContent: CharSequence?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long)
|
||||
|
||||
/**
|
||||
* 关闭指定floatTag 的 VR下V2X预警弹窗
|
||||
@@ -126,6 +126,11 @@ interface IMoGoWaringProvider {
|
||||
*/
|
||||
fun showWarning(direction: WarningDirectionEnum, closeTime: Long)
|
||||
|
||||
/**
|
||||
* 主动消失边框预警
|
||||
*/
|
||||
fun dismissWarning(direction: WarningDirectionEnum)
|
||||
|
||||
/**
|
||||
* 呈现交警推送消息顶部弹框
|
||||
*
|
||||
@@ -174,5 +179,4 @@ interface IMoGoWaringProvider {
|
||||
*/
|
||||
fun showAdUpgradeStatus(upgradeMode : Int,downloadStatus : Int,currentProgress : Int,totalProgress : Int
|
||||
,downloadVersion : String,upgradeStatus : Int)
|
||||
|
||||
}
|
||||
@@ -74,7 +74,7 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param ttsContent tts语音播报消息
|
||||
* @param tag tag绑定弹窗的标志
|
||||
*/
|
||||
fun showWarningV2X(v2xType: Int, alertContent: String?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long = 5000L) {
|
||||
fun showWarningV2X(v2xType: Int, alertContent: CharSequence?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long = 5000L) {
|
||||
waringProviderApi.showWarningV2X(v2xType, alertContent, ttsContent, tag, listenerIMoGo, playTts, expireTime)
|
||||
}
|
||||
|
||||
@@ -174,6 +174,13 @@ object CallerHmiManager : CallerBase() {
|
||||
waringProviderApi.showWarning(direction, closeTime)
|
||||
}
|
||||
|
||||
/**
|
||||
* 主动消失边框预警
|
||||
*/
|
||||
fun dismissWarning(direction: WarningDirectionEnum) {
|
||||
waringProviderApi.dismissWarning(direction)
|
||||
}
|
||||
|
||||
/**
|
||||
* 呈现交通云公告弹窗(hmi)
|
||||
*
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
@@ -372,7 +372,10 @@ enum class EventTypeEnum(
|
||||
tts = ""
|
||||
),
|
||||
|
||||
TYPE_VIP_IDENTIFICATION("10022", "", "", R.drawable.icon_warning_v2x_vip_turn_light, "VIP车辆优先通行", "已为您变灯,请优先通行");
|
||||
TYPE_VIP_IDENTIFICATION("10022", "", "", R.drawable.icon_warning_v2x_vip_turn_light, "VIP车辆优先通行", "已为您变灯,请优先通行"),
|
||||
|
||||
TYPE_OPTIMAL_ROUTE_RECOMMEND("2000", "", "", R.drawable.icon_warning_v2x_optimal_route, "为您推荐最优路线", "已为您选择最优路线");
|
||||
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
@@ -402,6 +405,7 @@ enum class EventTypeEnum(
|
||||
|
||||
FOURS_NEALY.poiType -> FOURS_NEALY.poiTypeStr
|
||||
FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeStr
|
||||
|
||||
else -> "其它道路事件"
|
||||
}
|
||||
}
|
||||
@@ -806,6 +810,7 @@ enum class EventTypeEnum(
|
||||
TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType -> TYPE_USECASE_ID_ROAD_GIVE_WAY.poiTypeSrcVr
|
||||
TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.poiTypeSrcVr
|
||||
TYPE_ERROR.poiType -> TYPE_ERROR.poiTypeSrcVr
|
||||
TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.poiTypeSrcVr
|
||||
else -> TYPE_ERROR.poiTypeSrcVr
|
||||
}
|
||||
}
|
||||
@@ -846,6 +851,7 @@ enum class EventTypeEnum(
|
||||
TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.content
|
||||
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.content
|
||||
TYPE_ERROR.poiType -> TYPE_ERROR.content
|
||||
TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.content
|
||||
else -> TYPE_ERROR.content
|
||||
}
|
||||
}
|
||||
@@ -886,6 +892,7 @@ enum class EventTypeEnum(
|
||||
TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.tts
|
||||
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.tts
|
||||
TYPE_ERROR.poiType -> TYPE_ERROR.tts
|
||||
TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.tts
|
||||
else -> TYPE_ERROR.tts
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.mogo.service.v2x;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 2021/6/4
|
||||
*/
|
||||
public interface IV2XWindowManagerListener {
|
||||
//移除v2x的所有道路事件及预警弹框
|
||||
void removeTipWindowByListener();
|
||||
}
|
||||
Reference in New Issue
Block a user