Merge branch 'dev_robotaxi-d_240912_6.7.0' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_robotaxi-d_240912_6.7.0

This commit is contained in:
aibingbing
2024-09-27 18:36:49 +08:00
21 changed files with 558 additions and 558 deletions

View File

@@ -173,6 +173,9 @@ object LoginModel {
mContext?.let {
queryDriverServiceStatus(it, object : OchCommonServiceCallback<DriverStatusQueryRespBean> {
override fun onSuccess(data: DriverStatusQueryRespBean?) {
if(FunctionBuildConfig.ochdebug){
return
}
if (null != data && 0 == data.code) {
// 不用登录也可以获得支持的业务模式
LoginStatusManager.setBusinessType(data.data.businessType)

View File

@@ -145,6 +145,9 @@ object OchCommonServiceManager {
CallerLogger.d(TAG, "queryDriverServiceStatus:查询登录状态 没有有效的sn");
return
}
if(FunctionBuildConfig.ochdebug){
return
}
if (ProjectUtils.isMogo()) {
ochLoginServiceMogo.queryDriverServiceStatusAndLoginStatus(
MoGoAiCloudClientConfig.getInstance().serviceAppId,

View File

@@ -18,7 +18,7 @@ class FRetryWithTime<T : BaseData> : Function<T, ObservableSource<T>> {
MoGoAiCloudClient.getInstance().refreshToken()
return Observable.error(OchCommonRetryException())
}else if(it.code == 1003){
if(!FunctionBuildConfig.isOffLine){
if(!FunctionBuildConfig.isOffLine&&!FunctionBuildConfig.ochdebug){
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
LoginStatusManager.setLoginStatus(LoginStatusEnum.Logout)
}

View File

@@ -231,7 +231,7 @@ abstract class FacadeProvider : IMoGoFunctionProvider, ILoginCallback {
removeStatusBar()
} else {
onBusinessChange(businessEnum)
FunctionBuildConfig.isOffLine = true
FunctionBuildConfig.ochdebug = true
LoginStatusManager.setLoginStatus(LoginStatusEnum.Login)
val supportFragmentManager: FragmentManager? = activity?.supportFragmentManager
val fragment = getFragment()

View File

@@ -20,9 +20,11 @@ import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.deva.report.CategoryInfo
import com.mogo.eagle.core.data.deva.report.PadAddProblemReq
import com.mogo.eagle.core.data.deva.report.PadProblemInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoTakeoverListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerTakeoverListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.hmi.R
@@ -49,7 +51,8 @@ class ReportTypeView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoDevaToolsListener {
) : ConstraintLayout(context, attrs, defStyleAttr),
IMoGoDevaToolsListener, IMoGoTakeoverListener {
private val TAG = "ReportTypeView"
@@ -79,6 +82,7 @@ class ReportTypeView @JvmOverloads constructor(
private fun initView(){
CallerDevaToolsListenerManager.addListener(TAG, this)
CallerTakeoverListenerManager.addListener(TAG,this)
if(isOneClickType){
showOneCLickReportView()
}else{
@@ -264,4 +268,13 @@ class ReportTypeView @JvmOverloads constructor(
this.clickListener = clickListener
}
/**
* 人工接管
*/
override fun onTakeoverState(state: Int) {
ThreadUtils.runOnUiThread {
showOneCLickReportView()
}
}
}

View File

@@ -9,7 +9,10 @@ import android.os.Bundle
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.view.animation.AccelerateDecelerateInterpolator
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.marginStart
import androidx.core.view.marginTop
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
@@ -31,6 +34,14 @@ class MapContainerLayout @JvmOverloads constructor(
@Volatile
private var isScaled = false
private var isPlayingAnim = false
private var mapMinWidth = 0
private var mapMinHeight = 0
private var mapMaxWidth = 0
private var mapMaxHeight = 0
private var maxMarginStart = 0
private var maxMarginTop = 0
private var valueAnimator: ValueAnimator? = null
init {
LayoutInflater.from(context).inflate(R.layout.view_map_container, this, true)
@@ -69,15 +80,37 @@ class MapContainerLayout @JvmOverloads constructor(
overMapView.onDestroy()
}
override fun onWindowFocusChanged(hasWindowFocus: Boolean) {
super.onWindowFocusChanged(hasWindowFocus)
if (hasWindowFocus) {
if (mapMaxWidth == 0 && maxMarginStart == 0) {
calculate()
}
}
}
private fun calculate() {
mapMaxWidth = width
mapMaxHeight = height
mapMinWidth = overMapView.width
mapMinHeight = overMapView.height
maxMarginStart = overMapView.marginStart
maxMarginTop = overMapView.marginTop
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
MogoMapListenerHandler.mogoMapListenerHandler.registerHostMapListener("${TAG}${this.hashCode()}",this)
MogoMapListenerHandler.mogoMapListenerHandler.registerHostMapListener(
"${TAG}${this.hashCode()}",
this
)
CallerOrderListenerManager.addListener("${TAG}${this.hashCode()}", this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
MogoMapListenerHandler.mogoMapListenerHandler.unregisterHostMapListener("${TAG}${this.hashCode()}")
valueAnimator?.removeAllListeners()
}
private fun initView() {
@@ -103,38 +136,45 @@ class MapContainerLayout @JvmOverloads constructor(
private fun scaleMapWithAnim() {
if (isPlayingAnim) return
if (mapMaxWidth == 0 && maxMarginStart == 0 && !isScaled) {
calculate()
}
if (!isScaled) {
val valueAnimator = ValueAnimator.ofInt(270, 1560)
valueAnimator = ValueAnimator.ofInt(mapMinWidth, mapMaxWidth)
val evaluator = IntEvaluator()
valueAnimator.addUpdateListener {
overMapView.layoutParams = (overMapView.layoutParams as LayoutParams).also { layoutParams ->
layoutParams.width = it.animatedValue as Int
layoutParams.height = evaluator.evaluate(it.animatedFraction, 270, 1534)
layoutParams.leftMargin = evaluator.evaluate(it.animatedFraction, 1230, 0)
layoutParams.topMargin = evaluator.evaluate(it.animatedFraction, 1204, 0)
}
valueAnimator?.addUpdateListener {
overMapView.layoutParams =
(overMapView.layoutParams as LayoutParams).also { layoutParams ->
layoutParams.width = it.animatedValue as Int
layoutParams.height = evaluator.evaluate(it.animatedFraction, mapMinHeight, mapMaxHeight)
layoutParams.leftMargin = evaluator.evaluate(it.animatedFraction, maxMarginStart, 0)
layoutParams.topMargin = evaluator.evaluate(it.animatedFraction, maxMarginTop, 0)
}
}
valueAnimator.addListener(listenerAdapter)
valueAnimator.duration = 350
valueAnimator.start()
valueAnimator?.interpolator = AccelerateDecelerateInterpolator()
valueAnimator?.addListener(listenerAdapter)
valueAnimator?.duration = 400
valueAnimator?.start()
} else {
val valueAnimator = ValueAnimator.ofInt(1560, 270)
valueAnimator = ValueAnimator.ofInt(mapMaxWidth, mapMinWidth)
val evaluator = IntEvaluator()
valueAnimator.addUpdateListener {
overMapView.layoutParams = (overMapView.layoutParams as LayoutParams).also { layoutParams ->
layoutParams.width = it.animatedValue as Int
layoutParams.height = evaluator.evaluate(it.animatedFraction, 1534, 270)
layoutParams.leftMargin = evaluator.evaluate(it.animatedFraction, 0, 1230)
layoutParams.topMargin = evaluator.evaluate(it.animatedFraction, 0, 1204)
}
valueAnimator?.addUpdateListener {
overMapView.layoutParams =
(overMapView.layoutParams as LayoutParams).also { layoutParams ->
layoutParams.width = it.animatedValue as Int
layoutParams.height = evaluator.evaluate(it.animatedFraction, mapMaxHeight, mapMinHeight)
layoutParams.leftMargin = evaluator.evaluate(it.animatedFraction, 0, maxMarginStart)
layoutParams.topMargin = evaluator.evaluate(it.animatedFraction, 0, maxMarginTop)
}
}
valueAnimator.addListener(listenerAdapter)
valueAnimator.duration = 350
valueAnimator.start()
valueAnimator?.interpolator = AccelerateDecelerateInterpolator()
valueAnimator?.addListener(listenerAdapter)
valueAnimator?.duration = 400
valueAnimator?.start()
}
}
private val listenerAdapter = object : AnimatorListenerAdapter() {
private val listenerAdapter = object : AnimatorListenerAdapter() {
override fun onAnimationStart(animation: Animator) {
super.onAnimationStart(animation)
isPlayingAnim = true
@@ -150,7 +190,8 @@ class MapContainerLayout @JvmOverloads constructor(
if (isScaled) {
visualAngleToggle?.takeIf { it.visibility == View.VISIBLE }?.visibility = View.GONE
} else {
visualAngleToggle?.takeIf { it.visibility != View.VISIBLE }?.visibility = View.VISIBLE
visualAngleToggle?.takeIf { it.visibility != View.VISIBLE }?.visibility =
View.VISIBLE
}
}
@@ -163,7 +204,8 @@ class MapContainerLayout @JvmOverloads constructor(
if (isScaled) {
visualAngleToggle?.takeIf { it.visibility == View.VISIBLE }?.visibility = View.GONE
} else {
visualAngleToggle?.takeIf { it.visibility != View.VISIBLE }?.visibility = View.VISIBLE
visualAngleToggle?.takeIf { it.visibility != View.VISIBLE }?.visibility =
View.VISIBLE
}
}
}

View File

@@ -16,29 +16,25 @@ 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.data.msgbox.MsgFmData
import com.mogo.eagle.core.function.api.autopilot.IMoGoNodeStateListener
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.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerNodeStateListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
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.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.MsgBoxBubbleAdapter
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.MsgBoxToastAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
import com.mogo.eagle.core.utilcode.util.SoundPoolUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.zhjt.mogo.adas.data.bean.NodeStateInfo
import kotlinx.android.synthetic.main.layout_driver_msg_box_bubble.view.clMsgBubbleLayout
import kotlinx.android.synthetic.main.layout_msg_box_bubble.view.llMsgBubbleLayout
import kotlinx.android.synthetic.main.layout_msg_box_bubble.view.rvBubbleList
/**
* 司机端消息盒子气泡视图改版视图
*/
class MsgBoxBubbleView @JvmOverloads constructor(
class MsgBoxToastView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
@@ -49,7 +45,7 @@ class MsgBoxBubbleView @JvmOverloads constructor(
initView()
}
var msgBoxBubbleAdapter: MsgBoxBubbleAdapter ?= null
var msgBoxToastAdapter: MsgBoxToastAdapter ?= null
private val TAG = "MsgBoxBubbleView"
private val dataList :ArrayList<MsgBoxCountDownBean> = ArrayList()
@@ -62,8 +58,8 @@ class MsgBoxBubbleView @JvmOverloads constructor(
linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
linearLayoutManager.stackFromEnd = true
linearLayoutManager.reverseLayout = true
msgBoxBubbleAdapter = MsgBoxBubbleAdapter(context as Activity)
msgBoxBubbleAdapter?.setChangeListener(object : MsgBoxBubbleAdapter.ChangeViewListener{
msgBoxToastAdapter = MsgBoxToastAdapter(context as Activity)
msgBoxToastAdapter?.setChangeListener(object : MsgBoxToastAdapter.ChangeViewListener{
override fun notifyView() {
if(dataList.isEmpty()){
llMsgBubbleLayout.visibility = View.GONE
@@ -71,7 +67,7 @@ class MsgBoxBubbleView @JvmOverloads constructor(
}
})
rvBubbleList.adapter = msgBoxBubbleAdapter
rvBubbleList.adapter = msgBoxToastAdapter
rvBubbleList.layoutManager = linearLayoutManager
}
@@ -200,7 +196,7 @@ class MsgBoxBubbleView @JvmOverloads constructor(
llMsgBubbleLayout.visibility = View.VISIBLE
val msgBoxCountDownBean = MsgBoxCountDownBean(msgBoxBean)
dataList.add(msgBoxCountDownBean)
msgBoxBubbleAdapter?.setData(dataList)
msgBoxToastAdapter?.setData(dataList)
}
}

View File

@@ -1,484 +0,0 @@
package com.mogo.eagle.core.function.hmi.ui.msgbox.adapter
import android.app.Activity
import android.os.CountDownTimer
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.res.ResourcesCompat
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.deva.report.ReportEntity
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.AutopilotMsg
import com.mogo.eagle.core.data.msgbox.FMInfoMsg
import com.mogo.eagle.core.data.msgbox.FSMMsg
import com.mogo.eagle.core.data.msgbox.MsgBoxCountDownBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgFmData
import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg
import com.mogo.eagle.core.data.msgbox.OperationMsg
import com.mogo.eagle.core.data.msgbox.SSMMsg
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
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.ResourceUtils.getDrawable
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
import com.mogo.eagle.core.widget.RoundCanClickConstraintLayout
class MsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var data: ArrayList<MsgBoxCountDownBean> ?= null
private var changeViewListener: ChangeViewListener?=null
private val operation: Int = 1
private val operationReturn: Int = 10
private val operationStop: Int = 11
private val operationDoorSwitchFail: Int = 13 //车门开启、关闭失败
private val notice: Int = 2
private val v2x: Int = 3
private val report: Int = 4
private val summary: Int = 5
private val fm: Int = 6
private val ssm: Int = 7
private val autopilot: Int = 8
private val fsm: Int = 9
private val none: Int = 10
fun setData(data: ArrayList<MsgBoxCountDownBean>){
this.data = data
if(data.size>4){
data.removeAt(0)
}
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
when (viewType) {
operation -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_operation,parent,false)
return BubbleOperationHolder(view)
}
operationReturn -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_bubble_operation_return, parent, false)
return BubbleOperationReturnHolder(view)
}
operationStop -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_bubble_operation_stop, parent, false)
return BubbleOperationStopHolder(view)
}
operationDoorSwitchFail ->{
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_bubble_operation_door, parent, false)
return BubbleOperationDoorFailHolder(view)
}
report -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_report,parent,false)
return BubbleReportHolder(view)
}
notice -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_notice,parent,false)
return BubbleNoticeHolder(view)
}
summary -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_summary,parent,false)
return BubbleSummaryHolder(view)
}
fm -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_fm,parent,false)
return BubbleFmHolder(view)
}
ssm -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_ssm,parent,false)
return BubbleSsmHolder(view)
}
autopilot -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_autopilot,parent,false)
return BubbleAutopilotHolder(view)
}
fsm -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_fsm,parent,false)
return BubbleFSMHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_v2x,parent,false)
return BubbleV2XHolder(view)
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) {
is BubbleOperationHolder -> {
data?.let {
val msgBoxBean = it[position].msgBoxBean
val operationMsg = msgBoxBean.bean as OperationMsg
holder.tvBubbleOperationTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvBubbleOperationContent.text = operationMsg.content
holder.clBubbleOperationLayout.setOnClickListener {
CallerMsgBoxEventListenerManager.invokeBubbleOperationListener(msgBoxBean)
}
}
}
//运营平台还车通知
is BubbleOperationReturnHolder -> {
data?.let {
val operationReturnMsg = it[position].msgBoxBean.bean as OperationMsg
holder.tvOperationReturnContent.text = operationReturnMsg.content
holder.tvOperationReturnTime.text =
TimeUtils.millis2String(operationReturnMsg.timestamp, getHourMinFormat())
}
}
//运营平台靠边停车
is BubbleOperationStopHolder -> {
data?.let {
val operationStopMsg = it[position].msgBoxBean.bean as OperationMsg
holder.tvOperationStopTime.text =
TimeUtils.millis2String(operationStopMsg.timestamp, getHourMinFormat())
holder.tvOperationStopContent.text = operationStopMsg.content
}
}
//车门开启关闭失败
is BubbleOperationDoorFailHolder -> {
data?.let{
val operationDoorMsg = it[position].msgBoxBean.bean as OperationMsg
holder.tvOperationDoorTime.text =
TimeUtils.millis2String(operationDoorMsg.timestamp, getHourMinFormat())
holder.tvOperationDoorContent.text = operationDoorMsg.content
}
}
//系统信息消息
is BubbleReportHolder -> {
data?.let {
val msgBoxBean = it[position].msgBoxBean
val reportEntity = msgBoxBean.bean as ReportEntity
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)}"
}
holder.tvBubbleReportType.text = resultStr
holder.clReportLayout.setOnClickListener {
CallerMsgBoxEventListenerManager.invokeBubbleReportListener(msgBoxBean)
}
}
}
//云公告消息
is BubbleNoticeHolder -> {
data?.let {
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].msgBoxBean.timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeNormalData != null) {
CallerHmiManager.showNoticeNormalData(noticeNormalData)
}
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeTrafficStylePushData != null) {
CallerHmiManager.showTrafficBanner(noticeTrafficStylePushData)
}
}
}
}
}
//V2X消息
is BubbleV2XHolder -> {
data?.let {
val msgBoxBean = it[position].msgBoxBean
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
holder.ivV2XImage.setImageDrawable(ResourcesCompat.getDrawable(activity.resources,EventTypeEnumNew.getUpdateIconRes(v2XMsg.type),null))
holder.clV2XLayout.setOnClickListener {
CallerMsgBoxEventListenerManager.invokeBubbleV2XListener(msgBoxBean)
}
if(v2XMsg.type== EventTypeEnumNew.TYPE_VERIFICATION_SUCCESSFUL.poiType||v2XMsg.type == EventTypeEnumNew.TYPE_DEVICE_STATUS_NORMAL.poiType){
holder.itemView.setBackgroundResource(R.drawable.bg_temp_v2x_success)
}else{
holder.itemView.setBackgroundResource(R.drawable.bg_msg_box_v2x)
}
if(v2XMsg.communicationType.isNullOrEmpty()){
holder.tvV2XTitle.text = EventTypeEnumNew.getEventTitle(v2XMsg.type)
}else{
holder.tvV2XTitle.text = String.format(activity.resources.getString(R.string.v2x_title_content),
v2XMsg.communicationType, EventTypeEnumNew.getEventTitle(v2XMsg.type))
}
}
}
//汇总消息
is BubbleSummaryHolder -> {
data?.let {
val summaryMsg = it[position].msgBoxBean.bean as V2XMsg
holder.tvSummaryTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvSummaryContent.text = summaryMsg.content
}
}
//FM信息
is BubbleFmHolder ->{
data?.let {
val fmMsg = it[position].msgBoxBean.bean as FMInfoMsg
if(fmMsg.policyTime == null){
holder.tvBubbleFmTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
}else{
holder.tvBubbleFmTime.text = TimeUtils.millis2String(fmMsg.policyTime!!,getHourMinFormat())
}
if(fmMsg.fmInfoList?.size == 0){
holder.tvBubbleFmFaultAction.text = "建议操作:暂无"
holder.tvBubbleFmFault.text = MsgFmData.getFmPolicyName(fmMsg.policyCode)
}else{
var curFaultLevel = 5 //默认级别遍历数组找出级别最高的level数越小级别越高
fmMsg.fmInfoList?.forEach { faultInfo ->
if(faultInfo.faultActionCount>0){
faultInfo.faultActionList.forEach {actionCode ->
//获取建议操作级别,得到建议操作级别最高的操作
if(MsgFmData.FaultAction.getFaultLevel(actionCode) < curFaultLevel){
curFaultLevel = MsgFmData.FaultAction.getFaultLevel(actionCode)
}
}
}
}
val faultAction = MsgFmData.FaultAction.getFaultAction(curFaultLevel)
holder.tvBubbleFmFault.text = faultAction
//当出现多个建议操作时,按照整车下电重启、请求人工驾驶接管、请求平行驾驶接管、系统重启、联系硬件工程师、
// 联系运维工程师、联系软件工程师优先级递减的顺序,只展示最高优先级的内容
if(curFaultLevel == 5){
holder.tvBubbleFmFaultAction.text = "建议操作:暂无"
}else{
holder.tvBubbleFmFaultAction.text = "${faultAction}(${MsgFmData.FaultAction.getFaultActionCode(curFaultLevel)})"
}
//不同级别的Icon显示
when(curFaultLevel){
0->{
//重度预警样式
holder.ivBubbleFmImage.setImageDrawable(getDrawable(R.drawable.icon_fm_stop_normal))
}
1,2,3->{
//中度预警样式
holder.ivBubbleFmImage.setImageDrawable(getDrawable(R.drawable.icon_fm_reduce_normal))
}
4,5->{
//轻度预警样式
holder.ivBubbleFmImage.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_normal))
}
}
}
}
}
//SSM连接消息
is BubbleSsmHolder ->{
data?.let {
val ssmMsg = it[position].msgBoxBean.bean as SSMMsg
holder.tvSsmTitle.text = ssmMsg.title
holder.tvSsmContent.text= ssmMsg.content
holder.tvSsmTime.text = TimeUtils.millis2String(ssmMsg.timestamp,getHourMinFormat())
}
}
//域控制器连接消息
is BubbleAutopilotHolder ->{
data?.let {
val autopilotMsg = it[position].msgBoxBean.bean as AutopilotMsg
holder.tvAutopilotTitle.text = autopilotMsg.title
holder.tvAutopilotContent.text = autopilotMsg.content
holder.tvAutopilotTime.text = TimeUtils.millis2String(autopilotMsg.timestamp,getHourMinFormat())
}
}
//FSM消息
is BubbleFSMHolder ->{
data?.let {
val fsmMsg = it[position].msgBoxBean.bean as FSMMsg
holder.tvFSMTitle.text = fsmMsg.title
holder.tvFSMContent.text = fsmMsg.content
holder.tvFSMTime.text = TimeUtils.millis2String(fsmMsg.timestamp,getHourMinFormat())
}
}
}
val msgBoxBean: MsgBoxCountDownBean = data!![position]
msgBoxBean.countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
override fun onTick(p0: Long) {
}
override fun onFinish() {
data?.remove(msgBoxBean)
changeViewListener?.notifyView()
notifyDataSetChanged()
}
}
msgBoxBean.countDownTimer?.start()
}
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
return if(data!![position].msgBoxBean.type == MsgBoxType.OPERATION){
when ((data!![position].msgBoxBean.bean as OperationMsg).type) {
0 -> {
//运营平台还车通知
operationReturn
}
1 -> {
//运营平台靠边停车
operationStop
}
3 -> {
//车门开启关闭失败
operationDoorSwitchFail
}
else -> {
//普通运营平台
operation
}
}
}else if(data!![position].msgBoxBean.type == MsgBoxType.REPORT){
report
}else if(data!![position].msgBoxBean.type == MsgBoxType.NOTICE){
notice
}else if(data!![position].msgBoxBean.type == MsgBoxType.V2X && data!![position].msgBoxBean.sourceType == DataSourceType.SUMMARY){
summary
}else if(data!![position].msgBoxBean.type == MsgBoxType.FMINFO){
fm
}else if(data!![position].msgBoxBean.type == MsgBoxType.SSMINFO){
ssm
}else if(data!![position].msgBoxBean.type == MsgBoxType.AUTOPILOT){
autopilot
}else if(data!![position].msgBoxBean.type == MsgBoxType.FSM){
fsm
} else {
v2x
}
}
fun setChangeListener(listener: ChangeViewListener){
changeViewListener = listener
}
interface ChangeViewListener{
fun notifyView()
}
//车辆系统信息
class BubbleReportHolder(itemView: View): RecyclerView.ViewHolder(itemView){
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)
}
//运营平台还车通知
class BubbleOperationReturnHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvOperationReturnTime: TextView = itemView.findViewById(R.id.tvOperationReturnTime)
var tvOperationReturnContent: TextView = itemView.findViewById(R.id.tvOperationReturnContent)
}
//运营平台靠边停车通知
class BubbleOperationStopHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvOperationStopTime: TextView = itemView.findViewById(R.id.tvOperationStopTime)
var tvOperationStopContent: TextView = itemView.findViewById(R.id.tvOperationStopContent)
}
//车门开启关闭失败
class BubbleOperationDoorFailHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvOperationDoorTime: TextView = itemView.findViewById(R.id.tvOperationDoorTime)
var tvOperationDoorContent: TextView = itemView.findViewById(R.id.tvOperationDoorContent)
}
//Notice
class BubbleNoticeHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var ivNoticeImage: ImageView = itemView.findViewById(R.id.ivNoticeImage)
// var tvNoticeTitle: TextView = itemView.findViewById(R.id.tvNoticeTitle)
var tvNoticeTime: TextView = itemView.findViewById(R.id.tvNoticeTime)
var tvNoticeCheck: TextView = itemView.findViewById(R.id.tvNoticeCheck)
var tvNoticeContent: TextView = itemView.findViewById(R.id.tvNoticeContent)
}
//V2X
class BubbleV2XHolder(itemView: View): RecyclerView.ViewHolder(itemView){
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: ConstraintLayout = itemView.findViewById(R.id.clV2XLayout)
var tvV2XTitle: TextView = itemView.findViewById(R.id.tvV2XTitle)
}
//汇总消息
class BubbleSummaryHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvSummaryContent: TextView = itemView.findViewById(R.id.tvSummaryContent)
var tvSummaryTime: TextView = itemView.findViewById(R.id.tvSummaryTime)
}
//FM消息
class BubbleFmHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvBubbleFmFault: TextView = itemView.findViewById(R.id.tvBubbleFmFault)
var tvBubbleFmFaultAction: TextView = itemView.findViewById(R.id.tvBubbleFmFaultAction)
var tvBubbleFmTime: TextView = itemView.findViewById(R.id.tvBubbleFmTime)
var ivBubbleFmImage: ImageView = itemView.findViewById(R.id.ivBubbleFmImage)
}
//SSM连接消息
class BubbleSsmHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var ivSsmImage: ImageView = itemView.findViewById(R.id.ivSsmImage)
var tvSsmTitle: TextView = itemView.findViewById(R.id.tvSsmTitle)
var tvSsmTime: TextView = itemView.findViewById(R.id.tvSsmTime)
var tvSsmContent: TextView = itemView.findViewById(R.id.tvSsmContent)
}
//域控制器连接状态消息
class BubbleAutopilotHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var ivAutopilotImage: ImageView = itemView.findViewById(R.id.ivAutopilotImage)
var tvAutopilotTitle: TextView = itemView.findViewById(R.id.tvAutopilotTitle)
var tvAutopilotTime: TextView = itemView.findViewById(R.id.tvAutopilotTime)
var tvAutopilotContent: TextView = itemView.findViewById(R.id.tvAutopilotContent)
}
//FSM状态消息(现阶段提示启动自驾失败消息过渡阶段提示未来展示fsm消息提醒)
class BubbleFSMHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var ivFSMImage: ImageView = itemView.findViewById(R.id.ivFSMImage)
var tvFSMTitle: TextView = itemView.findViewById(R.id.tvFSMTitle)
var tvFSMTime: TextView = itemView.findViewById(R.id.tvFSMTime)
var tvFSMContent: TextView = itemView.findViewById(R.id.tvFSMContent)
}
}

