[opt-3.0]fix消息盒子气泡消息偶现未及时消除Bug

This commit is contained in:
xuxinchao
2023-03-08 20:08:09 +08:00
parent 01d9042887
commit 0a349896bc
10 changed files with 122 additions and 99 deletions

View File

@@ -9,6 +9,7 @@ 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.MsgBoxCountDownBean
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
@@ -39,7 +40,7 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
var driverMsgBoxBubbleAdapter: DriverMsgBoxBubbleAdapter ?=null
private val TAG = "DriverMsgBoxBubbleView"
private val dataList :ArrayList<MsgBoxBean> = ArrayList()
private val dataList :ArrayList<MsgBoxCountDownBean> = ArrayList()
private var isShowData = true
private fun initView() {
@@ -92,7 +93,8 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
//todo 过滤MAP系统异常报警
} else{
clMsgBubbleLayout.visibility = View.VISIBLE
dataList.add(msgBoxBean)
val msgBoxCountDownBean = MsgBoxCountDownBean(msgBoxBean)
dataList.add(msgBoxCountDownBean)
driverMsgBoxBubbleAdapter?.setData(dataList)
}
}

View File

@@ -7,6 +7,7 @@ import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxCountDownBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
@@ -25,7 +26,7 @@ class MBoxBubbleView @JvmOverloads constructor(
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener {
private val TAG = "PassengerMsgBoxBubbleView"
private val dataList :ArrayList<MsgBoxBean> = ArrayList()
private val dataList :ArrayList<MsgBoxCountDownBean> = ArrayList()
private var mBoxBubbleAdapter: MBoxBubbleAdapter?= null
private var isShowData = true
@@ -58,7 +59,8 @@ class MBoxBubbleView @JvmOverloads constructor(
MsgBoxConfig.noticeList.add(msgBoxList)
if(isShowData){
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
dataList.add(msgBoxList)
val msgBoxCountDownBean = MsgBoxCountDownBean(msgBoxList)
dataList.add(msgBoxCountDownBean)
mBoxBubbleAdapter?.setData(dataList)
}
}

View File

@@ -6,10 +6,7 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager
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.data.msgbox.OperationMsg
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
@@ -26,7 +23,7 @@ class MMsgBoxBubbleView @JvmOverloads constructor(
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener {
private val TAG = "MMsgBoxBubbleView"
private val dataList :ArrayList<MsgBoxBean> = ArrayList()
private val dataList :ArrayList<MsgBoxCountDownBean> = ArrayList()
private var mMsgBoxBubbleAdapter: MMsgBoxBubbleAdapter?= null
private var isShowData = true
@@ -56,27 +53,27 @@ class MMsgBoxBubbleView @JvmOverloads constructor(
if(category == MsgCategory.NOTICE){
if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X
|| msgBoxList.type == MsgBoxType.OBU){
MsgBoxConfig.noticeList.add(msgBoxList)
if(isShowData){
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
dataList.add(msgBoxList)
mMsgBoxBubbleAdapter?.setData(dataList)
}
update(msgBoxList)
}
if(msgBoxList.type == MsgBoxType.OPERATION){
if((msgBoxList.bean as OperationMsg).type == 2){
MsgBoxConfig.noticeList.add(msgBoxList)
if(isShowData){
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
dataList.add(msgBoxList)
mMsgBoxBubbleAdapter?.setData(dataList)
}
update(msgBoxList)
}
}
}
}
}
private fun update(msgBoxList: MsgBoxBean){
MsgBoxConfig.noticeList.add(msgBoxList)
if(isShowData){
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
val msgBoxCountDownBean = MsgBoxCountDownBean(msgBoxList)
dataList.add(msgBoxCountDownBean)
mMsgBoxBubbleAdapter?.setData(dataList)
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)

View File

@@ -7,6 +7,7 @@ import android.view.*
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxCountDownBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
@@ -30,7 +31,7 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor(
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener {
private val TAG = "PassengerMsgBoxBubbleView"
private val dataList :ArrayList<MsgBoxBean> = ArrayList()
private val dataList :ArrayList<MsgBoxCountDownBean> = ArrayList()
private var passengerMsgBoxBubbleAdapter: PassengerMsgBoxBubbleAdapter ?= null
private var isShowData = true
@@ -63,7 +64,8 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor(
MsgBoxConfig.noticeList.add(msgBoxList)
if(isShowData){
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
dataList.add(msgBoxList)
val msgBoxCountDownBean = MsgBoxCountDownBean(msgBoxList)
dataList.add(msgBoxCountDownBean)
passengerMsgBoxBubbleAdapter?.setData(dataList)
}
}

View File

@@ -30,7 +30,7 @@ import com.mogo.eagle.core.widget.RoundCanClickConstraintLayout
*/
class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.Adapter<RecyclerView.ViewHolder>(){
private var data: ArrayList<MsgBoxBean> ?= null
private var data: ArrayList<MsgBoxCountDownBean> ?= null
private val operation: Int = 1
private val operationReturn: Int = 10
@@ -40,10 +40,9 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
private val report: Int = 4
private val summary: Int = 5
var countDownTimer: CountDownTimer?=null
private var changeViewListener: ChangeViewListener?=null
fun setData(data: ArrayList<MsgBoxBean>){
fun setData(data: ArrayList<MsgBoxCountDownBean>){
this.data = data
if(data.size>4){
data.removeAt(0)
@@ -90,9 +89,9 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
when (holder) {
is BubbleOperationHolder -> {
data?.let {
val msgBoxBean = it[position]
val msgBoxBean = it[position].msgBoxBean
val operationMsg = msgBoxBean.bean as OperationMsg
holder.tvBubbleOperationTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvBubbleOperationTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvBubbleOperationContent.text = operationMsg.content
holder.clBubbleOperationLayout.setOnClickListener {
CallerMsgBoxEventListenerManager.invokeBubbleOperationListener(msgBoxBean)
@@ -102,7 +101,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
//运营平台还车通知
is BubbleOperationReturnHolder -> {
data?.let {
val operationReturnMsg = it[position].bean as OperationMsg
val operationReturnMsg = it[position].msgBoxBean.bean as OperationMsg
holder.tvOperationReturnContent.text = operationReturnMsg.content
holder.tvOperationReturnTime.text =
TimeUtils.millis2String(operationReturnMsg.timestamp, getHourMinFormat())
@@ -111,17 +110,17 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
//运营平台靠边停车
is BubbleOperationStopHolder -> {
data?.let {
val operationStopMsg = it[position].bean as OperationMsg
val operationStopMsg = it[position].msgBoxBean.bean as OperationMsg
holder.tvOperationStopTime.text =
TimeUtils.millis2String(operationStopMsg.timestamp, getHourMinFormat())
}
}
is BubbleReportHolder -> {
data?.let {
val msgBoxBean = it[position]
val msgBoxBean = it[position].msgBoxBean
val reportEntity = msgBoxBean.bean as ReportEntity
holder.tvBubbleReportTime.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvBubbleReceiveTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvBubbleReportTime.text = "时间:${TimeUtils.millis2String(it[position].msgBoxBean.timestamp)}"
holder.tvBubbleReceiveTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
var resultStr = "类型:"
for (result in reportEntity.resultList){
resultStr = "${resultStr}${CallerAutoPilotControlManager.getReportResultDesc(result)}"
@@ -134,11 +133,11 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
}
is BubbleNoticeHolder -> {
data?.let {
val msgBoxBean = it[position].bean
val msgBoxBean = it[position].msgBoxBean.bean
val noticeFrCloudMsg = msgBoxBean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
@@ -154,7 +153,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
@@ -173,9 +172,9 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
}
is BubbleV2XHolder -> {
data?.let {
val msgBoxBean = it[position]
val msgBoxBean = it[position].msgBoxBean
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvV2XTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
@@ -186,15 +185,15 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
}
is BubbleSummaryHolder -> {
data?.let {
val summaryMsg = it[position].bean as V2XMsg
holder.tvSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
val summaryMsg = it[position].msgBoxBean.bean as V2XMsg
holder.tvSummaryTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvSummaryContent.text = summaryMsg.content
}
}
}
val msgBoxBean: MsgBoxBean = data!![position]
countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
val msgBoxBean: MsgBoxCountDownBean = data!![position]
msgBoxBean.countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
override fun onTick(p0: Long) {
}
@@ -203,34 +202,32 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
data?.remove(msgBoxBean)
changeViewListener?.notifyView()
notifyDataSetChanged()
// notifyItemRemoved(index)
// notifyItemRangeChanged(index,recordTypeEntity.size-index)
}
}
countDownTimer?.start()
msgBoxBean.countDownTimer?.start()
}
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
return if(data!![position].type == MsgBoxType.OPERATION){
if((data!![position].bean as OperationMsg).type == 0){
return if(data!![position].msgBoxBean.type == MsgBoxType.OPERATION){
if((data!![position].msgBoxBean.bean as OperationMsg).type == 0){
//运营平台还车通知
operationReturn
}else if((data!![position].bean as OperationMsg).type == 1){
}else if((data!![position].msgBoxBean.bean as OperationMsg).type == 1){
//运营平台靠边停车
operationStop
}else{
//普通运营平台
operation
}
}else if(data!![position].type == MsgBoxType.REPORT){
}else if(data!![position].msgBoxBean.type == MsgBoxType.REPORT){
report
}else if(data!![position].type == MsgBoxType.NOTICE){
}else if(data!![position].msgBoxBean.type == MsgBoxType.NOTICE){
notice
}else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){
}else if(data!![position].msgBoxBean.type == MsgBoxType.V2X && data!![position].msgBoxBean.sourceType == DataSourceType.SUMMARY){
summary
} else{
v2x

View File

@@ -17,14 +17,13 @@ import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<RecyclerView.ViewHolder>(){
private var data: ArrayList<MsgBoxBean> ?= null
private var data: ArrayList<MsgBoxCountDownBean> ?= null
private val notice: Int = 1
private val v2x: Int = 2
var countDownTimer: CountDownTimer?=null
fun setData(data: ArrayList<MsgBoxBean>){
fun setData(data: ArrayList<MsgBoxCountDownBean>){
this.data = data
if(data.size>3){
data.removeAt(0)
@@ -49,14 +48,14 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<Re
when (holder) {
is BubbleNoticeHolder -> {
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
val noticeFrCloudMsg = it[position].msgBoxBean.bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvMNoticeContent.text = noticeNormalData?.content
}else {
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvMNoticeContent.text = noticeTrafficStylePushData?.content
}
@@ -65,8 +64,8 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<Re
is BubbleV2XHolder -> {
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvMV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
val v2XMsg = msgBoxBean.msgBoxBean.bean as V2XMsg
holder.tvMV2XTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvMV2XContent.text = v2XMsg.content
holder.ivMV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
@@ -74,8 +73,8 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<Re
}
}
val msgBoxBean: MsgBoxBean = data!![position]
countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
val msgBoxBean: MsgBoxCountDownBean = data!![position]
msgBoxBean.countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
override fun onTick(p0: Long) {
}
@@ -88,13 +87,13 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<Re
}
}
countDownTimer?.start()
msgBoxBean.countDownTimer?.start()
}
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
return if(data!![position].type == MsgBoxType.NOTICE){
return if(data!![position].msgBoxBean.type == MsgBoxType.NOTICE){
notice
}else{
v2x

View File

@@ -23,16 +23,15 @@ import com.mogo.eagle.core.widget.RoundCanClickConstraintLayout
class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var data: ArrayList<MsgBoxBean> ?= null
private var data: ArrayList<MsgBoxCountDownBean> ?= null
private val notice: Int = 1
private val v2x: Int = 2
private val summary: Int = 3
private val operation: Int = 4
var countDownTimer: CountDownTimer?=null
fun setData(data: ArrayList<MsgBoxBean>){
fun setData(data: ArrayList<MsgBoxCountDownBean>){
this.data = data
if(data.size>3){
data.removeAt(0)
@@ -65,10 +64,10 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter
when (holder) {
is BubbleNoticeHolder -> {
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
val noticeFrCloudMsg = it[position].msgBoxBean.bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvMNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).placeholder(R.drawable.icon_passenger_operation)
.optionalTransform(
@@ -83,7 +82,7 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvMNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).placeholder(R.drawable.icon_passenger_operation)
.optionalTransform(
@@ -102,9 +101,9 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter
}
is BubbleV2XHolder -> {
data?.let {
val msgBoxBean = it[position]
val msgBoxBean = it[position].msgBoxBean
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvMV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvMV2XTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvMV2XContent.text = v2XMsg.content
holder.ivMV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
@@ -115,8 +114,8 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter
}
is BubbleSummaryHolder -> {
data?.let {
val summaryMsg= it[position].bean as V2XMsg
holder.tvMSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
val summaryMsg= it[position].msgBoxBean.bean as V2XMsg
holder.tvMSummaryTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvMSummaryContent.text = summaryMsg.content
holder.tvMSummaryCheck.setOnClickListener {
//跳转全览模式
@@ -127,15 +126,15 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter
}
is BubbleOperationHolder ->{
data?.let {
val operationMsg = it[position].bean as OperationMsg
holder.tvMOperationTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
val operationMsg = it[position].msgBoxBean.bean as OperationMsg
holder.tvMOperationTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvMOperationContent.text = operationMsg.content
}
}
}
val msgBoxBean: MsgBoxBean = data!![position]
countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
val msgBoxBean: MsgBoxCountDownBean = data!![position]
msgBoxBean.countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
override fun onTick(p0: Long) {
}
@@ -148,17 +147,17 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter
}
}
countDownTimer?.start()
msgBoxBean.countDownTimer?.start()
}
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
return if(data!![position].type == MsgBoxType.NOTICE){
return if(data!![position].msgBoxBean.type == MsgBoxType.NOTICE){
notice
}else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){
}else if(data!![position].msgBoxBean.type == MsgBoxType.V2X && data!![position].msgBoxBean.sourceType == DataSourceType.SUMMARY){
summary
}else if(data!![position].type == MsgBoxType.OPERATION){
}else if(data!![position].msgBoxBean.type == MsgBoxType.OPERATION){
operation
} else{
v2x

View File

@@ -28,15 +28,13 @@ import com.mogo.eagle.core.widget.RoundCanClickConstraintLayout
*/
class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var data: ArrayList<MsgBoxBean> ?= null
private var data: ArrayList<MsgBoxCountDownBean> ?= null
private val notice: Int = 1
private val v2x: Int = 2
private val summary: Int = 3
var countDownTimer: CountDownTimer?=null
fun setData(data: ArrayList<MsgBoxBean>){
fun setData(data: ArrayList<MsgBoxCountDownBean>){
this.data = data
if(data.size>3){
data.removeAt(0)
@@ -65,10 +63,10 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
when (holder) {
is BubbleNoticeHolder -> {
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
val noticeFrCloudMsg = it[position].msgBoxBean.bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
@@ -82,7 +80,7 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
@@ -100,9 +98,9 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
}
is BubbleV2XHolder -> {
data?.let {
val msgBoxBean = it[position]
val msgBoxBean = it[position].msgBoxBean
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvPassengerV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerV2XTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvPassengerV2XContent.text = v2XMsg.content
holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
@@ -113,8 +111,8 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
}
is BubbleSummaryHolder -> {
data?.let {
val summaryMsg= it[position].bean as V2XMsg
holder.tvPassengerSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
val summaryMsg= it[position].msgBoxBean.bean as V2XMsg
holder.tvPassengerSummaryTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvPassengerSummaryContent.text = summaryMsg.content
holder.tvPassengerSummaryCheck.setOnClickListener {
//跳转全览模式
@@ -125,8 +123,8 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
}
}
val msgBoxBean: MsgBoxBean = data!![position]
countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
val msgBoxBean: MsgBoxCountDownBean = data!![position]
msgBoxBean.countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
override fun onTick(p0: Long) {
}
@@ -139,15 +137,15 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
}
}
countDownTimer?.start()
msgBoxBean.countDownTimer?.start()
}
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
return if(data!![position].type == MsgBoxType.NOTICE){
return if(data!![position].msgBoxBean.type == MsgBoxType.NOTICE){
notice
}else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){
}else if(data!![position].msgBoxBean.type == MsgBoxType.V2X && data!![position].msgBoxBean.sourceType == DataSourceType.SUMMARY){
summary
} else{
v2x

View File

@@ -14,12 +14,17 @@ import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.deva.bindingcar.IPCUpgradeStateInfo
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.OperationMsg
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.data.temp.EventLogout
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
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.CallerAutopilotCarConfigListenerManager
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.utils.KeyBoardUtil
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
@@ -96,10 +101,25 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
clickListener?.onClose(it)
}
rlKillLayout.setOnClickListener {
killApp()
// killApp()
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
"1","测试V2X",""
)
)
)
}
sopLayout.setOnClickListener {
clickListener?.showSOPSettingView()
// clickListener?.showSOPSettingView()
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.OPERATION,
OperationMsg(System.currentTimeMillis(),"本次行程剩余5分钟请知晓并通知乘客合理安排游玩时间")
)
)
}
managerLayout.setOnClickListener {
//录包管理页面

View File

@@ -0,0 +1,7 @@
package com.mogo.eagle.core.data.msgbox
import android.os.CountDownTimer
class MsgBoxCountDownBean(val msgBoxBean: MsgBoxBean){
var countDownTimer: CountDownTimer ?= null
}