diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java index 06b227fd4f..fa5adf8e1a 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java @@ -29,6 +29,9 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager; +import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView; +import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView; +import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView; import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener; @@ -77,6 +80,11 @@ public abstract class BaseBusTabFragment private ImageView mSwitchMapModeImage; private LinearLayout mSwitchMapModeLayout; + //消息盒子 + private DriverMsgBoxButtonView viewDriverMsgBoxButton; + private DriverMsgBoxListView viewDriverMsgBoxList; + private DriverMsgBoxBubbleView viewDriverMsgBoxBubble; + private ObjectAnimator autopilotLoadingAnimator; public boolean isAnimateRunning = false; @@ -194,6 +202,22 @@ public abstract class BaseBusTabFragment if (mAICollectBtn != null) { CallerDevaToolsManager.INSTANCE.initAiCollect(mAICollectBtn); } + //消息盒子 + viewDriverMsgBoxButton = findViewById(R.id.viewDriverMsgBoxButton); + viewDriverMsgBoxList = findViewById(R.id.viewDriverMsgBoxList); + viewDriverMsgBoxBubble = findViewById(R.id.viewDriverMsgBoxBubble); + viewDriverMsgBoxButton.setClickListener(show -> { + if(show){ + viewDriverMsgBoxList.setVisibility(View.VISIBLE); + viewDriverMsgBoxList.notifyData(); + viewDriverMsgBoxBubble.setVisibility(View.GONE); + viewDriverMsgBoxBubble.isShowData(false); + }else{ + viewDriverMsgBoxList.setVisibility(View.GONE); + viewDriverMsgBoxBubble.setVisibility(View.VISIBLE); + viewDriverMsgBoxBubble.isShowData(true); + } + }); } @Nullable diff --git a/OCH/mogo-och-bus/src/main/res/layout/bus_base_fragment.xml b/OCH/mogo-och-bus/src/main/res/layout/bus_base_fragment.xml index fae3e46139..4a79c2c3a4 100644 --- a/OCH/mogo-och-bus/src/main/res/layout/bus_base_fragment.xml +++ b/OCH/mogo-och-bus/src/main/res/layout/bus_base_fragment.xml @@ -56,6 +56,7 @@ android:layout_width="120dp" android:layout_height="120dp" android:layout_marginTop="45dp" + android:layout_marginEnd="40dp" app:layout_constraintRight_toLeftOf="@id/viewTrafficLightVr" app:layout_constraintTop_toTopOf="parent" tools:ignore="SpeakableTextPresentCheck" @@ -63,6 +64,7 @@ + + + + + + + mArrivedCheckView; private WeakReference mStartAutopilotView; protected TaxiPassengerServingOrderFragment ochServingOrderFragment = null; + //消息盒子 + private PassengerMsgBoxButtonView viewPassengerMsgBoxButton; + private PassengerMsgBoxBubbleView viewPassengerMsgBoxBubble; + private PassengerMsgBoxListView viewPassengerMsgBoxList; private final Handler mHandler = new Handler(Looper.getMainLooper()); @@ -100,6 +107,22 @@ public class TaxiPassengerBaseFragment extends MvpFragment { + if(show){ + viewPassengerMsgBoxList.setVisibility(View.VISIBLE); + viewPassengerMsgBoxBubble.setVisibility(View.GONE); + viewPassengerMsgBoxBubble.isShowData(false); + }else{ + viewPassengerMsgBoxList.setVisibility(View.GONE); + viewPassengerMsgBoxBubble.setVisibility(View.VISIBLE); + viewPassengerMsgBoxBubble.isShowData(true); + } + }); } private void updateSwitchMapIcon() { diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml index 110316f5c8..da536a4b66 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml @@ -50,6 +50,36 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" /> + + + + + + { + if(show){ + viewDriverMsgBoxList.setVisibility(View.VISIBLE); + viewDriverMsgBoxList.notifyData(); + viewDriverMsgBoxBubble.setVisibility(View.GONE); + viewDriverMsgBoxBubble.isShowData(false); + }else{ + viewDriverMsgBoxList.setVisibility(View.GONE); + viewDriverMsgBoxBubble.setVisibility(View.VISIBLE); + viewDriverMsgBoxBubble.isShowData(true); + } + }); } protected void onChangeOperationStatus() { diff --git a/OCH/mogo-och-taxi/src/main/res/layout/taxi_base_fragment.xml b/OCH/mogo-och-taxi/src/main/res/layout/taxi_base_fragment.xml index eadaf14b51..7490477aa1 100644 --- a/OCH/mogo-och-taxi/src/main/res/layout/taxi_base_fragment.xml +++ b/OCH/mogo-och-taxi/src/main/res/layout/taxi_base_fragment.xml @@ -121,6 +121,7 @@ + + + + + + + 0) { + if (data.warningMsg != null && data.warningMsg.size > 0) { var alertContent = "" var ttsContent = "" var appId = data.warningMsg[0].sceneType.toString() @@ -411,7 +391,7 @@ class MogoPrivateObuNewManager private constructor() { //显示警告红边 // CallerHmiManager.showWarning(direction) //不显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框 - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { + if (alertContent.isEmpty() || ttsContent.isEmpty()) { return } CallerMsgBoxManager.saveMsgBox( @@ -571,7 +551,7 @@ class MogoPrivateObuNewManager private constructor() { ?.updateITrafficThreatLevelInfo(it) } - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { + if (alertContent.isEmpty() || ttsContent.isEmpty()) { return } //显示警告红边 @@ -650,7 +630,10 @@ class MogoPrivateObuNewManager private constructor() { MogoObuConstants.STATUS.DELETE -> { // 删除 UiThreadHandler.post { - CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(-1,DataSourceType.OBU) + CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange( + -1, + DataSourceType.OBU + ) } } } diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/adapter/MoGoObuListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/adapter/MoGoObuListenerImpl.kt new file mode 100644 index 0000000000..3c8e89fa18 --- /dev/null +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/adapter/MoGoObuListenerImpl.kt @@ -0,0 +1,92 @@ +package com.mogo.eagle.core.function.datacenter.obu.adapter + +import com.mogo.eagle.core.function.call.obu.* +import com.mogo.support.obu.OnMogoObuListener +import com.mogo.support.obu.constants.Define.ConnectStatus +import com.mogo.support.obu.model.* + +/** + * 适配 OBU 回调监听分发,这里不做业务,只做数据包装及分发处理 + * @author dong hong yu + */ +object MoGoObuListenerImpl : OnMogoObuListener() { + + /** + * 连接状态 + * + * @param connectStatus 连接状态 + * @since 1.0.0 + */ + override fun onConnectStatus(@ConnectStatus connectStatus: Int) { + //断开连接 + if (connectStatus == 0) { + CallerObuConnectListenerManager.getObuStatusInfo().obuStatus = false + } + //连接成功 + else if (connectStatus == 1) { + CallerObuConnectListenerManager.getObuStatusInfo().obuStatus = true + } + CallerObuConnectListenerManager.invokeObuConnectListener() + } + + + /** + * HV车辆基础信息 + * + * @param data 数据 + * @since 1.0.0 + */ + override fun onMogoObuHvBasics(data: MogoObuHvBasicsData) { + CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(data) + } + + /** + * V2V预警信息 + * + * @param data 数据 + * @since 1.0.0 + */ + override fun onMogoObuRvWarning(data: MogoObuRvWarningData) { + CallerObuWarningRvListenerManager.invokeObuRvWarning(data) + } + + /** + * 红绿灯预警信息 + * + * @param data 数据 + * @since 1.0.0 + */ + override fun onMogoObuSpatWarning(data: MogoObuSpatWarningData) { + CallerObuWarningSpatListenerManager.invokeObuSpatWarning(data) + } + + /** + * RSI预警信息 + * + * @param data 数据 + * @since 1.0.0 + */ + override fun onMogoObuRsiWarning(data: MogoObuRsiWarningData) { + CallerObuWarningRsiListenerManager.invokeObuRsiWarning(data) + } + + /** + * RSM预警信息 + * + * @param data 数据 + * @since 1.0.0 + */ + override fun onMogoObuRsmWarning(data: MogoObuRsmWarningData) { + CallerObuWarningRsmListenerManager.invokeObuRsmWarning(data) + } + + /** + * 地图匹配结果 + * + * @param data 数据 + * @since 1.0.0 + */ + override fun onMogoObuMapMath(data: MogoObuMapMathData) { + CallerObuMapMathListenerManager.invokeObuMapMath(data) + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index 64fc8b9c27..760d9e4e48 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -98,16 +98,6 @@ class MoGoHmiFragment : MvpFragment(), } - // todo 新超 - override fun updateDriverMsgBoxTipView(show: Boolean) { - - } - - // todo 新超 - override fun updatePassengerMsgBoxTipView(show: Boolean) { - - } - /** todo ----------------------------------------------**/ /** * 设置 红绿灯 代理View diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxBubbleView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxBubbleView.kt index fb8fabb4a4..d36deb67f5 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxBubbleView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxBubbleView.kt @@ -13,6 +13,7 @@ import com.mogo.eagle.core.data.msgbox.MsgCategory import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.DriverMsgBoxBubbleAdapter @@ -83,7 +84,7 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor( } } if(isShowData){ - CallerHmiManager.updateDriverMsgBoxTipView(true) + CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true) if(category == MsgCategory.RECORD_BAG){ //弹出被动录包弹窗 CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean,context as Activity,true) @@ -98,16 +99,12 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() - if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){ - CallerMsgBoxListenerManager.addListener(TAG,this) - } + CallerMsgBoxListenerManager.addListener(TAG,this) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() - if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){ - CallerMsgBoxListenerManager.removeListener(TAG) - } + CallerMsgBoxListenerManager.removeListener(TAG) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxButtonView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxButtonView.kt index 0156087370..5fe939bf50 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxButtonView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxButtonView.kt @@ -3,8 +3,13 @@ package com.mogo.eagle.core.function.hmi.ui.msgbox import android.content.Context import android.util.AttributeSet import android.view.LayoutInflater +import android.view.View import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager import com.mogo.eagle.core.function.hmi.R +import kotlinx.android.synthetic.main.view_driver_msg_box_button.view.* /** * @author XuXinChao @@ -15,19 +20,71 @@ class DriverMsgBoxButtonView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -):ConstraintLayout(context, attrs, defStyleAttr) { +):ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxEventListener { companion object { const val TAG = "DriverMsgBoxButtonView" } + private var clickListener: ClickListener? = null + init{ LayoutInflater.from(context).inflate(R.layout.view_driver_msg_box_button, this, true) initView() } private fun initView(){ + cbMsgBoxDriver.setOnCheckedChangeListener { _, isChecked -> + clickListener?.showMsgBoxList(isChecked) + msgBoxTipView.visibility = View.GONE + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerMsgBoxEventListenerManager.addListener(TAG,this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerMsgBoxEventListenerManager.removeListener(TAG) + } + + override fun onSummaryClickEvent() { } + /** + * 更新新消息提醒红点 + * @param isShow true:展示;false:不展示 + */ + override fun onUpdateTipEvent(isShow: Boolean) { + if(isShow){ + msgBoxTipView.visibility = View.VISIBLE + }else{ + msgBoxTipView.visibility = View.GONE + } + } + + override fun onBubbleOperationClickEvent(msgBoxBean: MsgBoxBean) { + cbMsgBoxDriver.performClick() + } + + override fun onBubbleV2XClickEvent(msgBoxBean: MsgBoxBean) { + cbMsgBoxDriver.performClick() + } + + override fun onBubbleReportClickEvent(msgBoxBean: MsgBoxBean) { + cbMsgBoxDriver.performClick() + } + + fun setClickListener(clickListener: ClickListener) { + this.clickListener = clickListener + } + + interface ClickListener{ + fun showMsgBoxList(show: Boolean) + } + + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxListView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxListView.kt index 547b6c8719..c06b07f82b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxListView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxListView.kt @@ -7,16 +7,16 @@ import android.view.LayoutInflater import android.view.View import androidx.constraintlayout.widget.ConstraintLayout import androidx.recyclerview.widget.LinearLayoutManager -import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgCategory +import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.DriverMsgBoxListAdapter import com.mogo.eagle.core.function.msgbox.MsgBoxConfig -import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.eagle.core.utilcode.util.UiThreadHandler import kotlinx.android.synthetic.main.layout_driver_msg_box_list.view.* import org.greenrobot.eventbus.EventBus @@ -32,7 +32,7 @@ class DriverMsgBoxListView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener { +) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener, IMsgBoxEventListener { init { LayoutInflater.from(context).inflate(R.layout.layout_driver_msg_box_list, this, true) @@ -43,11 +43,13 @@ class DriverMsgBoxListView @JvmOverloads constructor( private var ipcReportList: ArrayList ?= null private var badCaseList: ArrayList ?= null private var driverMsgBoxListAdapter: DriverMsgBoxListAdapter ?=null + private var linearLayoutManager: LinearLayoutManager ?= null private fun initView() { driverMsgBoxListAdapter= DriverMsgBoxListAdapter(context as Activity) rvMsgBoxList.adapter = driverMsgBoxListAdapter - rvMsgBoxList.layoutManager = LinearLayoutManager(context) + linearLayoutManager = LinearLayoutManager(context) + rvMsgBoxList.layoutManager = linearLayoutManager //获取通知消息列表 noticeList= CallerMsgBoxManager.getCachedNotifyData() as ArrayList? @@ -193,18 +195,16 @@ class DriverMsgBoxListView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() - if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){ - CallerMsgBoxListenerManager.addListener(TAG,this) - EventBus.getDefault().register(this) - } + CallerMsgBoxListenerManager.addListener(TAG,this) + CallerMsgBoxEventListenerManager.addListener(TAG,this) + EventBus.getDefault().register(this) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() - if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){ - CallerMsgBoxListenerManager.removeListener(TAG) - EventBus.getDefault().unregister(this) - } + CallerMsgBoxListenerManager.removeListener(TAG) + CallerMsgBoxEventListenerManager.removeListener(TAG) + EventBus.getDefault().unregister(this) } @Subscribe(threadMode = ThreadMode.MAIN) @@ -214,4 +214,36 @@ class DriverMsgBoxListView @JvmOverloads constructor( it.remove(msgBoxList) } } + + override fun onSummaryClickEvent() { + + } + + override fun onUpdateTipEvent(isShow: Boolean) { + + } + + override fun onBubbleOperationClickEvent(msgBoxBean: MsgBoxBean) { + MsgBoxConfig.setUserRecord(0) + notifyData() + noticeList?.let { + rvMsgBoxList?.scrollToPosition(it.indexOf(msgBoxBean)) + } + } + + override fun onBubbleV2XClickEvent(msgBoxBean: MsgBoxBean) { + MsgBoxConfig.setUserRecord(0) + notifyData() + noticeList?.let { + rvMsgBoxList?.scrollToPosition(it.indexOf(msgBoxBean)) + } + } + + override fun onBubbleReportClickEvent(msgBoxBean: MsgBoxBean) { + MsgBoxConfig.setUserRecord(1) + notifyData() + ipcReportList?.let { + linearLayoutManager?.scrollToPositionWithOffset(it.indexOf(msgBoxBean),0) + } + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxBubbleView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxBubbleView.kt index edd8a0688b..7625fbec80 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxBubbleView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxBubbleView.kt @@ -12,6 +12,7 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.MsgCategory import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.PassengerMsgBoxBubbleAdapter @@ -64,7 +65,7 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor( || msgBoxList.type == MsgBoxType.OBU){ MsgBoxConfig.noticeList.add(msgBoxList) if(isShowData){ - CallerHmiManager.updatePassengerMsgBoxTipView(true) + CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true) dataList.add(msgBoxList) passengerMsgBoxBubbleAdapter?.setData(dataList) } @@ -75,18 +76,12 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() - if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) && - AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){ - CallerMsgBoxListenerManager.addListener(TAG,this) - } + CallerMsgBoxListenerManager.addListener(TAG,this) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() - if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) && - AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){ - CallerMsgBoxListenerManager.removeListener(TAG) - } + CallerMsgBoxListenerManager.removeListener(TAG) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxButtonView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxButtonView.kt index 9cc340ca74..3080907378 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxButtonView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxButtonView.kt @@ -3,8 +3,13 @@ package com.mogo.eagle.core.function.hmi.ui.msgbox import android.content.Context import android.util.AttributeSet import android.view.LayoutInflater +import android.view.View import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager import com.mogo.eagle.core.function.hmi.R +import kotlinx.android.synthetic.main.view_passenger_msg_box_button.view.* /** * @author XuXinChao @@ -15,19 +20,70 @@ class PassengerMsgBoxButtonView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -): ConstraintLayout(context, attrs, defStyleAttr) { +): ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxEventListener { companion object { const val TAG = "PassengerMsgBoxButtonView" } + private var clickListener: ClickListener? = null + init{ LayoutInflater.from(context).inflate(R.layout.view_passenger_msg_box_button, this, true) initView() } private fun initView(){ + cbMsgBoxPassenger.setOnCheckedChangeListener { _, isChecked -> + clickListener?.showMsgBoxList(isChecked) + msgBoxPTipView.visibility = View.GONE + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerMsgBoxEventListenerManager.addListener(TAG,this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerMsgBoxEventListenerManager.removeListener(TAG) + } + + override fun onSummaryClickEvent() { } + /** + * 更新新消息提醒红点 + * @param isShow true:展示;false:不展示 + */ + override fun onUpdateTipEvent(isShow: Boolean) { + if(isShow){ + msgBoxPTipView.visibility = View.VISIBLE + }else{ + msgBoxPTipView.visibility = View.GONE + } + } + + override fun onBubbleOperationClickEvent(msgBoxBean: MsgBoxBean) { + cbMsgBoxPassenger.performClick() + } + + override fun onBubbleV2XClickEvent(msgBoxBean: MsgBoxBean) { + cbMsgBoxPassenger.performClick() + } + + override fun onBubbleReportClickEvent(msgBoxBean: MsgBoxBean) { + cbMsgBoxPassenger.performClick() + } + + fun setClickListener(clickListener: ClickListener) { + this.clickListener = clickListener + } + + interface ClickListener{ + fun showMsgBoxList(show: Boolean) + } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxListView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxListView.kt index f0720f387c..8abbc15a48 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxListView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/PassengerMsgBoxListView.kt @@ -11,7 +11,9 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.MsgCategory +import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.hmi.R @@ -30,7 +32,7 @@ class PassengerMsgBoxListView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener { +) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IMsgBoxEventListener { private val TAG = "PassengerMsgBoxListView" var passengerMsgBoxListAdapter: PassengerMsgBoxListAdapter ?= null @@ -75,18 +77,36 @@ class PassengerMsgBoxListView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() - if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) && - AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){ - CallerMsgBoxListenerManager.addListener(TAG,this) - } + CallerMsgBoxListenerManager.addListener(TAG,this) + CallerMsgBoxEventListenerManager.addListener(TAG,this) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() - if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) && - AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){ - CallerMsgBoxListenerManager.removeListener(TAG) + CallerMsgBoxListenerManager.removeListener(TAG) + CallerMsgBoxEventListenerManager.removeListener(TAG) + } + + override fun onSummaryClickEvent() { + + } + + override fun onUpdateTipEvent(isShow: Boolean) { + + } + + override fun onBubbleOperationClickEvent(msgBoxBean: MsgBoxBean) { + + } + + override fun onBubbleV2XClickEvent(msgBoxBean: MsgBoxBean) { + noticeList?.let { + rvPassengerList.scrollToPosition(it.indexOf(msgBoxBean)) } } + override fun onBubbleReportClickEvent(msgBoxBean: MsgBoxBean) { + + } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt index 59bf3c18f6..61488d4325 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt @@ -14,12 +14,14 @@ import com.mogo.eagle.core.data.msgbox.* import com.mogo.eagle.core.data.report.ReportEntity import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform import com.mogo.eagle.core.utilcode.util.TimeUtils import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat +import com.mogo.eagle.core.widget.RoundCanClickConstraintLayout /** * @author XuXinChao @@ -76,14 +78,19 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A when (holder) { is BubbleOperationHolder -> { data?.let { - val operationMsg = it[position].bean as OperationMsg + val msgBoxBean = it[position] + val operationMsg = msgBoxBean.bean as OperationMsg holder.tvBubbleOperationTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) holder.tvBubbleOperationContent.text = operationMsg.content + holder.clBubbleOperationLayout.setOnClickListener { + CallerMsgBoxEventListenerManager.invokeBubbleOperationListener(msgBoxBean) + } } } is BubbleReportHolder -> { data?.let { - val reportEntity = it[position].bean as ReportEntity + val msgBoxBean = it[position] + val reportEntity = msgBoxBean.bean as ReportEntity holder.tvBubbleReportTime.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}" holder.tvBubbleReceiveTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) var resultStr = "类型:" @@ -91,6 +98,9 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A resultStr = "${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}" } holder.tvBubbleReportType.text = resultStr + holder.clReportLayout.setOnClickListener { + CallerMsgBoxEventListenerManager.invokeBubbleReportListener(msgBoxBean) + } } } is BubbleNoticeHolder -> { @@ -140,6 +150,9 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A holder.tvV2XContent.text = v2XMsg.content holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable( EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) + holder.clV2XLayout.setOnClickListener { + CallerMsgBoxEventListenerManager.invokeBubbleV2XListener(msgBoxBean) + } } } is BubbleSummaryHolder -> { @@ -191,12 +204,14 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A var tvBubbleReportTime: TextView = itemView.findViewById(R.id.tvBubbleReportTime) var tvBubbleReportType: TextView = itemView.findViewById(R.id.tvBubbleReportType) var tvBubbleReceiveTime: TextView = itemView.findViewById(R.id.tvBubbleReceiveTime) + var clReportLayout: RoundCanClickConstraintLayout = itemView.findViewById(R.id.clReportLayout) } //运营平台 class BubbleOperationHolder(itemView: View): RecyclerView.ViewHolder(itemView){ var tvBubbleOperationTime: TextView = itemView.findViewById(R.id.tvBubbleOperationTime) var tvBubbleOperationContent: TextView = itemView.findViewById(R.id.tvBubbleOperationContent) + var clBubbleOperationLayout: RoundCanClickConstraintLayout = itemView.findViewById(R.id.clBubbleOperationLayout) } //Notice @@ -213,6 +228,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A var ivV2XImage: ImageView = itemView.findViewById(R.id.ivV2XImage) var tvV2XTime: TextView = itemView.findViewById(R.id.tvV2XTime) var tvV2XContent: TextView = itemView.findViewById(R.id.tvV2XContent) + var clV2XLayout: RoundCanClickConstraintLayout = itemView.findViewById(R.id.clV2XLayout) } //汇总消息 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt index 110a8bcb9f..01c8b24ae1 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt @@ -19,6 +19,7 @@ import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform import com.mogo.eagle.core.utilcode.util.TimeUtils import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat +import com.mogo.eagle.core.widget.RoundCanClickConstraintLayout /** * @author XuXinChao @@ -105,6 +106,9 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView holder.tvPassengerV2XContent.text = v2XMsg.content holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable( EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) + holder.clPassengerVeXLayout.setOnClickListener { + CallerMsgBoxEventListenerManager.invokeBubbleV2XListener(msgBoxBean) + } } } is BubbleSummaryHolder -> { @@ -115,7 +119,7 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView holder.tvPassengerSummaryCheck.setOnClickListener { //跳转全览模式 // CallerHmiManager.showSmallFragment() - CallerMsgBoxEventListenerManager.invokeListener() + CallerMsgBoxEventListenerManager.invokeSummaryListener() } } } @@ -164,6 +168,7 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView var ivPassengerV2XImage: ImageView = itemView.findViewById(R.id.ivPassengerV2XImage) var tvPassengerV2XTime: TextView = itemView.findViewById(R.id.tvPassengerV2XTime) var tvPassengerV2XContent: TextView = itemView.findViewById(R.id.tvPassengerV2XContent) + var clPassengerVeXLayout: RoundCanClickConstraintLayout = itemView.findViewById(R.id.clPassengerVeXLayout) } //汇总消息 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt index de61704d89..3db034d364 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt @@ -107,7 +107,7 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A holder.tvPassengerSummaryCheck.setOnClickListener { //跳转全览模式 // CallerHmiManager.showSmallFragment() - CallerMsgBoxEventListenerManager.invokeListener() + CallerMsgBoxEventListenerManager.invokeSummaryListener() } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 14e6d0cee2..4effeef6d8 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -38,14 +38,12 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant import com.mogo.eagle.core.data.deva.scene.SceneModule import com.mogo.eagle.core.data.enums.TrafficTypeEnum import com.mogo.eagle.core.data.gnss.AccelerationEntity -import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.data.obu.ObuStatusInfo import com.mogo.eagle.core.data.report.ReportEntity import com.mogo.eagle.core.function.api.autopilot.* import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener -import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener -import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener +import com.mogo.eagle.core.function.api.obu.IMoGoObuConnectListener import com.mogo.eagle.core.function.business.routeoverlay.* import com.mogo.eagle.core.function.call.autopilot.* import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager @@ -55,8 +53,8 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.function.call.map.CallerHDMapManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.function.call.map.CallerSmpManager -import com.mogo.eagle.core.function.call.obu.CallerOBUManager -import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager +import com.mogo.eagle.core.function.call.obu.CallerObuApiManager +import com.mogo.eagle.core.function.call.obu.CallerObuConnectListenerManager import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager import com.mogo.eagle.core.function.hmi.R @@ -100,22 +98,21 @@ internal class DebugSettingView @JvmOverloads constructor( attrs: AttributeSet? = null, defStyleAttr: Int = 0 ) : ConstraintLayout(context, attrs, defStyleAttr), - IMoGoObuStatusListener, - IMoGoAutopilotStatusListener, - IMoGoChassisLocationWGS84Listener, - IMoGoMapLocationListener, - IMoGoAutopilotIdentifyListener, - IMoGoPlanningRottingListener, - IMoGoPlanningTrajectoryListener, - IMoGoDevaToolsFuncConfigListener, - IMoGoChassisLamplightListener, - IMoGoDevaToolsListener, - IMoGoChassisAccStateListener, - IMoGoChassisSteeringStateListener, - IMoGoChassisGearStateListener, - IMoGoChassisBrakeStateListener, - IMoGoChassisThrottleStateListener, - IMoGoSweeperFutianCleanSystemListener{ + IMoGoObuConnectListener, + IMoGoAutopilotStatusListener, + IMoGoChassisLocationWGS84Listener, + IMoGoAutopilotIdentifyListener, + IMoGoPlanningRottingListener, + IMoGoPlanningTrajectoryListener, + IMoGoDevaToolsFuncConfigListener, + IMoGoChassisLamplightListener, + IMoGoDevaToolsListener, + IMoGoChassisAccStateListener, + IMoGoChassisSteeringStateListener, + IMoGoChassisGearStateListener, + IMoGoChassisBrakeStateListener, + IMoGoChassisThrottleStateListener, + IMoGoSweeperFutianCleanSystemListener { private val TAG = "DebugSettingView" @@ -189,7 +186,7 @@ internal class DebugSettingView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() // 添加 OBU状态 监听 - CallerObuListenerManager.addListener(TAG, this) + CallerObuConnectListenerManager.addListener(TAG, this) // 添加 ADAS状态 监听 CallerAutoPilotStatusListenerManager.addListener(TAG, this) // 添加 ADAS车辆状态&定位 监听 @@ -230,7 +227,7 @@ internal class DebugSettingView @JvmOverloads constructor( override fun onDetachedFromWindow() { super.onDetachedFromWindow() // 移除 OBU状态 监听 - CallerObuListenerManager.removeListener(TAG) + CallerObuConnectListenerManager.removeListener(TAG) // 移除 ADAS状态 监听 CallerAutoPilotStatusListenerManager.removeListener(TAG) // 移除 ADAS车辆状态&定位 监听 @@ -254,7 +251,10 @@ internal class DebugSettingView @JvmOverloads constructor( CallerChassisLamplightListenerManager.removeListener(TAG) // 移除 业务配置监听 - CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener( FuncBizConfig.FOUNDATION, TAG) + CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener( + FuncBizConfig.FOUNDATION, + TAG + ) if (logInfoView != null) { logInfoView!!.onEnterBackground() @@ -552,7 +552,7 @@ internal class DebugSettingView @JvmOverloads constructor( setLogCheckedChangeListener() //OBU配置信息 - tvObuInfo.text = CallerObuListenerManager.getObuStatusInfoJsonString() + tvObuInfo.text = CallerObuConnectListenerManager.getObuStatusInfoJsonString() //工控机配置信息 tvAutopilotInfo.text = @@ -572,14 +572,14 @@ internal class DebugSettingView @JvmOverloads constructor( btnSetObuIP.setOnClickListener { val obuIP = etObuIP.text.toString() if (StringUtils.isValidIPAddress(obuIP)) { - CallerOBUManager.resetObuIpAddress(obuIP) + CallerObuApiManager.resetObuIpAddress(obuIP) } else { ToastUtils.showShort("请输入正确的IP地址") } } btnDrawFusion.isChecked = FunctionBuildConfig.isFusionColor - btnDrawFusion.setOnCheckedChangeListener{_, isChecked -> + btnDrawFusion.setOnCheckedChangeListener { _, isChecked -> FunctionBuildConfig.isFusionColor = isChecked } @@ -589,7 +589,11 @@ internal class DebugSettingView @JvmOverloads constructor( // 演示模式 tbIsDemoMode.setOnCheckedChangeListener { _, _ -> FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode - CallerHmiManager.updateStatusBarLeftView(FunctionBuildConfig.isDemoMode, "demoMode", DemoModeView(context)) + CallerHmiManager.updateStatusBarLeftView( + FunctionBuildConfig.isDemoMode, + "demoMode", + DemoModeView(context) + ) CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode) if (!FunctionBuildConfig.isDemoMode) { //关闭美化模式时,通知工控机 @@ -1691,9 +1695,9 @@ internal class DebugSettingView @JvmOverloads constructor( mTrajectoryInfoSize = 0 mRouteInfoSize = 0 - if(FunctionBuildConfig.isDemoMode){ + if (FunctionBuildConfig.isDemoMode) { tbIsDemoMode.text = "关闭美化模式" - }else{ + } else { tbIsDemoMode.text = "开启美化模式" } @@ -1702,7 +1706,7 @@ internal class DebugSettingView @JvmOverloads constructor( /** * OBU状态回调 */ - override fun onObuStatusResponse(obuStatusInfo: ObuStatusInfo) { + override fun onConnectStatus(obuStatusInfo: ObuStatusInfo) { lifecycleOwner.lifecycleScope.launch { tvObuInfo.text = GsonUtils.toJson(obuStatusInfo) @@ -1782,7 +1786,7 @@ internal class DebugSettingView @JvmOverloads constructor( when (type) { BIZ_BEAUTY_MODE -> { tbIsDemoMode.isClickable = !lock - val (left,top,right,bottom) = tbIsDemoMode.currentPadding() + val (left, top, right, bottom) = tbIsDemoMode.currentPadding() if (lock) { tbIsDemoMode.background = resources.getDrawable(R.drawable.radio_button_lock_background) @@ -1790,11 +1794,11 @@ internal class DebugSettingView @JvmOverloads constructor( tbIsDemoMode.background = resources.getDrawable(R.drawable.radio_button_normal_background_right) } - tbIsDemoMode.setPadding(left,top,right,bottom) + tbIsDemoMode.setPadding(left, top, right, bottom) } BIZ_RAIN_MODE -> { tbIsRainMode.isClickable = !lock - val (left,top,right,bottom) = tbIsRainMode.currentPadding() + val (left, top, right, bottom) = tbIsRainMode.currentPadding() if (lock) { tbIsRainMode.background = resources.getDrawable(R.drawable.radio_button_lock_background) @@ -1802,21 +1806,21 @@ internal class DebugSettingView @JvmOverloads constructor( tbIsRainMode.background = resources.getDrawable(R.drawable.radio_button_normal_background_right) } - tbIsRainMode.setPadding(left,top,right,bottom) + tbIsRainMode.setPadding(left, top, right, bottom) } BIZ_WARNING_UPLOAD -> { tbReportWarning.isClickable = !lock - val (left,top,right,bottom) = tbReportWarning.currentPadding() + val (left, top, right, bottom) = tbReportWarning.currentPadding() if (lock) { tbReportWarning.background = resources.getDrawable(R.drawable.radio_button_lock_background) } else { tbReportWarning.background = null } - tbReportWarning.setPadding(left,top,right,bottom) + tbReportWarning.setPadding(left, top, right, bottom) } BIZ_BAG_RECORD -> { - val (left,top,right,bottom) = btnRecordBag.currentPadding() + val (left, top, right, bottom) = btnRecordBag.currentPadding() if (lock) { btnRecordBag.isClickable = false btnRecordBag.background = @@ -1826,10 +1830,10 @@ internal class DebugSettingView @JvmOverloads constructor( btnRecordBag.requestFocus() btnRecordBag.background = null } - btnRecordBag.setPadding(left,top,right,bottom) + btnRecordBag.setPadding(left, top, right, bottom) } BIZ_FULL_LOG -> { - val (left,top,right,bottom) = tbLogCatch.currentPadding() + val (left, top, right, bottom) = tbLogCatch.currentPadding() if (lock) { tbLogCatch.isClickable = false tbLogCatch.background = @@ -1839,7 +1843,7 @@ internal class DebugSettingView @JvmOverloads constructor( tbLogCatch.requestFocus() tbLogCatch.background = null } - tbLogCatch.setPadding(left,top,right,bottom) + tbLogCatch.setPadding(left, top, right, bottom) } } } @@ -1954,15 +1958,6 @@ internal class DebugSettingView @JvmOverloads constructor( } } - override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) { - } - - /** - * 时延显示 - */ - override fun onObuV2iDelayTime(delayTime: Long) { - - } /** * 车辆转向灯 数据 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt index 0ae1263047..75a9ec91bd 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt @@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.hmi.ui.setting import android.content.Context import android.util.AttributeSet -import android.util.Log import android.view.LayoutInflater import android.view.View import androidx.constraintlayout.widget.ConstraintLayout @@ -14,7 +13,7 @@ import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager import com.mogo.eagle.core.function.call.hmi.CallerHmiManager -import com.mogo.eagle.core.function.call.obu.CallerOBUManager +import com.mogo.eagle.core.function.call.obu.CallerObuApiManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.kotlin.currentPadding import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils @@ -23,7 +22,6 @@ import com.mogo.eagle.core.function.business.routeoverlay.RouteStrategy import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView import com.mogo.eagle.core.utilcode.util.UiThreadHandler -import kotlinx.android.synthetic.main.view_debug_setting.view.* import kotlinx.android.synthetic.main.view_sop_setting.view.* import kotlinx.android.synthetic.main.view_sop_setting.view.tbRouteDynamicEffect import java.util.* @@ -187,17 +185,17 @@ internal class SOPSettingView @JvmOverloads constructor( } //OBU控制总开关 - tbObu.isChecked = CallerOBUManager.isConnected() + tbObu.isChecked = CallerObuApiManager.isConnected() tbObu.setOnCheckedChangeListener { _, isChecked -> if (!isChecked) { if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { - CallerOBUManager.resetObuIpAddress("192.168.1.199") + CallerObuApiManager.resetObuIpAddress("192.168.1.199") } else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { - CallerOBUManager.resetObuIpAddress("192.168.8.199") + CallerObuApiManager.resetObuIpAddress("192.168.8.199") } } else { //断开链接 - CallerOBUManager.disConnectObu() + CallerObuApiManager.disConnectObu() } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java index d67b55b7c7..36e777c379 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java @@ -27,7 +27,7 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsUpgradeListene import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager; import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb; -import com.mogo.eagle.core.function.overview.OverviewDb; +import com.mogo.eagle.core.function.overview.db.OverviewDb; import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml index 9cfb39d1e0..8e84662b5e 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml @@ -21,99 +21,6 @@ android:layout_height="match_parent" android:paddingTop="72dp"> - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_marginBottom="7dp" + > - \ No newline at end of file + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_report.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_report.xml index ac287b1ca2..7bc6c8e3a8 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_report.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_report.xml @@ -1,5 +1,6 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_v2x.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_v2x.xml index 8c1cb8475d..9888e42f87 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_v2x.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_msg_bubble_v2x.xml @@ -1,5 +1,6 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_box_v2x.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_box_v2x.xml index d7096b95b6..fbe95e1a36 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_box_v2x.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_passenger_msg_box_v2x.xml @@ -1,5 +1,6 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_driver_msg_box_button.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_driver_msg_box_button.xml index 05d9447d64..4d6aeebadb 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_driver_msg_box_button.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_driver_msg_box_button.xml @@ -20,7 +20,7 @@ >() + private val _V2XEvents = MutableLiveData>() + private var disposable: Disposable? = null + + val infStructures + get() = _infStructures + + private val _infStructuresMap = _infStructures + .switchMap { infStructures -> + liveData { + val map = HashMap>() + infStructures.forEach { + val geoHash = it.geoHash + if (geoHash == null) { + return@forEach + } else { + if (!map.containsKey(geoHash)) { + val list = ArrayList() + list.add(it) + map[geoHash] = list + } else { + map[geoHash]?.add(it) + } + } + } + emit(map) + } + } + val infStructuresMap + get() = _infStructuresMap + + fun fetchInfStructures() { + ProcessLifecycleOwner.get().lifecycleScope.launch { + val data = try { + // 只查找摄像头 + overviewDao.listInfStructures(0) +// overviewDao.listAllInfStructures() + } catch (e: Exception) { + e.printStackTrace() + null + } + data?.let { + _infStructures.value = it + } + } + } + + fun updateGeoHash(id: Int, geoHash: String) { + ProcessLifecycleOwner.get().lifecycleScope.launch { + try { + overviewDao.updateGeoHash(id, geoHash) + } catch (e: Exception) { + e.printStackTrace() + } + } + } + + fun getAllV2XEventsByLineId(sn: String) { + if (disposable != null && !disposable!!.isDisposed) { + disposable!!.dispose() + } + + // 1分钟查询一次 + disposable = Observable.interval(2000, 60000, TimeUnit.MILLISECONDS) + .flatMap { + val lineId = getLineId() + if (lineId > 0) { + MoGoRetrofitFactory.getInstance(HostConst.getHost()) + .create(OverViewServiceApi::class.java) + .queryAllV2XEventsByLineId(lineId.toString(), sn) + .map { + if (it.code == 200 || it.code == 0) { + CallerLogger.d(SceneConstant.M_MAP + TAG, "请求成功,size为:${it.result?.v2XEventList?.size}") + return@map it.result?.v2XEventList + } else { + CallerLogger.d(SceneConstant.M_MAP + TAG, "请求失败,code为:${it.code}") + return@map ArrayList() + } + } + } else { + Observable.just(ArrayList()) + } + } + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe { + it?.apply { + _V2XEvents.value = this + } + } + } + + fun getV2XEventLiveData() = _V2XEvents + + fun stopQueryV2XEvents() { + disposable?.dispose() + } + + private fun getLineId(): Long { + var lineId: Long = -1 + val parameter = CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo() + .autopilotControlParameters + if (parameter != null) { + if (parameter.autoPilotLine != null) { + lineId = parameter.autoPilotLine!!.lineId + CallerLogger.d(SceneConstant.M_MAP + TAG, "lineId为:$lineId") + } else { + CallerLogger.d(SceneConstant.M_MAP + TAG, "parameter.autoPilotLine为null") + } + } else { + CallerLogger.d(SceneConstant.M_MAP + TAG, "parameter为null") + } + return lineId + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/ViewModelFactory.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/ViewModelFactory.kt index d6dd931290..0418a667e6 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/ViewModelFactory.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/ViewModelFactory.kt @@ -5,6 +5,8 @@ import android.app.Application import androidx.annotation.VisibleForTesting import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider +import com.mogo.eagle.core.function.overview.db.OverviewDao +import com.mogo.eagle.core.function.overview.db.OverviewDb import com.mogo.eagle.core.function.overview.vm.OverViewModel class ViewModelFactory private constructor( diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverviewDao.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/db/OverviewDao.kt similarity index 91% rename from core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverviewDao.kt rename to core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/db/OverviewDao.kt index 3bc147766c..4398041c9e 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverviewDao.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/db/OverviewDao.kt @@ -1,4 +1,4 @@ -package com.mogo.eagle.core.function.overview +package com.mogo.eagle.core.function.overview.db import androidx.room.Dao import androidx.room.Query diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverviewDb.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/db/OverviewDb.kt similarity index 96% rename from core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverviewDb.kt rename to core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/db/OverviewDb.kt index 555fd59913..596c282697 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/OverviewDb.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/db/OverviewDb.kt @@ -1,4 +1,4 @@ -package com.mogo.eagle.core.function.overview +package com.mogo.eagle.core.function.overview.db import android.content.Context import androidx.room.Database diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/view/OverMapView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/view/OverMapView.kt new file mode 100644 index 0000000000..ddc6423415 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/view/OverMapView.kt @@ -0,0 +1,580 @@ +package com.mogo.eagle.core.function.overview.view + +import android.content.Context +import android.graphics.Bitmap +import android.graphics.Canvas +import android.os.Bundle +import android.util.AttributeSet +import android.util.Log +import android.view.LayoutInflater +import android.view.MotionEvent +import android.widget.RelativeLayout +import android.widget.TextView +import ch.hsr.geohash.GeoHash +import com.amap.api.maps.AMap +import com.amap.api.maps.CameraUpdate +import com.amap.api.maps.CameraUpdateFactory +import com.amap.api.maps.TextureMapView +import com.amap.api.maps.model.* +import com.mogo.cloud.passport.MoGoAiCloudClientConfig +import com.mogo.eagle.core.data.config.FunctionBuildConfig +import com.mogo.eagle.core.data.map.Infrastructure +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener +import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager.getGlobalPath +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showVideoDialog +import com.mogo.eagle.core.function.map.R +import com.mogo.eagle.core.function.overview.InfStructureManager +import com.mogo.eagle.core.function.overview.InfStructureManager.getData +import com.mogo.eagle.core.function.overview.OverViewDataManager +import com.mogo.eagle.core.function.overview.remote.V2XEvent +import com.mogo.eagle.core.function.smp.MakerWithCount +import com.mogo.eagle.core.function.smp.MarkerDrawerManager +import com.mogo.eagle.core.function.smp.MarkerDrawerManager.callback +import com.mogo.eagle.core.function.smp.MarkerDrawerManager.coordinateConverterWgsToGcj +import com.mogo.eagle.core.function.smp.MarkerDrawerManager.lonLat +import com.mogo.eagle.core.function.smp.MarkerDrawerManager.planningPoints +import com.mogo.eagle.core.function.smp.MarkerDrawerManager.startLoopCalCarLocation +import com.mogo.eagle.core.function.smp.MarkerDrawerManager.updateRoutePoints +import com.mogo.eagle.core.function.smp.V2XMarkerView +import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner +import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isTaxi +import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils +import com.mogo.eagle.core.utilcode.util.UiThreadHandler +import me.jessyan.autosize.utils.AutoSizeUtils +import mogo.telematics.pad.MessagePad + +/** + * 全览地图View + * + * @author chenfufeng + */ +class OverMapView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : RelativeLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener { + private var mMapView: TextureMapView? = null + private var mAMap: AMap? = null + private val zoomLevel = 15 + private var mCameraUpdate: CameraUpdate? = null + private var mContext: Context? = null + private val mTilt = 60f + private var overLayerView: TextView? = null + + // 全局路径规划中的GeoHash网格 + private val pathMap: MutableMap?> = HashMap() + private val posInfMap: MutableMap?> = HashMap() + + // =============绘制轨迹线相关============= + private var mCarMarker: Marker? = null + private var mCompassMarker: Marker? = null + private var mStartMarker: Marker? = null + private var mEndMarker: Marker? = null + private var mBottomPolyline: Polyline? = null + private var mCoveredPolyline: Polyline? = null + + // 计算索引并设置对应的Bitmap + var arrivedBitmap: BitmapDescriptor? = null + var unArrivedBitmap: BitmapDescriptor? = null + + // 绘制轨迹线的集合 + private val textureList: MutableList = ArrayList() + private val texIndexList: MutableList = ArrayList() + private var mLocation: MessagePad.GnssInfo? = null + private var isFirstLocation = true + var mCustomMapStyleOptions: CustomMapStyleOptions? = null + var currMarkerList: ArrayList? = null + + companion object { + const val TAG = "OverMapView" + } + + init { + try { + initView(context) + } catch (e: Exception) { + e.printStackTrace() + } + } + + // =================必须通知高德地图生命周期的变化================= + fun onCreateView(savedInstanceState: Bundle?) { + if (mMapView != null) { + mMapView!!.onCreate(savedInstanceState) + } + } + + fun onResume() { + if (mMapView != null) { + mMapView!!.onResume() + } + } + + fun onPause() { + if (mMapView != null) { + mMapView!!.onPause() + } + } + + fun onDestroy() { + if (mMapView != null) { + mMapView!!.onDestroy() + } + if (mMapView != null) { + mMapView!!.onDestroy() + } + } + // =================必须通知高德地图生命周期的变化================= + + private fun initView(context: Context) { + mContext = context + val smpView = LayoutInflater.from(context).inflate(R.layout.module_overview_map_view, this) + mMapView = smpView.findViewById(R.id.aMapView) + overLayerView = findViewById(R.id.overLayer) + if (isTaxi(FunctionBuildConfig.appIdentityMode)) { + overLayerView?.background = resources.getDrawable(R.drawable.amap_reset) + arrivedBitmap = BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_arrow_arrived) + unArrivedBitmap = + BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_arrow_un_arrive) + } else { + overLayerView?.background = resources.getDrawable(R.drawable.amap_reset_bus) + arrivedBitmap = BitmapDescriptorFactory.fromResource(R.drawable.arrow_arrived_img) + unArrivedBitmap = BitmapDescriptorFactory.fromResource(R.drawable.amap_bus_smooth_route) + } + CallerPlanningRottingListenerManager.addListener(TAG, moGoAutopilotPlanningListener) + initAMapView(context) + // 注册定位监听 + CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this) + //设置全览模式 + overLayerView?.setOnClickListener { displayCustomOverView() } + } + + private fun initAMapView(context: Context) { + Log.d(TAG, "initAMapView") + mCameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel.toFloat()) + mAMap = mMapView!!.map + mCustomMapStyleOptions = CustomMapStyleOptions() + if (isTaxi(FunctionBuildConfig.appIdentityMode)) { + mCustomMapStyleOptions!!.styleData = + MapAssetStyleUtils.getAssetsStyle(getContext(), "over_view_style.data") + mCustomMapStyleOptions!!.styleExtraData = + MapAssetStyleUtils.getAssetsExtraStyle(getContext(), "over_view_style_extra.data") + } else { + mCustomMapStyleOptions!!.styleData = + MapAssetStyleUtils.getAssetsStyle(getContext(), "over_view_style_bus.data") + mCustomMapStyleOptions!!.styleExtraData = + MapAssetStyleUtils.getAssetsExtraStyle( + getContext(), + "over_view_style_extra_bus.data" + ) + } + mAMap?.setOnMapLoadedListener { + Log.d(TAG, "---onMapLoaded---") + if (mCustomMapStyleOptions != null) { + // 加载自定义样式 + mCustomMapStyleOptions!!.isEnable = true + // 设置自定义样式 + mAMap?.setCustomMapStyle(mCustomMapStyleOptions) + } + // 实时路况图层关闭,必须添加在loaded结束之后,其他位置不生效 + mAMap?.isTrafficEnabled = false + } + setUpMap() + customOptions() + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + OverViewDataManager.infStructuresMap.observe(lifecycleOwner) { list -> + InfStructureManager.saveData(list) + } + // 查询本地数据库中的摄像头数据 + OverViewDataManager.fetchInfStructures() + // 主动查一次全局路径规划的数据 + getGlobalPath() + // 定时查询V2X事件 + OverViewDataManager.getV2XEventLiveData().observe(lifecycleOwner) { + showV2XEventMarkers(it) + } + OverViewDataManager.getAllV2XEventsByLineId(MoGoAiCloudClientConfig.getInstance().sn) + } + + private fun setUpMap() { + // 地图文字标注 + mAMap!!.showMapText(true) + //设置希望展示的地图缩放级别 + mAMap!!.moveCamera(mCameraUpdate) + //设置地图的样式 + val uiSettings = mAMap!!.uiSettings + //地图缩放级别的交换按钮 + uiSettings.isZoomControlsEnabled = false + //所有手势 + uiSettings.setAllGesturesEnabled(true) + //隐藏指南针 + uiSettings.isCompassEnabled = false + //设置倾斜手势是否可用。 + uiSettings.isTiltGesturesEnabled = true + //隐藏默认的定位按钮 + uiSettings.isMyLocationButtonEnabled = false + //设置Logo下边界距离屏幕底部的边距,设置为负值即可 + uiSettings.setLogoBottomMargin(-150) + Log.d(TAG, "before onMapLoaded") + } + + /** + * 自定义导航View和路况状态 + */ + private fun customOptions() { + if (isTaxi(FunctionBuildConfig.appIdentityMode)) { + mCarMarker = mAMap!!.addMarker( + MarkerOptions() + .icon(BitmapDescriptorFactory.fromResource(R.drawable.map_car_icon)) + .anchor(0.5f, 0.5f) + ) + mCompassMarker = mAMap!!.addMarker( + MarkerOptions() + .icon(BitmapDescriptorFactory.fromResource(R.drawable.amap_custom_corner)) + .anchor(0.5f, 0.5f) + ) + } else { + mCarMarker = mAMap!!.addMarker( + MarkerOptions() + .icon(BitmapDescriptorFactory.fromResource(R.drawable.map_bus_icon)) + .anchor(0.5f, 0.5f) + ) + mCompassMarker = mAMap!!.addMarker( + MarkerOptions() + .icon(BitmapDescriptorFactory.fromResource(R.drawable.amap_bus_corner)) + .anchor(0.5f, 0.5f) + ) + } + mStartMarker = mAMap!!.addMarker( + MarkerOptions() + .icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_dir_start)) + ) + mEndMarker = mAMap!!.addMarker( + MarkerOptions() + .icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_dir_end)) + ) + } + + private val moGoAutopilotPlanningListener: IMoGoPlanningRottingListener = + object : IMoGoPlanningRottingListener { + /** + * 根据全路径获取起始点和经停点进行导航路线绘制 + * 自动驾驶启动后获得数据,获取全路径的具体时间要进行路测 + * 室内某个bag包自动驾驶启动8s后返回 + */ + override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) { + Log.d(TAG, "onAutopilotRotting") + handlePlanningData(globalPathResp!!.wayPointsList) + } + } + + fun handlePlanningData(locationList: List) { + val list: List = locationList + // 转成高德坐标系并存储 + updateRoutePoints(list, mContext!!) + val planningPointList: List = planningPoints + UiThreadHandler.post { + displayCustomOverView() + drawStartAndEndMarker(planningPointList) + } + callback = object : MarkerDrawerManager.Callback { + override fun onLocationChanged(planningPoints: List, locIndex: Int) { + // 每1s刷新一下轨迹线 + UiThreadHandler.post { + if (planningPoints.isNotEmpty()) { + drawPolyline(planningPoints, locIndex) + } + } + } + } + startLoopCalCarLocation() + UiThreadHandler.post { drawInfrastructureMarkers(locationList) } + } + + /** + * 显示V2X事件的Marker + */ + fun showV2XEventMarkers(v2XEvents: List?) { + if (v2XEvents == null || v2XEvents.isEmpty()) return + clearV2XMarkers() + val markerOptionsList = ArrayList() + for ((_, _, _, center, _, _, poiType, coordinateType) in v2XEvents) { + if (center != null) { + center.lon + val markerOption = MarkerOptions() + var latLng: LatLng = if (coordinateType == null || coordinateType == 0) { + LatLng(center.lat, center.lon) + } else { + // wgs84坐标系需转成高德坐标系 + coordinateConverterWgsToGcj(mContext!!, center.lat, center.lon) + } + markerOption.position(latLng) + markerOption.anchor(0.13f, 1f) + markerOption.icon( + BitmapDescriptorFactory.fromBitmap( + getV2XBitmap( + poiType + ) + ) + ) + markerOptionsList.add(markerOption) + } + } + if (markerOptionsList.size > 0) { + drawV2XMarkers(markerOptionsList) + } + } + + fun drawV2XMarkers(markerOptionsList: ArrayList?) { + currMarkerList = mAMap!!.addMarkers(markerOptionsList, false) + } + + private fun getV2XBitmap(poiType: String?): Bitmap { + val marker = V2XMarkerView(context, null, 0, poiType) + marker.measure( + MeasureSpec.makeMeasureSpec(AutoSizeUtils.dp2px(mContext, 229f), MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec(AutoSizeUtils.dp2px(mContext, 96f), MeasureSpec.EXACTLY) + ) + marker.layout(0, 0, marker.measuredWidth, marker.measuredHeight) + val bitmap = Bitmap.createBitmap(marker.width, marker.height, Bitmap.Config.ARGB_8888) + marker.draw(Canvas(bitmap)) + return bitmap + } + + fun clearV2XMarkers() { + if (currMarkerList != null) { + for (marker in currMarkerList!!) { + marker.destroy() + } + currMarkerList = null + } + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + // 注册定位监听 + CallerChassisLocationGCJ20ListenerManager.removeListener(TAG) + CallerPlanningRottingListenerManager.removeListener(TAG) + OverViewDataManager.stopQueryV2XEvents() + } + + override fun onInterceptTouchEvent(ev: MotionEvent): Boolean { + return false + } + + fun clearCustomPolyline() { + if (mBottomPolyline != null) { + mBottomPolyline!!.remove() + } + if (mCoveredPolyline != null) { + mCoveredPolyline!!.remove() + } + } + + /** + * 绘制新基建Markers(比如:摄像头) + * + * @param locationList + */ + private fun drawInfrastructureMarkers(locationList: List?) { + if (locationList == null) return + if (pathMap.isNotEmpty()) { + pathMap.clear() + } + var geoHash: String? + var infList: ArrayList? + for (i in locationList.indices) { + val latLng = coordinateConverterWgsToGcj(mContext!!, locationList[i]) + geoHash = + GeoHash.withCharacterPrecision(latLng.latitude, latLng.longitude, 7).toBase32() + // 网格内的轨迹点只取一次s + if (!pathMap.containsKey(geoHash)) { + // 从缓存的新基建数据中去取对应geoHash的新基建数据集合 + infList = getData()[geoHash] + if (infList != null) { + pathMap[geoHash] = infList + } + } + } + drawInfMarkers(pathMap) + } + + private fun drawInfMarkers(infStruMap: Map?>) { + // 绘制新基建数据 + if (posInfMap.isNotEmpty()) { + posInfMap.clear() + } + val markerOptionsList: ArrayList = ArrayList() + for (structureList in infStruMap.values) { + // 每个GeoHash内根据坐标系象限分散开摄像头icon显示 + val markerOption = MarkerOptions() + val latLng = LatLng( + java.lang.Double.valueOf(structureList!![0].lat!!), + java.lang.Double.valueOf(structureList[0].lon!!) + ) + markerOption.position(latLng) + val bitmap = getBitmap(structureList.size) + markerOption.icon( + BitmapDescriptorFactory.fromBitmap( + bitmap + ) + ) + markerOption.zIndex(2f) + posInfMap[latLng] = structureList + markerOptionsList.add(markerOption) + } + mAMap!!.addMarkers(markerOptionsList, false) + mAMap!!.setOnMarkerClickListener { marker: Marker -> + val infList: List? = posInfMap[marker.position] + // 如果是摄像头 + if (infList != null) { + showVideoDialog(infList) + return@setOnMarkerClickListener true + } + false + } + } + + private fun getBitmap(count: Int): Bitmap { + val marker = MakerWithCount(context) + marker.setCount(count) + marker.measure( + MeasureSpec.makeMeasureSpec(116, MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec(116, MeasureSpec.EXACTLY) + ) + marker.layout(0, 0, marker.measuredWidth, marker.measuredHeight) + val bitmap = Bitmap.createBitmap(marker.width, marker.height, Bitmap.Config.ARGB_8888) + marker.draw(Canvas(bitmap)) + return bitmap + } + + /** + * 进入自定义全览模式 + */ + private fun displayCustomOverView() { + val linePointsLatLng = planningPoints + if (linePointsLatLng.size > 1) { + //圈定地图显示范围 + //存放经纬度 + val boundsBuilder = LatLngBounds.Builder() + for (i in linePointsLatLng.indices) { + boundsBuilder.include(linePointsLatLng[i]) + } + val currentLatLng = LatLng(mLocation!!.latitude, mLocation!!.longitude) + boundsBuilder.include(currentLatLng) + val cameraPosition = CameraPosition.Builder().tilt(mTilt).build() + //第二个参数为四周留空宽度 + mAMap!!.moveCamera( + CameraUpdateFactory.newLatLngBoundsRect( + boundsBuilder.build(), + 100, + 100, + 100, + 100 + ) + ) + mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)) + } else { + //设置希望展示的地图缩放级别 + val cameraPosition = CameraPosition.Builder() + .target(mCarMarker!!.position).tilt(0f).zoom(zoomLevel.toFloat()).build() + mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)) + } + } + + /** + * 绘制自车 + * + * @param location + */ + private fun drawCarMarker(location: MessagePad.GnssInfo?) { + if (location == null) return + if (mCarMarker != null) { + val currentLatLng = LatLng(location.latitude, location.longitude) + mCarMarker!!.rotateAngle = (360 - location.heading).toFloat() + mCarMarker!!.position = currentLatLng + mCarMarker!!.setToTop() + if (mCompassMarker != null) { + mCompassMarker!!.rotateAngle = (360 - location.heading).toFloat() + mCompassMarker!!.position = currentLatLng + } + } + } + + /** + * 绘制起始点、终点 + */ + private fun drawStartAndEndMarker(coordinates: List) { + if (mStartMarker != null) { + mStartMarker!!.isVisible = false + } + if (mEndMarker != null) { + mEndMarker!!.isVisible = false + } + if (coordinates.size > 2) { + // 设置开始结束Marker位置 + val startLatLng = coordinates[0] + val endLatLng = coordinates[coordinates.size - 1] + mStartMarker!!.position = startLatLng + mEndMarker!!.position = endLatLng + mStartMarker!!.isVisible = true + mEndMarker!!.isVisible = true + } + } + + /** + * 绘制轨迹线 + * + * @param coordinates + * @param locIndex + */ + private fun drawPolyline(coordinates: List, locIndex: Int) { + if (textureList.size > 0) { + textureList.clear() + } + if (texIndexList.size > 0) { + texIndexList.clear() + } + for (i in coordinates.indices) { + if (i <= locIndex) { + // 已走过的置灰 + textureList.add(arrivedBitmap) + } else { + // 未走过的纹理 + textureList.add(unArrivedBitmap) + } + texIndexList.add(i) + } + if (mAMap != null && coordinates.size > 2) { + //设置线段纹理 + val polylineOptions = PolylineOptions() + polylineOptions.addAll(coordinates) + polylineOptions.width(14f) //线段宽度 + polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound) + polylineOptions.customTextureList = textureList + polylineOptions.customTextureIndex = texIndexList + // 绘制线 + mBottomPolyline = mCoveredPolyline + mCoveredPolyline = mAMap!!.addPolyline(polylineOptions) + if (mBottomPolyline != null) { + mBottomPolyline!!.remove() + } + } + } + + override fun onChassisLocationGCJ02(gnssInfo: MessagePad.GnssInfo?) { + mLocation = gnssInfo + lonLat = Pair(gnssInfo!!.longitude, gnssInfo.latitude) + drawCarMarker(gnssInfo) + if (isFirstLocation) { + displayCustomOverView() + isFirstLocation = false + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/vm/OverViewModel.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/vm/OverViewModel.kt index 9250e8fd6e..8b1237a6c6 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/vm/OverViewModel.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/vm/OverViewModel.kt @@ -4,7 +4,7 @@ import androidx.lifecycle.* import com.mogo.commons.constants.HostConst import com.mogo.eagle.core.data.map.Infrastructure import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo -import com.mogo.eagle.core.function.overview.OverviewDao +import com.mogo.eagle.core.function.overview.db.OverviewDao import com.mogo.eagle.core.function.overview.remote.OverViewServiceApi import com.mogo.eagle.core.function.overview.remote.V2XEvent import com.mogo.eagle.core.network.MoGoRetrofitFactory diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/obu/ObuStatusInfo.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/obu/ObuStatusInfo.kt index b0206c4d42..1331f1a366 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/obu/ObuStatusInfo.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/obu/ObuStatusInfo.kt @@ -1,14 +1,19 @@ package com.mogo.eagle.core.data.obu /** + * OBU 相关的状态信息数据 * @author xiaoyuzhou * @date 2021/9/30 5:38 下午 - * OBU 相关的状态信息数据 */ class ObuStatusInfo { - // 当前链接的IP地址, 默认地址 192.168.1.199 + /** + * 当前链接的IP地址, 默认地址 192.168.1.199 + */ var connectIP: String = "192.168.1.199" + /** + * OBU SDK 版本 + */ var obuSdkVersion = "" /** @@ -16,16 +21,6 @@ class ObuStatusInfo { */ var obuStatus = false - /** - * false--没有链接,true--链接成功 - */ - var obuHvStatus = false - - /** - * false--没有链接,true--链接成功 - */ - var obuRvStatus = false - /** * Stack information */ diff --git a/core/mogo-core-function-api/build.gradle b/core/mogo-core-function-api/build.gradle index e9b128373c..d1e326c4c5 100644 --- a/core/mogo-core-function-api/build.gradle +++ b/core/mogo-core-function-api/build.gradle @@ -47,6 +47,8 @@ dependencies { kapt rootProject.ext.dependencies.aroutercompiler implementation rootProject.ext.dependencies.coroutinescore implementation rootProject.ext.dependencies.coroutinesandroid + implementation rootProject.ext.dependencies.mogoobu + if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogo_core_data implementation project(path: ':libraries:mogo-adas') diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt index 928554ef5b..27433b48cc 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt @@ -229,16 +229,6 @@ interface IMoGoHmiProvider : IMoGoHmiViewProxy { */ fun updateMfStatus(tag: String, status: Boolean) - /** - * 设置司机端消息盒子是否展示 - */ - fun updateDriverMsgBoxTipView(show: Boolean) - - /** - * 设置乘客端消息盒子是否展示 - */ - fun updatePassengerMsgBoxTipView(show: Boolean) - /** * 调度弹窗展示 */ diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IGaoDeMapLocationListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IGaoDeMapLocationListener.kt new file mode 100644 index 0000000000..872df234ce --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IGaoDeMapLocationListener.kt @@ -0,0 +1,18 @@ +package com.mogo.eagle.core.function.api.map.listener + +import com.mogo.eagle.core.data.map.MogoLocation + +/** + * 封装高德地图通过设备GPS获取到的位置信息,频率1s一次,坐标系为CJC20 + * 这里的数据仅用于非高精度业务 + * @author xiaoyuzhou + * @date 2021/11/1 7:17 下午 + */ +interface IGaoDeMapLocationListener { + /** + * 定位发生改变 + * + * @param location 新定位点 + */ + fun onLocationChanged(location: MogoLocation, from: Int, isGps: Boolean) +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IMoGoMapLocationListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IMoGoMapLocationListener.kt deleted file mode 100644 index 368f4191af..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IMoGoMapLocationListener.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.mogo.eagle.core.function.api.map.listener - -import com.mogo.eagle.core.data.map.MogoLocation - -/** - * @author xiaoyuzhou - * @date 2021/11/1 7:17 下午 - * 地图定位回调 - */ -interface IMoGoMapLocationListener { - /** - * 定位发生改变 - * - * @param location 新定位点 - */ - fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) -} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxEventListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxEventListener.kt index cebfca9d9b..8cd6469ae6 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxEventListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxEventListener.kt @@ -1,9 +1,25 @@ package com.mogo.eagle.core.function.api.msgbox + +import com.mogo.eagle.core.data.msgbox.MsgBoxBean + /** * @author XuXinChao * @date 2023/1/16 * 消息盒子事件监听回调 */ interface IMsgBoxEventListener { + //汇总事件点击监听 fun onSummaryClickEvent() + + //更新提示红点视图 + fun onUpdateTipEvent(isShow: Boolean) + + //气泡态运营平台事件点击监听 + fun onBubbleOperationClickEvent(msgBoxBean: MsgBoxBean) + + //气泡态V2X消息事件点击监听 + fun onBubbleV2XClickEvent(msgBoxBean: MsgBoxBean) + + //气泡态上报消息事件点击监听 + fun onBubbleReportClickEvent(msgBoxBean: MsgBoxBean) } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuConnectListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuConnectListener.kt new file mode 100644 index 0000000000..a1cd814bda --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuConnectListener.kt @@ -0,0 +1,18 @@ +package com.mogo.eagle.core.function.api.obu + +import com.mogo.eagle.core.data.obu.ObuStatusInfo + +/** + * OBU 连接状态监听回调 + * @author xiaoyuzhou + * @date 2021/9/30 5:53 下午 + */ +interface IMoGoObuConnectListener { + + /** + * 检查OBU连链接信息 + * @param obuStatusInfo OBU 状态信息 + */ + fun onConnectStatus(obuStatusInfo: ObuStatusInfo) + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuLocationWGS84Listener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuLocationWGS84Listener.kt new file mode 100644 index 0000000000..c98d8f8982 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuLocationWGS84Listener.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.api.obu + +import com.mogo.support.obu.model.MogoObuHvBasicsData + +/** + * OBU HV 自车车辆基础信息数据,自车定位数据 WGS84 坐标系 + * @author donghongyu + * @date 2023-02-01 + */ +interface IMoGoObuLocationWGS84Listener { + + /** + * HV车辆基础信息 + * + * @param data 数据 + * @since 1.0.0 + */ + fun onObuLocationWGS84(data: MogoObuHvBasicsData) + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuStatusListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuStatusListener.kt index 7e39f9e31c..27446d7979 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuStatusListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuStatusListener.kt @@ -9,13 +9,6 @@ import com.mogo.eagle.core.data.traffic.TrafficData * OBU 状态监听回调 */ interface IMoGoObuStatusListener { - /** - * 检查OBU连链接信息 - * @param obuStatusInfo OBU 状态信息 - */ - fun onObuStatusResponse(obuStatusInfo: ObuStatusInfo){ - - } /** * v2i时延 diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuTrafficLightListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuTrafficLightListener.kt index 1b4be4e95c..fa902d6702 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuTrafficLightListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuTrafficLightListener.kt @@ -1,10 +1,9 @@ package com.mogo.eagle.core.function.api.obu - /** + * OBU 灯态信息 * @author lixiaopeng * @date 2022/1/30 10:28 下午 - * OBU 灯态信息 */ interface IMoGoObuTrafficLightListener { /** diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningMapListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningMapListener.kt new file mode 100644 index 0000000000..cef3c96e27 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningMapListener.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.api.obu + +import com.mogo.support.obu.model.MogoObuMapMathData + +/** + * OBU 地图匹配结果, + * @author donghongyu + * @date 2023-02-01 + */ +interface IMoGoObuWarningMapListener { + + /** + * 地图匹配结果 + * + * @param data 数据 + * @since 1.0.0 + */ + fun onMoGoObuMapMath(data: MogoObuMapMathData) + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRsiListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRsiListener.kt new file mode 100644 index 0000000000..cd0bc01735 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRsiListener.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.api.obu + +import com.mogo.support.obu.model.MogoObuRsiWarningData + +/** + * OBU RSI预警信息, + * @author donghongyu + * @date 2023-02-01 + */ +interface IMoGoObuWarningRsiListener { + + /** + * RSI预警信息 + * + * @param data 数据 + * @since 1.0.0 + */ + fun onMoGoObuRsiWarning(data: MogoObuRsiWarningData) + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRsmListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRsmListener.kt new file mode 100644 index 0000000000..f4cf1f6be2 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRsmListener.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.api.obu + +import com.mogo.support.obu.model.MogoObuRsmWarningData + +/** + * OBU RSM预警信息,弱势交通参与者预警信息 + * @author donghongyu + * @date 2023-02-01 + */ +interface IMoGoObuWarningRsmListener { + + /** + * RSM预警信息,弱势交通参与者预警信息 + * + * @param data 数据 + * @since 1.0.0 + */ + fun onMoGoObuRsmWarning(data: MogoObuRsmWarningData) + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRvListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRvListener.kt new file mode 100644 index 0000000000..59dd274b8d --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningRvListener.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.api.obu + +import com.mogo.support.obu.model.MogoObuRvWarningData + +/** + * OBU V2V预警信息, + * @author donghongyu + * @date 2023-02-01 + */ +interface IMoGoObuWarningRvListener { + + /** + * OBU V2V预警信息 + * + * @param data 数据 + * @since 1.0.0 + */ + fun onMoGoObuRvWarning(data: MogoObuRvWarningData) + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningSpatListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningSpatListener.kt new file mode 100644 index 0000000000..dfd99d2079 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuWarningSpatListener.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.api.obu + +import com.mogo.support.obu.model.MogoObuSpatWarningData + +/** + * OBU 红绿灯预警信息, + * @author donghongyu + * @date 2023-02-01 + */ +interface IMoGoObuWarningSpatListener { + + /** + * OBU 红绿灯预警信息 + * + * @param data 数据 + * @since 1.0.0 + */ + fun onMoGoObuSpatWarning(data: MogoObuSpatWarningData) + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/build.gradle b/core/mogo-core-function-call/build.gradle index 22a7f5270f..51aef62a5c 100644 --- a/core/mogo-core-function-call/build.gradle +++ b/core/mogo-core-function-call/build.gradle @@ -49,9 +49,11 @@ dependencies { // MoGo 数据埋点工具 implementation rootProject.ext.dependencies.analytics - compileOnly rootProject.ext.dependencies.mogocustommap + implementation rootProject.ext.dependencies.mogoobu + + if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogo_core_data implementation rootProject.ext.dependencies.mogo_core_utils diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/base/CallerBase.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/base/CallerBase.kt index 853d2cbb8d..c6e13e577a 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/base/CallerBase.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/base/CallerBase.kt @@ -13,7 +13,7 @@ import java.util.concurrent.ConcurrentHashMap open class CallerBase { // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - val M_LISTENERS: ConcurrentHashMap = ConcurrentHashMap() + protected val M_LISTENERS: ConcurrentHashMap = ConcurrentHashMap() /** * 添加 监听 @@ -21,8 +21,8 @@ open class CallerBase { * @param listener 监听回调 */ fun addListener( - tag: String, - listener: T + tag: String, + listener: T ) { if (M_LISTENERS.containsKey(tag)) { return diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index b89e16b16d..2011cb665e 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -327,20 +327,6 @@ object CallerHmiManager { waringProviderApi?.updateStatusBarLeftView(insert, tag, viewGroup) } - /** - * 设置司机端消息盒子是否展示 - */ - fun updateDriverMsgBoxTipView(show: Boolean = false) { - waringProviderApi?.updateDriverMsgBoxTipView(show) - } - - /** - * 设置乘客端消息盒子是否展示 - */ - fun updatePassengerMsgBoxTipView(show: Boolean = false) { - waringProviderApi?.updatePassengerMsgBoxTipView(show) - } - /** * 更新(添加/删除)状态栏右侧元素 */ diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt index 08ab9ff67f..1b6cad9637 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt @@ -1,14 +1,12 @@ package com.mogo.eagle.core.function.call.map import com.mogo.eagle.core.data.map.MogoLocation -import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener import com.mogo.eagle.core.function.call.base.CallerBase -import java.util.concurrent.ConcurrentHashMap /** - * @author xiaoyuzhou + * 高德地图 位置改变 监听管理 + * @author dongghongyu * @date 2021/9/30 5:48 下午 - * 地图 位置改变 监听管理 */ object CallerMapLocationListenerManager : CallerBase() { diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxEventListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxEventListenerManager.kt index 9b61eec3f2..35470b458f 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxEventListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxEventListenerManager.kt @@ -1,6 +1,7 @@ package com.mogo.eagle.core.function.call.msgbox import androidx.annotation.Nullable +import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener import com.mogo.eagle.core.function.call.base.CallerBase import java.util.concurrent.ConcurrentHashMap @@ -12,19 +13,60 @@ import java.util.concurrent.ConcurrentHashMap */ object CallerMsgBoxEventListenerManager: CallerBase() { - private val statusListeners: ConcurrentHashMap = - ConcurrentHashMap() - /** - * 触发监听 + * 触发汇总报告点击事件监听 */ - fun invokeListener(){ - statusListeners.forEach { + fun invokeSummaryListener(){ + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onSummaryClickEvent() } } + /** + * 更新消息提示View展示状态 + */ + fun invokeUpdateTipListener(isShow: Boolean){ + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onUpdateTipEvent(isShow) + } + } + + /** + * 气泡态运营平台事件点击监听 + **/ + fun invokeBubbleOperationListener(msgBoxBean: MsgBoxBean){ + M_LISTENERS.forEach{ + val tag = it.key + val listener = it.value + listener.onBubbleOperationClickEvent(msgBoxBean) + } + } + + /** + * 气泡态V2X消息事件点击监听 + */ + fun invokeBubbleV2XListener(msgBoxBean: MsgBoxBean){ + M_LISTENERS.forEach{ + val tag = it.key + val listener = it.value + listener.onBubbleV2XClickEvent(msgBoxBean) + } + } + + /** + * 气泡态上报消息事件点击监听 + */ + fun invokeBubbleReportListener(msgBoxBean: MsgBoxBean){ + M_LISTENERS.forEach{ + val tag = it.key + val listener = it.value + listener.onBubbleReportClickEvent(msgBoxBean) + } + } + } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerOBUManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuApiManager.kt similarity index 84% rename from core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerOBUManager.kt rename to core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuApiManager.kt index 3dd265e6c8..0bc8fae569 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerOBUManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuApiManager.kt @@ -5,18 +5,17 @@ import com.mogo.eagle.core.function.api.obu.IMoGoObuProvider import com.mogo.eagle.core.function.call.base.CallerBase /** - *@author xiaoyuzhou - *@date 2021/10/11 8:30 下午 * 自研OBU管理 + * @author xiaoyuzhou + * @date 2021/10/11 8:30 下午 */ -object CallerOBUManager { +object CallerObuApiManager { private val providerApi: IMoGoObuProvider get() = CallerBase.getApiInstance( IMoGoObuProvider::class.java, MogoServicePaths.PATH_V2X_OBU_MOGO ) - /** * 重新设置OBU链接IP * @@ -29,7 +28,7 @@ object CallerOBUManager { /** * 断开OBU连接 */ - fun disConnectObu(){ + fun disConnectObu() { providerApi.disConnect() } @@ -37,7 +36,7 @@ object CallerOBUManager { * 获取OBU连接状态 * @return boolean 连接状态 */ - fun isConnected(): Boolean{ + fun isConnected(): Boolean { return providerApi.isConnected() } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuConnectListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuConnectListenerManager.kt new file mode 100644 index 0000000000..ab739efdf1 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuConnectListenerManager.kt @@ -0,0 +1,59 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.data.obu.ObuStatusInfo +import com.mogo.eagle.core.function.api.obu.IMoGoObuConnectListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.eagle.core.utilcode.util.GsonUtils + +/** + * OBU 监听管理 + * @author xiaoyuzhou + * @date 2021/9/30 5:48 下午 + */ +object CallerObuConnectListenerManager : CallerBase() { + + /** + * 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态 + */ + private var mObuStatusInfo: ObuStatusInfo = ObuStatusInfo() + + /** + * 查询 OBU状态 + */ + fun getObuStatusInfo(): ObuStatusInfo { + return mObuStatusInfo + } + + /** + * 查询 OBU状态 + */ + fun getObuStatusInfoJsonString(): String { + return GsonUtils.toJson(mObuStatusInfo) + } + + override fun doSomeAfterAddListener(tag: String, listener: IMoGoObuConnectListener) { + listener.onConnectStatus(mObuStatusInfo) + } + + /** + * 触发 OBU状态 监听 + */ + fun invokeObuConnectListener() { + invokeObuConnectListener(mObuStatusInfo) + } + + /** + * 触发 OBU状态 监听 + * @param obuStatusInfo 当前OBU连接状态信息 + */ + fun invokeObuConnectListener(obuStatusInfo: ObuStatusInfo) { + mObuStatusInfo = obuStatusInfo + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onConnectStatus(mObuStatusInfo) + } + } + + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuListenerManager.kt deleted file mode 100644 index c13c01f3cd..0000000000 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuListenerManager.kt +++ /dev/null @@ -1,80 +0,0 @@ -package com.mogo.eagle.core.function.call.obu - -import com.mogo.eagle.core.data.obu.ObuStatusInfo -import com.mogo.eagle.core.data.traffic.TrafficData -import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener -import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.utilcode.util.GsonUtils - -/** - * @author xiaoyuzhou - * @date 2021/9/30 5:48 下午 - * OBU 监听管理 - */ -object CallerObuListenerManager : CallerBase() { - - // 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态 - private var mObuStatusInfo: ObuStatusInfo = ObuStatusInfo() - - /** - * 查询 OBU状态 - */ - fun getObuStatusInfo(): ObuStatusInfo { - return mObuStatusInfo - } - - /** - * 查询 OBU状态 - */ - fun getObuStatusInfoJsonString(): String { - return GsonUtils.toJson(mObuStatusInfo) - } - - override fun doSomeAfterAddListener(tag: String, listener: IMoGoObuStatusListener) { - listener.onObuStatusResponse(mObuStatusInfo) - } - - - /** - * 触发 OBU状态 监听 - */ - fun invokeListener() { - invokeListener(mObuStatusInfo) - } - - /** - * 触发 OBU状态 监听 - * @param obuStatusInfo 选中状态 - */ - fun invokeListener(obuStatusInfo: ObuStatusInfo) { - mObuStatusInfo = obuStatusInfo - M_LISTENERS.forEach { - val tag = it.key - val listener = it.value - listener.onObuStatusResponse(mObuStatusInfo) - } - } - - fun invokeDelayTime(delayTime: Long) { - M_LISTENERS.forEach { - val tag = it.key - val listener = it.value - listener.onObuV2iDelayTime(delayTime) - } - } - - fun invokeTrackerWarningInfo(trafficData: TrafficData){ - M_LISTENERS.forEach { - val listener = it.value - listener.updateTrackerWarningInfo(trafficData) - } - } - - fun removeTrackerWarningInfo(trafficData: TrafficData){ - M_LISTENERS.forEach { - val listener = it.value - listener.removeTrackerWarningInfo(trafficData) - } - } - -} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuLocationWGS84ListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuLocationWGS84ListenerManager.kt new file mode 100644 index 0000000000..8b1370b34b --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuLocationWGS84ListenerManager.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.function.api.obu.IMoGoObuLocationWGS84Listener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.support.obu.model.MogoObuHvBasicsData + +/** + * OBU HV 自车车辆基础信息数据,自车定位数据 WGS84 坐标系 + */ +object CallerObuLocationWGS84ListenerManager : CallerBase() { + + fun invokeObuLocationWGS84(data: MogoObuHvBasicsData) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onObuLocationWGS84(data) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuMapMathListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuMapMathListenerManager.kt new file mode 100644 index 0000000000..1885e9dd63 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuMapMathListenerManager.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningMapListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.support.obu.model.MogoObuMapMathData + +/** + * OBU 地图匹配结果,车道线、红绿灯、建议最大车速、建议最小车速 + */ +object CallerObuMapMathListenerManager : CallerBase() { + + fun invokeObuMapMath(data: MogoObuMapMathData) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onMoGoObuMapMath(data) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuTrafficLightListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuTrafficLightListenerManager.kt index e881947ad9..972feeeeb7 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuTrafficLightListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuTrafficLightListenerManager.kt @@ -2,20 +2,21 @@ package com.mogo.eagle.core.function.call.obu import com.mogo.eagle.core.function.api.obu.IMoGoObuTrafficLightListener import com.mogo.eagle.core.function.call.base.CallerBase -import java.util.concurrent.ConcurrentHashMap - +/** + * OBU 红绿灯数据监听管理 + */ object CallerObuTrafficLightListenerManager : CallerBase() { - private val M_OBU_TRAFFIC_LIGHT_LISTENER: ConcurrentHashMap = - ConcurrentHashMap() - var mLight: Int = 0 + override fun doSomeAfterAddListener(tag: String, listener: IMoGoObuTrafficLightListener) { + listener.onObuTrafficLight(mLight) + } fun invokeObuTrafficLight(light: Int) { this.mLight = light - M_OBU_TRAFFIC_LIGHT_LISTENER.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onObuTrafficLight(light) diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningListenerManager.kt new file mode 100644 index 0000000000..228bb7fb73 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningListenerManager.kt @@ -0,0 +1,36 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.data.traffic.TrafficData +import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener +import com.mogo.eagle.core.function.call.base.CallerBase + +/** + * OBU 监听管理 + * @author xiaoyuzhou + * @date 2021/9/30 5:48 下午 + */ +object CallerObuWarningListenerManager : CallerBase() { + + fun invokeDelayTime(delayTime: Long) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onObuV2iDelayTime(delayTime) + } + } + + fun invokeTrackerWarningInfo(trafficData: TrafficData) { + M_LISTENERS.forEach { + val listener = it.value + listener.updateTrackerWarningInfo(trafficData) + } + } + + fun removeTrackerWarningInfo(trafficData: TrafficData) { + M_LISTENERS.forEach { + val listener = it.value + listener.removeTrackerWarningInfo(trafficData) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRsiListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRsiListenerManager.kt new file mode 100644 index 0000000000..e8ad4f4dc2 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRsiListenerManager.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsiListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.support.obu.model.MogoObuRsiWarningData + +/** + * OBU 交通事件预警 + */ +object CallerObuWarningRsiListenerManager : CallerBase() { + + fun invokeObuRsiWarning(data: MogoObuRsiWarningData) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onMoGoObuRsiWarning(data) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRsmListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRsmListenerManager.kt new file mode 100644 index 0000000000..38c8549d2b --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRsmListenerManager.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsmListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.support.obu.model.MogoObuRsmWarningData + +/** + * OBU RSM预警信息,弱势交通参与者预警信息 + */ +object CallerObuWarningRsmListenerManager : CallerBase() { + + fun invokeObuRsmWarning(data: MogoObuRsmWarningData) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onMoGoObuRsmWarning(data) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRvListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRvListenerManager.kt new file mode 100644 index 0000000000..659d11a338 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningRvListenerManager.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRvListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.support.obu.model.MogoObuRvWarningData + +/** + * OBU V2V预警信息,车与车间的预警,左右超车、前方车刹车、车辆事故 + */ +object CallerObuWarningRvListenerManager : CallerBase() { + + fun invokeObuRvWarning(data: MogoObuRvWarningData) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onMoGoObuRvWarning(data) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningSpatListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningSpatListenerManager.kt new file mode 100644 index 0000000000..98d48a9834 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuWarningSpatListenerManager.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningSpatListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.support.obu.model.MogoObuSpatWarningData + +/** + * OBU 红绿灯信息 + */ +object CallerObuWarningSpatListenerManager : CallerBase() { + + fun invokeObuSpatWarning(data: MogoObuSpatWarningData) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onMoGoObuSpatWarning(data) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/RoundCanClickConstraintLayout.java b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/RoundCanClickConstraintLayout.java new file mode 100644 index 0000000000..86f6939aa0 --- /dev/null +++ b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/RoundCanClickConstraintLayout.java @@ -0,0 +1,70 @@ +package com.mogo.eagle.core.widget; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Path; +import android.graphics.RectF; +import android.util.AttributeSet; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.constraintlayout.widget.ConstraintLayout; + +public class RoundCanClickConstraintLayout extends ConstraintLayout { + + private float roundLayoutRadius = 14f; + private Path roundPath; + private RectF rectF; + + public RoundCanClickConstraintLayout(@NonNull Context context) { + super(context); + } + + public RoundCanClickConstraintLayout(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RoundLayout); + roundLayoutRadius = typedArray.getDimensionPixelSize(R.styleable.RoundLayout_roundLayoutRadius, (int) roundLayoutRadius); + typedArray.recycle(); + + init(); + } + + public RoundCanClickConstraintLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + private void init() { + setWillNotDraw(false);//如果你继承的是ViewGroup,注意此行,否则draw方法是不会回调的; + roundPath = new Path(); + rectF = new RectF(); + } + + private void setRoundPath() { + //添加一个圆角矩形到path中, 如果要实现任意形状的View, 只需要手动添加path就行 + roundPath.reset(); + roundPath.addRoundRect(rectF, roundLayoutRadius, roundLayoutRadius, Path.Direction.CW); + } + + public void setRoundLayoutRadius(float roundLayoutRadius) { + this.roundLayoutRadius = roundLayoutRadius; + setRoundPath(); + postInvalidate(); + } + + @Override + protected void onLayout(boolean changed, int l, int t, int r, int b) { + super.onLayout(changed, l, t, r, b); + rectF.set(0f, 0f, getMeasuredWidth(), getMeasuredHeight()); + setRoundPath(); + } + + @Override + public void draw(Canvas canvas) { + if (roundLayoutRadius > 0f) { + canvas.clipPath(roundPath); + } + super.draw(canvas); + } + +} diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java b/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java index d31f4e29ce..2dfa892d3d 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java @@ -10,6 +10,10 @@ import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.constants.SharedPrefsConstants; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; +/** + * 封装高德地图通过设备GPS获取到的位置信息,频率1s一次,坐标系为CJC20 + * 这里的数据仅用于非高精度业务 + */ public class GDLocationClient implements AMapLocationListener, IMogoGDLocationClient { private volatile static GDLocationClient gdLocationClient;