View File

@@ -0,0 +1,346 @@
package com.mogo.eagle.core.function.hmi.ui.msgbox.adapter
import android.app.Activity
import android.os.CountDownTimer
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.deva.report.ReportEntity
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.AutopilotMsg
import com.mogo.eagle.core.data.msgbox.FMInfoMsg
import com.mogo.eagle.core.data.msgbox.FSMMsg
import com.mogo.eagle.core.data.msgbox.MsgBoxCountDownBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgFmData
import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg
import com.mogo.eagle.core.data.msgbox.OperationMsg
import com.mogo.eagle.core.data.msgbox.SSMMsg
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
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.ResourceUtils.getDrawable
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
import com.mogo.eagle.core.widget.RoundCanClickConstraintLayout
class MsgBoxToastAdapter(private val activity: Activity) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var data: ArrayList<MsgBoxCountDownBean> ?= null
private var changeViewListener: ChangeViewListener?=null
private val notice: Int = 1
private val v2x: Int = 2
private val report: Int = 3
fun setData(data: ArrayList<MsgBoxCountDownBean>){
this.data = data
if(data.size>4){
data.removeAt(0)
}
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return when (viewType) {
report -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_report,parent,false)
BubbleReportHolder(view)
}
notice -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_notice,parent,false)
BubbleNoticeHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_toast_v2x,parent,false)
BubbleV2XHolder(view)
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) {
//系统信息消息
is BubbleReportHolder -> {
data?.let {
val msgBoxBean = it[position].msgBoxBean
val reportEntity = msgBoxBean.bean as ReportEntity
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)}"
}
holder.tvBubbleReportType.text = resultStr
holder.clReportLayout.setOnClickListener {
CallerMsgBoxEventListenerManager.invokeBubbleReportListener(msgBoxBean)
}
}
}
//云公告消息
is BubbleNoticeHolder -> {
data?.let {
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].msgBoxBean.timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeNormalData != null) {
CallerHmiManager.showNoticeNormalData(noticeNormalData)
}
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeTrafficStylePushData != null) {
CallerHmiManager.showTrafficBanner(noticeTrafficStylePushData)
}
}
}
}
}
//V2X消息
is BubbleV2XHolder -> {
data?.let {
if(it[position].msgBoxBean.type == MsgBoxType.FSM){
//FSM消息
val fsmMsg = it[position].msgBoxBean.bean as FSMMsg
holder.tvV2XTitle.text = fsmMsg.title
holder.tvV2XContent.text = fsmMsg.content
holder.ivV2XImage.setImageDrawable(
ContextCompat.getDrawable(
activity,
R.drawable.icon_warning_take_over
))
}else if(it[position].msgBoxBean.type == MsgBoxType.AUTOPILOT){
//域控制器连接消息
val autopilotMsg = it[position].msgBoxBean.bean as AutopilotMsg
holder.tvV2XTitle.text = autopilotMsg.title
holder.tvV2XContent.text = autopilotMsg.content
holder.ivV2XImage.setImageDrawable(
ContextCompat.getDrawable(
activity,
R.drawable.icon_warning_take_over
))
}else if(it[position].msgBoxBean.type == MsgBoxType.SSMINFO){
//SSM连接消息
val ssmMsg = it[position].msgBoxBean.bean as SSMMsg
holder.tvV2XTitle.text = ssmMsg.title
holder.tvV2XContent.text = ssmMsg.content
holder.ivV2XImage.setImageDrawable(
ContextCompat.getDrawable(
activity,
R.drawable.icon_warning_take_over
))
}else if(it[position].msgBoxBean.type == MsgBoxType.FMINFO){
//FM信息
val fmMsg = it[position].msgBoxBean.bean as FMInfoMsg
if(fmMsg.fmInfoList?.size == 0){
holder.tvV2XContent.text = "建议操作:暂无"
holder.tvV2XTitle.text = MsgFmData.getFmPolicyName(fmMsg.policyCode)
}else{
var curFaultLevel = 5 //默认级别遍历数组找出级别最高的level数越小级别越高
fmMsg.fmInfoList?.forEach { faultInfo ->
if(faultInfo.faultActionCount>0){
faultInfo.faultActionList.forEach {actionCode ->
//获取建议操作级别,得到建议操作级别最高的操作
if(MsgFmData.FaultAction.getFaultLevel(actionCode) < curFaultLevel){
curFaultLevel = MsgFmData.FaultAction.getFaultLevel(actionCode)
}
}
}
}
val faultAction = MsgFmData.FaultAction.getFaultAction(curFaultLevel)
holder.tvV2XTitle.text = faultAction
//当出现多个建议操作时,按照整车下电重启、请求人工驾驶接管、请求平行驾驶接管、系统重启、联系硬件工程师、
// 联系运维工程师、联系软件工程师优先级递减的顺序,只展示最高优先级的内容
if(curFaultLevel == 5){
holder.tvV2XContent.text = "建议操作:暂无"
}else{
holder.tvV2XContent.text = "${faultAction}(${MsgFmData.FaultAction.getFaultActionCode(curFaultLevel)})"
}
//不同级别的Icon显示
when(curFaultLevel){
0->{
//重度预警样式
holder.ivV2XImage.setImageDrawable(getDrawable(R.drawable.icon_fm_stop_normal))
}
1,2,3->{
//中度预警样式
holder.ivV2XImage.setImageDrawable(getDrawable(R.drawable.icon_fm_reduce_normal))
}
4,5->{
//轻度预警样式
holder.ivV2XImage.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_normal))
}
}
}
}else if(it[position].msgBoxBean.type == MsgBoxType.V2X && it[position].msgBoxBean.sourceType == DataSourceType.SUMMARY){
//汇总消息
val summaryMsg = it[position].msgBoxBean.bean as V2XMsg
holder.tvV2XTitle.text = "蘑菇小助手"
holder.tvV2XContent.text = summaryMsg.content
holder.ivV2XImage.setImageDrawable(
ContextCompat.getDrawable(
activity,
R.drawable.icon_tab_notice
))
}else if(it[position].msgBoxBean.type == MsgBoxType.OPERATION){
//运营平台
val operationMsg = it[position].msgBoxBean.bean as OperationMsg
holder.tvV2XContent.text = operationMsg.content
when(operationMsg.type){
0->{
//运营平台还车通知
holder.tvV2XTitle.text = "还车通知"
holder.ivV2XImage.setImageDrawable(
ContextCompat.getDrawable(
activity,
R.drawable.icon_msg_box_operation_return
))
}
1->{
//运营平台靠边停车
holder.tvV2XTitle.text = "运营平台"
holder.ivV2XImage.setImageDrawable(
ContextCompat.getDrawable(
activity,
R.drawable.icon_msg_box_operation_stop
))
}
3->{
//车门开启关闭失败
holder.tvV2XTitle.text = "运营平台"
holder.ivV2XImage.setImageDrawable(
ContextCompat.getDrawable(
activity,
R.drawable.v2x_icon_shigu_sanjiaopai
))
}
else->{
//普通运营平台
holder.tvV2XTitle.text = "运营平台"
holder.ivV2XImage.setImageDrawable(
ContextCompat.getDrawable(
activity,
R.drawable.icon_msg_box_operation
))
}
}
}else{
//V2X消息
val msgBoxBean = it[position].msgBoxBean
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XContent.text = v2XMsg.content
holder.ivV2XImage.setImageDrawable(ResourcesCompat.getDrawable(activity.resources,EventTypeEnumNew.getUpdateIconRes(v2XMsg.type),null))
holder.clV2XLayout.setOnClickListener {
CallerMsgBoxEventListenerManager.invokeBubbleV2XListener(msgBoxBean)
}
if(v2XMsg.communicationType.isNullOrEmpty()){
holder.tvV2XTitle.text = EventTypeEnumNew.getEventTitle(v2XMsg.type)
}else{
holder.tvV2XTitle.text = String.format(activity.resources.getString(R.string.v2x_title_content),
v2XMsg.communicationType, EventTypeEnumNew.getEventTitle(v2XMsg.type))
}
}
}
}
}
val msgBoxBean: MsgBoxCountDownBean = data!![position]
msgBoxBean.countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
override fun onTick(p0: Long) {
}
override fun onFinish() {
data?.remove(msgBoxBean)
changeViewListener?.notifyView()
notifyDataSetChanged()
}
}
msgBoxBean.countDownTimer?.start()
}
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
return when (data!![position].msgBoxBean.type) {
MsgBoxType.REPORT -> {
report
}
MsgBoxType.NOTICE -> {
notice
}
else -> {
v2x
}
}
}
fun setChangeListener(listener: ChangeViewListener){
changeViewListener = listener
}
interface ChangeViewListener{
fun notifyView()
}
//车辆系统信息
class BubbleReportHolder(itemView: View): RecyclerView.ViewHolder(itemView){
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)
}
//Notice
class BubbleNoticeHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var ivNoticeImage: ImageView = itemView.findViewById(R.id.ivNoticeImage)
var tvNoticeTime: TextView = itemView.findViewById(R.id.tvNoticeTime)
var tvNoticeCheck: TextView = itemView.findViewById(R.id.tvNoticeCheck)
var tvNoticeContent: TextView = itemView.findViewById(R.id.tvNoticeContent)
}
//V2X
class BubbleV2XHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var ivV2XImage: ImageView = itemView.findViewById(R.id.ivV2XImage)
var tvV2XTitle: TextView = itemView.findViewById(R.id.tvV2XTitle)
var tvV2XContent: TextView = itemView.findViewById(R.id.tvV2XContent)
var clV2XLayout: ConstraintLayout = itemView.findViewById(R.id.clV2XLayout)
}
}

