[6.7.0]去除司机端旧版消息盒子

This commit is contained in:
xuxinchao
2024-09-20 17:39:58 +08:00
parent 6db0ade534
commit 7b26c6a3a4
11 changed files with 338 additions and 249 deletions

View File

@@ -16,7 +16,6 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.isCanStartAutopilot
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager.attachAutopilotBeforeLaunchView
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.bus.R
@@ -35,9 +34,6 @@ import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_autopilo
import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_slide_panel
import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_station_panel_container
import kotlinx.android.synthetic.main.bus_base_fragment.smallMapView
import kotlinx.android.synthetic.main.bus_base_fragment.viewDriverMsgBoxBubble
import kotlinx.android.synthetic.main.bus_base_fragment.viewDriverMsgBoxButton
import kotlinx.android.synthetic.main.bus_base_fragment.viewDriverMsgBoxList
import org.greenrobot.eventbus.EventBus
/**
@@ -84,22 +80,6 @@ abstract class BaseBusTabFragment<V : IView?, P : Presenter<V>?> : MvpFragment<V
module_mogo_och_arrived_tv.setOnClickListener { onArriveStation() }
//消息盒子
viewDriverMsgBoxButton!!.setClickListener(object :DriverMsgBoxButtonView.ClickListener{
override fun showMsgBoxList(show: Boolean) {
if (show) {
viewDriverMsgBoxList!!.visibility = View.VISIBLE
viewDriverMsgBoxList!!.notifyData()
viewDriverMsgBoxBubble!!.visibility = View.GONE
viewDriverMsgBoxBubble!!.isShowData(false)
} else {
viewDriverMsgBoxList!!.visibility = View.GONE
viewDriverMsgBoxBubble!!.visibility = View.VISIBLE
viewDriverMsgBoxBubble!!.isShowData(true)
}
}
})
}
override fun initViews(savedInstanceState: Bundle?) {

View File

@@ -127,33 +127,6 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--消息盒子选择入口-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
android:id="@+id/viewDriverMsgBoxButton"
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"
android:layout_marginTop="15dp"
android:layout_marginEnd="25dp"
app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon" />
<!--消息盒子打开视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
android:id="@+id/viewDriverMsgBoxList"
android:layout_width="864dp"
android:layout_height="746dp"
android:layout_marginEnd="40dp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--消息盒子气泡视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView
android:id="@+id/viewDriverMsgBoxBubble"
android:layout_width="864dp"
android:layout_height="wrap_content"
android:layout_marginEnd="40dp"
android:visibility="visible"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--红绿灯-->
<com.mogo.eagle.core.function.hmi.ui.widget.SingleTrafficLightView

View File

@@ -17,10 +17,6 @@ import com.mogo.commons.mvp.Presenter
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager.attachAutopilotBeforeLaunchView
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.DriverMsgBoxButtonView.ClickListener
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
import com.mogo.eagle.core.function.smp.view.SmallMapView
import com.mogo.eagle.core.function.view.MapBizView
import com.mogo.eagle.core.utilcode.kotlin.onClick
@@ -49,10 +45,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() : MvpFragmen
protected var smallMapView: SmallMapView? = null
//消息盒子
private var viewDriverMsgBoxButton: DriverMsgBoxButtonView? = null
private var viewDriverMsgBoxList: DriverMsgBoxListView? = null
private var viewDriverMsgBoxBubble: DriverMsgBoxBubbleView? = null
private var autopilotLoadingAnimator: ObjectAnimator? = null
@@ -113,24 +105,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() : MvpFragmen
onArriveStation()
}
//消息盒子
viewDriverMsgBoxButton = findViewById(R.id.viewDriverMsgBoxButton)
viewDriverMsgBoxList = findViewById(R.id.viewDriverMsgBoxList)
viewDriverMsgBoxBubble = findViewById(R.id.viewDriverMsgBoxBubble)
viewDriverMsgBoxButton!!.setClickListener(object : ClickListener {
override fun showMsgBoxList(show: Boolean) {
if (show) {
viewDriverMsgBoxList!!.visibility = View.VISIBLE
viewDriverMsgBoxList!!.notifyData()
viewDriverMsgBoxBubble!!.visibility = View.GONE
viewDriverMsgBoxBubble!!.isShowData(false)
} else {
viewDriverMsgBoxList!!.visibility = View.GONE
viewDriverMsgBoxBubble!!.visibility = View.VISIBLE
viewDriverMsgBoxBubble!!.isShowData(true)
}
}
})
smallMapView = findViewById(R.id.smallMapView)
ctvAutopilotStatus?.setOnLongClickListener {

View File

@@ -124,33 +124,6 @@
android:visibility="invisible"
app:layout_constraintTop_toBottomOf="@+id/viewLimitingVelocity"/>
<!--消息盒子选择入口-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
android:id="@+id/viewDriverMsgBoxButton"
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"
android:layout_marginTop="15dp"
android:layout_marginEnd="25dp"
app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon" />
<!--消息盒子打开视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
android:id="@+id/viewDriverMsgBoxList"
android:layout_width="864dp"
android:layout_height="746dp"
android:layout_marginEnd="40dp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--消息盒子气泡视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView
android:id="@+id/viewDriverMsgBoxBubble"
android:layout_width="864dp"
android:layout_height="wrap_content"
android:layout_marginEnd="40dp"
android:visibility="visible"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--红绿灯-->
<com.mogo.eagle.core.function.hmi.ui.widget.SingleTrafficLightView

View File

@@ -30,9 +30,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
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.smp.view.SmallMapView;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
@@ -70,11 +67,6 @@ public abstract class BaseShuttleTabFragment<V extends IView, P extends Presente
protected SmallMapView smallMapView;
//消息盒子
private DriverMsgBoxButtonView viewDriverMsgBoxButton;
private DriverMsgBoxListView viewDriverMsgBoxList;
private DriverMsgBoxBubbleView viewDriverMsgBoxBubble;
private ObjectAnimator autopilotLoadingAnimator;
public boolean isAnimateRunning = false;
@@ -155,22 +147,6 @@ public abstract class BaseShuttleTabFragment<V extends IView, P extends Presente
onArriveStation();
});
//消息盒子
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);
}
});
smallMapView = findViewById(R.id.smallMapView);
}

View File

@@ -114,33 +114,6 @@
android:visibility="invisible"
app:layout_constraintTop_toBottomOf="@+id/viewLimitingVelocity"/>
<!--消息盒子选择入口-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
android:id="@+id/viewDriverMsgBoxButton"
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"
android:layout_marginTop="15dp"
android:layout_marginEnd="25dp"
app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon" />
<!--消息盒子打开视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
android:id="@+id/viewDriverMsgBoxList"
android:layout_width="864dp"
android:layout_height="746dp"
android:layout_marginEnd="40dp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--消息盒子气泡视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView
android:id="@+id/viewDriverMsgBoxBubble"
android:layout_width="864dp"
android:layout_height="wrap_content"
android:layout_marginEnd="40dp"
android:visibility="visible"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--红绿灯-->
<com.mogo.eagle.core.function.hmi.ui.widget.SingleTrafficLightView

View File

@@ -28,9 +28,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
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.view.MapBizView;
import com.mogo.eagle.core.function.smp.view.SmallMapView;
import com.mogo.eagle.core.function.view.MapRoamView;
@@ -70,10 +67,6 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
private ImageView mAutopilotImage;
private TextView mAutopilotTv;
private ImageView mCloseNaviIcon;
//消息盒子
protected DriverMsgBoxButtonView driverMsgBoxButtonView;
protected DriverMsgBoxListView viewDriverMsgBoxList;
protected DriverMsgBoxBubbleView viewDriverMsgBoxBubble;
protected VisualViewDirver visualViewDirver;
protected TaxiAmapNaviFragment ochAmapNaviFragment = null;
@@ -101,9 +94,6 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
mAutopilotImage = findViewById(R.id.module_och_autopilot_iv);
mAutopilotTv = findViewById(R.id.module_och_autopilot_tv);
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container);
driverMsgBoxButtonView = findViewById(R.id.viewDriverMsgBoxButton);
viewDriverMsgBoxList = findViewById(R.id.viewDriverMsgBoxList);
viewDriverMsgBoxBubble = findViewById(R.id.viewDriverMsgBoxBubble);
visualViewDirver = findViewById(R.id.vvd_change_angle);
mSpeedView = findViewById(R.id.taxi_speed_contain);
@@ -178,18 +168,6 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
showRottingToStationFragment(false);
});
driverMsgBoxButtonView.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);
}
});
smallMapView = findViewById(R.id.smallMapView);
acivShowGuid = findViewById(R.id.aciv_show_guid);
@@ -270,9 +248,6 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
mAutopilotImage = null;
mAutopilotTv = null;
mCloseNaviIcon = null;
driverMsgBoxButtonView = null;
viewDriverMsgBoxList = null;
viewDriverMsgBoxBubble = null;
ochAmapNaviFragment = null;
taxiRottingNaviFragment = null;
smallMapView = null;

View File

@@ -192,33 +192,6 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--消息盒子选择入口-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
android:id="@+id/viewDriverMsgBoxButton"
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"
android:layout_marginTop="15dp"
android:layout_marginEnd="25dp"
app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon" />
<!--消息盒子打开视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
android:id="@+id/viewDriverMsgBoxList"
android:layout_width="864dp"
android:layout_height="746dp"
android:layout_marginEnd="40dp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--消息盒子气泡视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView
android:id="@+id/viewDriverMsgBoxBubble"
android:layout_width="864dp"
android:layout_height="wrap_content"
android:layout_marginEnd="40dp"
android:visibility="visible"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--红绿灯-->
<com.mogo.eagle.core.function.hmi.ui.widget.SingleTrafficLightView

View File

@@ -21,7 +21,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
import com.mogo.eagle.core.function.hmi.ui.widget.ParallelDriveView
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener
@@ -51,9 +50,6 @@ import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.parallelDriveV
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.smallMapView
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.startAutopilotAnimationView
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.taxi_close_navi_icon
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.viewDriverMsgBoxBubble
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.viewDriverMsgBoxButton
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.viewDriverMsgBoxList
/**
* @author: wangmingjun
* @date: 2023/7/24
@@ -178,20 +174,6 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
showAmapNaviToStationFragment(false)
showRoutingToStationFragment(false)
}
viewDriverMsgBoxButton.setClickListener(object : DriverMsgBoxButtonView.ClickListener {
override fun showMsgBoxList(show: Boolean) {
if (show) {
viewDriverMsgBoxList.visibility = View.VISIBLE
viewDriverMsgBoxList.notifyData()
viewDriverMsgBoxBubble.visibility = View.GONE
viewDriverMsgBoxBubble.isShowData(false)
} else {
viewDriverMsgBoxList.visibility = View.GONE
viewDriverMsgBoxBubble.visibility = View.VISIBLE
viewDriverMsgBoxBubble.isShowData(true)
}
}
})
smallMapView.onClick {
context?.let {

View File

@@ -147,34 +147,6 @@
app:layout_goneMarginTop="@dimen/dp_236"
android:visibility="invisible"
app:layout_constraintTop_toBottomOf="@+id/viewLimitingVelocity"/>
<!--消息盒子选择入口-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
android:id="@+id/viewDriverMsgBoxButton"
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"
android:layout_marginTop="15dp"
android:layout_marginEnd="25dp"
app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon" />
,.
<!--消息盒子打开视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
android:id="@+id/viewDriverMsgBoxList"
android:layout_width="864dp"
android:layout_height="746dp"
android:layout_marginEnd="40dp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--消息盒子气泡视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView
android:id="@+id/viewDriverMsgBoxBubble"
android:layout_width="864dp"
android:layout_height="wrap_content"
android:layout_marginEnd="40dp"
android:visibility="visible"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--平行驾驶状态-->
<com.mogo.eagle.core.function.hmi.ui.widget.ParallelDriveView

View File

@@ -0,0 +1,338 @@
package com.mogo.eagle.core.function.hmi.bone.tab
import android.app.Activity
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.order.IOrderListener
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.call.order.CallerOrderListenerManager
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.util.UiThreadHandler
import kotlinx.android.synthetic.main.layout_driver_msg_box_list.view.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
/**
* @author XuXinChao
* @description 司机端消息盒子打开列表视图
* @since: 2022/11/25
*/
class MsgBoxListTabView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener, IMsgBoxEventListener,
IOrderListener {
init {
LayoutInflater.from(context).inflate(R.layout.layout_driver_msg_box_list, this, true)
initView()
}
private val TAG = "DriverMsgBoxListView"
private var noticeList: ArrayList<MsgBoxBean> ?= null //通知消息列表
private var fmList: ArrayList<MsgBoxBean> ?= ArrayList() //FM信息消息列表
private var ipcReportList: ArrayList<MsgBoxBean> ?= null //车辆系统信息消息列表
private var badCaseList: ArrayList<MsgBoxBean> ?= null//录包消息列表
private var driverMsgBoxListAdapter: DriverMsgBoxListAdapter ?=null
private var linearLayoutManager: LinearLayoutManager ?= null
private var isShowSummary = false //是否展示汇总消息
private fun initView() {
driverMsgBoxListAdapter= DriverMsgBoxListAdapter(context as Activity)
rvMsgBoxList.adapter = driverMsgBoxListAdapter
linearLayoutManager = LinearLayoutManager(context)
rvMsgBoxList.layoutManager = linearLayoutManager
//获取通知消息列表
noticeList= CallerMsgBoxManager.getCachedNotifyData() as ArrayList<MsgBoxBean>?
noticeList = noticeList?.let { ArrayList(it.reversed()) }
//获取车辆系统信息列表
ipcReportList = CallerMsgBoxManager.getCachedSysInfoData() as ArrayList<MsgBoxBean>?
ipcReportList = ipcReportList?.let { ArrayList(it.reversed()) }
//获取录包信息列表
badCaseList = CallerMsgBoxManager.getCachedRecordBagData() as ArrayList<MsgBoxBean>?
badCaseList = badCaseList?.let { ArrayList(it.reversed()) }
//通知
tvMsgNotice.setOnClickListener {
tvMsgNotice.setTextColor(ContextCompat.getColor(context, R.color.msg_box_title_color))
tvMsgFm.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgIpcReport.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgBadCase.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgNotice.setBackgroundResource(R.drawable.bg_msg_box_title_selected)
tvMsgFm.background = null
tvMsgIpcReport.background = null
tvMsgBadCase.background = null
MsgBoxConfig.setUserRecord(0)
if(noticeList==null){
rvMsgBoxList.visibility = View.GONE
}else{
driverMsgBoxListAdapter?.setData(noticeList!!)
rvMsgBoxList.visibility = View.VISIBLE
rvMsgBoxList.scrollToPosition(0)
}
}
//FM信息
tvMsgFm.setOnClickListener {
tvMsgNotice.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgFm.setTextColor(ContextCompat.getColor(context, R.color.msg_box_title_color))
tvMsgIpcReport.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgBadCase.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgNotice.background = null
tvMsgFm.setBackgroundResource(R.drawable.bg_msg_box_title_selected)
tvMsgIpcReport.background = null
tvMsgBadCase.background = null
MsgBoxConfig.setUserRecord(1)
if(fmList == null){
rvMsgBoxList.visibility = View.GONE
}else{
driverMsgBoxListAdapter?.setData(fmList!!)
rvMsgBoxList.visibility = View.VISIBLE
rvMsgBoxList.scrollToPosition(0)
}
}
//车辆系统信息
tvMsgIpcReport.setOnClickListener {
tvMsgNotice.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgFm.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgIpcReport.setTextColor(ContextCompat.getColor(context, R.color.msg_box_title_color))
tvMsgBadCase.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgNotice.background = null
tvMsgFm.background = null
tvMsgIpcReport.setBackgroundResource(R.drawable.bg_msg_box_title_selected)
tvMsgBadCase.background = null
MsgBoxConfig.setUserRecord(2)
if(ipcReportList == null){
rvMsgBoxList.visibility = View.GONE
}else{
driverMsgBoxListAdapter?.setData(ipcReportList!!)
rvMsgBoxList.visibility = View.VISIBLE
rvMsgBoxList.scrollToPosition(0)
}
}
//录包
tvMsgBadCase.setOnClickListener {
tvMsgNotice.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgFm.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgIpcReport.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgBadCase.setTextColor(ContextCompat.getColor(context, R.color.msg_box_title_color))
tvMsgNotice.background = null
tvMsgFm.background = null
tvMsgIpcReport.background = null
tvMsgBadCase.setBackgroundResource(R.drawable.bg_msg_box_title_selected)
MsgBoxConfig.setUserRecord(3)
if(badCaseList == null){
rvMsgBoxList.visibility = View.GONE
}else{
driverMsgBoxListAdapter?.setData(badCaseList!!)
rvMsgBoxList.visibility = View.VISIBLE
rvMsgBoxList.scrollToPosition(0)
}
}
}
fun notifyData(){
//获取当前Tab选择
when(MsgBoxConfig.getUserRecord()){
//通知消息
0 ->{
tvMsgNotice.setTextColor(ContextCompat.getColor(context, R.color.msg_box_title_color))
tvMsgFm.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgIpcReport.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgBadCase.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgNotice.setBackgroundResource(R.drawable.bg_msg_box_title_selected)
tvMsgFm.background = null
tvMsgIpcReport.background = null
tvMsgBadCase.background = null
if(noticeList==null){
rvMsgBoxList.visibility = View.GONE
}else{
driverMsgBoxListAdapter?.setData(noticeList!!)
rvMsgBoxList.visibility = View.VISIBLE
rvMsgBoxList.scrollToPosition(0)
}
}
//FM消息
1->{
tvMsgNotice.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgFm.setTextColor(ContextCompat.getColor(context, R.color.msg_box_title_color))
tvMsgIpcReport.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgBadCase.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgNotice.background = null
tvMsgFm.setBackgroundResource(R.drawable.bg_msg_box_title_selected)
tvMsgIpcReport.background = null
tvMsgBadCase.background = null
if(fmList == null){
rvMsgBoxList.visibility = View.GONE
}else{
driverMsgBoxListAdapter?.setData(fmList!!)
rvMsgBoxList.visibility = View.VISIBLE
rvMsgBoxList.scrollToPosition(0)
}
}
//车辆系统信息消息
2 ->{
tvMsgNotice.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgFm.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgIpcReport.setTextColor(ContextCompat.getColor(context, R.color.msg_box_title_color))
tvMsgBadCase.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgNotice.background = null
tvMsgFm.background = null
tvMsgIpcReport.setBackgroundResource(R.drawable.bg_msg_box_title_selected)
tvMsgBadCase.background = null
if(ipcReportList == null){
rvMsgBoxList.visibility = View.GONE
}else{
driverMsgBoxListAdapter?.setData(ipcReportList!!)
rvMsgBoxList.visibility = View.VISIBLE
rvMsgBoxList.scrollToPosition(0)
}
}
//录包消息
3 ->{
tvMsgNotice.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgFm.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgIpcReport.setTextColor(ContextCompat.getColor(context, R.color.color_FFFFFF))
tvMsgBadCase.setTextColor(ContextCompat.getColor(context, R.color.msg_box_title_color))
tvMsgNotice.background = null
tvMsgFm.background = null
tvMsgIpcReport.background = null
tvMsgBadCase.setBackgroundResource(R.drawable.bg_msg_box_title_selected)
if(badCaseList == null){
rvMsgBoxList.visibility = View.GONE
}else{
driverMsgBoxListAdapter?.setData(badCaseList!!)
rvMsgBoxList.visibility = View.VISIBLE
rvMsgBoxList.scrollToPosition(0)
}
}
}
}
override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) {
UiThreadHandler.post({
when (category) {
//通知
MsgCategory.NOTICE -> {
if(msgBoxList.sourceType == DataSourceType.SUMMARY){
//在一次订单中汇总消息只展示一次
if(isShowSummary){
noticeList?.add(0,msgBoxList)
if(MsgBoxConfig.getUserRecord() == 0){
noticeList?.let { driverMsgBoxListAdapter?.setData(it) }
}
isShowSummary = false
}
}else{
noticeList?.add(0,msgBoxList)
if(MsgBoxConfig.getUserRecord() == 0){
noticeList?.let { driverMsgBoxListAdapter?.setData(it) }
}
}
}
//FM信息
MsgCategory.FM_INFO -> {
fmList?.add(0,msgBoxList)
if(MsgBoxConfig.getUserRecord() == 1){
fmList?.let { driverMsgBoxListAdapter?.setData(it) }
}
}
//系统信息
MsgCategory.SYS_INFO -> {
ipcReportList?.add(0,msgBoxList)
if(MsgBoxConfig.getUserRecord() == 2){
ipcReportList?.let { driverMsgBoxListAdapter?.setData(it) }
}
}
//录包
MsgCategory.RECORD_BAG -> {
badCaseList?.add(0,msgBoxList)
if(MsgBoxConfig.getUserRecord() == 3){
badCaseList?.let { driverMsgBoxListAdapter?.setData(it) }
}
}
else -> {}
}
},UiThreadHandler.MODE.QUEUE)
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
EventBus.getDefault().register(this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
EventBus.getDefault().unregister(this)
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun notifyList(msgBoxList: MsgBoxBean){
badCaseList?.let {
driverMsgBoxListAdapter?.notifyItemRemoved(it.indexOf(msgBoxList))
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)
driverMsgBoxListAdapter?.setReportShowData(msgBoxBean)
}
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}
}