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 @@ + + + + + + + (), } - // 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/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 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-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); + } + +}