View File

@@ -44,7 +44,8 @@ class SingleTrafficLightView @JvmOverloads constructor(
private var mTrafficLightClBG: ConstraintLayout ?= null //司机端红绿灯背景
private var mLightTimeTV: TypefaceTextView ?= null //司机端红绿灯倒计时
private var mLightTimeTVP: GradientTextView? = null //乘客屏红绿灯倒计时
private var mLightSourceTV: TextView? = null //红绿灯来源
private var mLightSourceTV: TextView? = null //乘客端红绿灯来源
private var mLightSourceIV: ImageView ?= null //司机端红绿灯来源
private var mLightSourceDivider: View? = null //分割线
private var mCurrentLightId = TrafficLightEnum.BLACK
@@ -70,19 +71,20 @@ class SingleTrafficLightView @JvmOverloads constructor(
LayoutInflater.from(context).inflate(R.layout.hmi_view_traffic_light, this, true)
}
mLightIconIV = findViewById(R.id.hmi_traffic_light_iv)
mLightSourceTV = findViewById(R.id.hmi_traffic_light_source)
mLightSourceDivider = findViewById(R.id.hmi_traffic_light_divider)
if(trafficLightUser==1){
mLightIconBG = findViewById(R.id.hmi_traffic_light_bg)
mLightTimeTVP = findViewById(R.id.hmi_traffic_light_time_tv_p)
mLightSourceTV = findViewById(R.id.hmi_traffic_light_source)
}else{
mTrafficLightClBG = findViewById(R.id.hmi_traffic_light_cl_bg)
mLightTimeTV = findViewById(R.id.hmi_traffic_light_time_tv)
mLightSourceIV = findViewById(R.id.hmi_traffic_light_source_image)
}
CallerSkinModeListenerManager.addListener(TAG, this)
CallerTrafficLightListenerManager.addListener(TAG, this)
CallerHmiViewControlListenerManager.addListener(TrafficLightView_TAG, this)
CallerSkinModeListenerManager.addListener(this.hashCode().toString(), this)
CallerTrafficLightListenerManager.addListener(this.hashCode().toString(), this)
CallerHmiViewControlListenerManager.addListener(this.hashCode().toString(), this)
if(trafficLightUser==1){
mLightIconBG?.setBackgroundResource(R.drawable.traffic_light_bg_taxi_p)
@@ -98,9 +100,9 @@ class SingleTrafficLightView @JvmOverloads constructor(
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerSkinModeListenerManager.removeListener(TAG)
CallerTrafficLightListenerManager.removeListener(TAG)
CallerHmiViewControlListenerManager.removeListener(TrafficLightView_TAG)
CallerSkinModeListenerManager.removeListener(this.hashCode().toString())
CallerTrafficLightListenerManager.removeListener(this.hashCode().toString())
CallerHmiViewControlListenerManager.removeListener(this.hashCode().toString())
}
override fun onSkinModeChange(skinMode: Int) {
@@ -172,7 +174,13 @@ class SingleTrafficLightView @JvmOverloads constructor(
context.resources.getDimension(R.dimen.dp_310).toInt()
}else{
//司机屏
//TODO
val lp = this.layoutParams as MarginLayoutParams
lp.width = context.resources.getDimension(R.dimen.dp_280).toInt()
this.layoutParams = lp
mLightSourceIV?.visibility = VISIBLE
mLightSourceDivider!!.visibility = VISIBLE
mLightTimeTV?.visibility = GONE
mTrafficLightClBG?.setBackgroundResource(R.drawable.icon_single_traffic_light_perception_bg)
}
}
}
@@ -327,12 +335,14 @@ class SingleTrafficLightView @JvmOverloads constructor(
else -> this@SingleTrafficLightView.visibility = GONE
}
when (lightSource) {
//TODO 司机屏展示来源需要更改文案
DataSourceType.AICLOUD -> {
if(trafficLightUser == 1){
mLightSourceTV?.text = context.getString(R.string.light_source_ai_cloud)
}else{
mLightSourceTV?.text = context.getString(R.string.light_source_driver_ai_cloud)
mLightSourceIV?.setImageDrawable(ContextCompat.getDrawable(
context,
R.drawable.icon_traffic_light_ai
))
}
}
DataSourceType.TELEMATIC_UNION_V2I,
@@ -341,16 +351,20 @@ class SingleTrafficLightView @JvmOverloads constructor(
if(trafficLightUser == 1){
mLightSourceTV?.text = context.getString(R.string.light_source_perception)
}else{
mLightSourceTV?.text = context.getString(R.string.light_source_driver_perception)
mLightSourceIV?.setImageDrawable(ContextCompat.getDrawable(
context,
R.drawable.icon_traffic_light_vehicle
))
}
}
DataSourceType.OBU -> {
if(trafficLightUser == 1){
mLightSourceTV?.text = context.getString(R.string.light_source_obu)
}else{
mLightSourceTV?.text = context.getString(R.string.light_source_driver_obu)
mLightSourceTV?.textSize = AutoSizeUtils.sp2px(context, 23f).toFloat()
mLightSourceTV?.setLineSpacing(0f, 1.0f)
mLightSourceIV?.setImageDrawable(ContextCompat.getDrawable(
context,
R.drawable.icon_traffic_light_obu
))
}
}
else -> {
@@ -374,7 +388,13 @@ class SingleTrafficLightView @JvmOverloads constructor(
context.resources.getDimension(R.dimen.hmi_traffic_light_bus_bg_width).toInt()
}else{
//司机屏
//TODO
val lp = this.layoutParams as MarginLayoutParams
lp.width = context.resources.getDimension(R.dimen.dp_368).toInt()
this.layoutParams = lp
mLightSourceIV?.visibility = VISIBLE
mLightSourceDivider!!.visibility = VISIBLE
mLightTimeTV?.visibility = VISIBLE
mTrafficLightClBG?.setBackgroundResource(R.drawable.icon_single_traffic_light_bg)
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -37,22 +37,19 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:background="#999999"
app:layout_constraintRight_toLeftOf="@id/hmi_traffic_light_source"
app:layout_constraintRight_toLeftOf="@id/hmi_traffic_light_source_image"
android:layout_marginEnd="@dimen/dp_20"
/>
<TextView
android:id="@+id/hmi_traffic_light_source"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<ImageView
android:id="@+id/hmi_traffic_light_source_image"
android:layout_width="@dimen/dp_60"
android:layout_height="@dimen/dp_120"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:orientation="vertical"
android:textSize="@dimen/sp_32"
android:textColor="@color/white"
android:layout_marginEnd="@dimen/dp_65"
android:contentDescription="@string/traffic_light_source"
android:layout_marginEnd="@dimen/dp_50"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/clV2XLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/dp_180"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg_msg_box_toast"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_7"
android:layout_marginBottom="@dimen/dp_7"
>
<ImageView
android:id="@+id/ivV2XImage"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_120"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:src="@drawable/icon_warning_take_over"
android:contentDescription="@string/msg_box_toast_icon"
/>
<TextView
android:id="@+id/tvV2XTitle"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/ivV2XImage"
app:layout_constraintLeft_toRightOf="@id/ivV2XImage"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginStart="@dimen/dp_20"
android:textColor="#FFFFFFFF"
android:textSize="@dimen/sp_40"
android:textStyle="bold"
/>
<TextView
android:id="@+id/tvV2XContent"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvV2XTitle"
app:layout_constraintLeft_toLeftOf="@id/tvV2XTitle"
app:layout_constraintRight_toRightOf="parent"
android:textColor="@color/white"
android:textSize="@dimen/sp_32"
android:layout_marginTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_30"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -78,7 +78,7 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.eagle.core.function.hmi.ui.msgbox.MsgBoxBubbleView
<com.mogo.eagle.core.function.hmi.ui.msgbox.MsgBoxToastView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
@@ -89,10 +89,11 @@
<View
android:id="@+id/shadowView"
android:layout_width="270dp"
android:layout_height="270dp"
android:layout_marginEnd="60dp"
android:layout_marginBottom="60dp"
android:layout_width="310dp"
android:layout_height="310dp"
android:layout_marginEnd="40dp"
android:layout_marginBottom="40dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
app:layout_constraintEnd_toEndOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -210,4 +210,8 @@
<string name="fault_time_reduce">故障发生时间减少</string>
<string name="fault_time_add">故障发生时间增加</string>
<string name="msg_box_toast_icon">消息盒子吐司图标</string>
<string name="traffic_light_source">红绿灯信号来源</string>
</resources>

View File

@@ -447,6 +447,8 @@ class TravelRealityView @JvmOverloads constructor(
)
// 设置自定义样式
mAMap?.setCustomMapStyle(customMapStyleOptions1)
mAMap?.uiSettings?.isZoomControlsEnabled = false
mAMap?.uiSettings?.setLogoBottomMargin(-150)
}
mAMap?.setAMapGestureListener(gestListener)
}
@@ -468,7 +470,7 @@ class TravelRealityView @JvmOverloads constructor(
//设置希望展示的地图缩放级别
val loc = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
if (loc.latitude.toInt() == 0 || loc.longitude.toInt() == 0) {
moveMapCamera(CameraUpdateFactory.zoomTo(14f))
moveMapCamera(CameraUpdateFactory.zoomTo(17f))
} else {
moveMapCamera(CameraUpdateFactory.newLatLngZoom(
coordinateConverterWgsToGcj(
@@ -540,7 +542,7 @@ class TravelRealityView @JvmOverloads constructor(
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
if (isSmallMap) {
this.outlineProvider = TextureVideoViewOutlineProvider(
AutoSizeUtils.dp2px(context, 32f)
AutoSizeUtils.dp2px(context, 38f)
.toFloat()
)
this.clipToOutline = true

View File

@@ -145,6 +145,13 @@ object FunctionBuildConfig {
@JvmField
var isOffLine = false
/**
* 是否是离线模式
*/
@Volatile
@JvmField
var ochdebug = false
@Volatile
@JvmField