[6.7.0] replace taxi base f view to new bone

This commit is contained in:
EmArrow
2024-09-27 19:41:42 +08:00
parent d998b4366a
commit 99d1012b77
39 changed files with 729 additions and 998 deletions

View File

@@ -29,6 +29,26 @@ class DataCenterBizProvider:IDataCenterBizProvider {
CallerDataCenterBizListener.invokeCarNo(plateNumber)
}
override fun notifyOrderStatus(inOrder: Boolean) {
CallerDataCenterBizListener.invokeOrderStatus(inOrder)
}
override fun notifyOrderRemoval() {
CallerDataCenterBizListener.invokeOrderRemoval()
}
override fun notifyOrderLine(lineName: String) {
CallerDataCenterBizListener.invokeOrderLine(lineName)
}
override fun notifyTenantId(tenantId: Long) {
CallerDataCenterBizListener.invokeTenantId(tenantId)
}
override fun notifyLoginStatus(isLogin: Boolean) {
CallerDataCenterBizListener.invokeLoginStatus(isLogin)
}
override fun onDestroy() {
}

View File

@@ -41,10 +41,10 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoFsm2024Listener
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.map.deva.IMoGoMapScreenListener
import com.mogo.eagle.core.function.api.order.IOrderListener
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
@@ -52,12 +52,12 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsList
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapScreenListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
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.call.takeover.CallerTakeOverManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -85,7 +85,7 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
IMoGoChassisLocationGCJ02Listener, IMsgBoxListener, IMoGoDevaToolsListener,
IMogoStatusChangedListener, IMoGoMapScreenListener , IMoGoFsm2024Listener,
IMoGoAutopilotStatisticsListener, IMoGoChassisStatesListener, IMoGoAutopilotStatusListener,
IOrderListener {
IDataCenterBizListener {
const val TAG = "BadCase"
@@ -128,7 +128,7 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
if(ProjectUtils.isSaas()){
// CallerFsm2024ListenerManager.addListener(TAG,this)
CallerAutopilotStatisticsListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerDataCenterBizListener.addListener(TAG,this)
CallerAutoPilotStatusListenerManager.addListener("RecordViewManager",this)
CallerChassisStatesListenerManager.addListener(TAG,this)
}
@@ -690,21 +690,21 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
}
}
override fun onOrderLineUpdate(lineName: String) {
override fun invokeOrderLine(lineName: String) {
BadCaseConfig.lineName = lineName
}
/**
* 获取租户ID
*/
override fun onTenantIdUpdate(tenantId: Long) {
override fun invokeTenantId(tenantId: Long) {
BadCaseConfig.tenantId = tenantId
}
/**
* 监听登录登出状态
*/
override fun onLoginStatusUpdate(isLogin: Boolean) {
override fun invokeLoginStatus(isLogin: Boolean) {
if(reportTypeWindow?.getWindowShowStatus() == true){
reportTypeWindow?.hideFloatWindow()
reportTypeWindow = null

View File

@@ -4,13 +4,13 @@ import android.content.Context
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoFsm2024Listener
import com.mogo.eagle.core.function.api.autopilot.IMoGoNodeStateListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
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.CallerFsm2024ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerNodeStateListenerManager
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.zhjt.mogo.adas.data.AdasConstants
@@ -24,7 +24,7 @@ import kotlinx.coroutines.launch
import java.util.concurrent.atomic.AtomicReference
internal class FSMImpl(ctx: Context) : IFlow<FSMStatus>(ctx), IMoGoAutopilotStatusListener,
IMoGoFsm2024Listener, IMoGoNodeStateListener, IOrderListener {
IMoGoFsm2024Listener, IMoGoNodeStateListener, IDataCenterBizListener {
companion object {
const val TAG = "FSMImpl"
@@ -76,7 +76,7 @@ internal class FSMImpl(ctx: Context) : IFlow<FSMStatus>(ctx), IMoGoAutopilotStat
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerFsm2024ListenerManager.addListener(TAG, this)
CallerNodeStateListenerManager.addNodeStateListener(TAG, setOf(AdasConstants.NodeName.FSM2024), this)
CallerOrderListenerManager.addListener(TAG, this)
CallerDataCenterBizListener.addListener(TAG, this)
}
override fun onAutopilotIpcConnectStatusChanged(
status: AdasConstants.IpcConnectionStatus,
@@ -127,8 +127,8 @@ internal class FSMImpl(ctx: Context) : IFlow<FSMStatus>(ctx), IMoGoAutopilotStat
}
}
override fun onLoginStatusUpdate(isLogin: Boolean) {
super.onLoginStatusUpdate(isLogin)
override fun invokeLoginStatus(isLogin: Boolean) {
super.invokeLoginStatus(isLogin)
if (!isLogin) {
CallerLogger.d(TAG, "onLoginStatusUpdate isLogin=$isLogin")
CallerHmiManager.dismissFSMExceptionStatusWindow()
@@ -141,6 +141,6 @@ internal class FSMImpl(ctx: Context) : IFlow<FSMStatus>(ctx), IMoGoAutopilotStat
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerFsm2024ListenerManager.removeListener(TAG)
CallerNodeStateListenerManager.removeNodeStateListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
}
}

View File

@@ -46,11 +46,9 @@ 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.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.utilcode.util.BarUtils
import com.mogo.eagle.core.utilcode.util.JsonParser
import com.mogo.eagle.core.utilcode.util.ThreadUtils
@@ -66,9 +64,9 @@ import com.zhjt.mogo_core_function_devatools.workorder.adapter.OrderReasonAdapte
* 故障原因编辑窗口
*/
class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
IMoGoDevaToolsListener, IOrderListener {
IMoGoDevaToolsListener {
companion object{
companion object {
const val TAG = "FaultReasonWindow"
}
@@ -84,6 +82,7 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
// 语音听写对象
private var mIat: SpeechRecognizer? = null
// 用HashMap存储听写结果
private val mIatResults: HashMap<String, String> = LinkedHashMap()
@@ -126,8 +125,8 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
private var hasLevel2: Boolean = false //是否有二级分类
private var hasLevel3: Boolean = false //是否有三级分类
private var typeList: List<CategoryInfo> ?= null //故障类型列表
private var reasonList: List<CategoryInfo> ?= null //故障原因列表
private var typeList: List<CategoryInfo>? = null //故障类型列表
private var reasonList: List<CategoryInfo>? = null //故障原因列表
private var faultTypeSelectStatus: Boolean = false //故障类型选择状态
private var faultReasonSelectStatus: Boolean = false //故障原因选择状态
@@ -139,8 +138,9 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
}
@SuppressLint("InflateParams")
private fun initFloatWindow(){
mFloatLayout = LayoutInflater.from(mActivity).inflate(R.layout.view_fault_reason, null) as View
private fun initFloatWindow() {
mFloatLayout =
LayoutInflater.from(mActivity).inflate(R.layout.view_fault_reason, null) as View
mFloatLayout.setOnTouchListener(this)
// 初始化识别无UI识别对象
@@ -160,7 +160,7 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
}
}
private fun initView(){
private fun initView() {
tvFaultTitle = mFloatLayout.findViewById(R.id.tvFaultTitle)
tvFaultTime = mFloatLayout.findViewById(R.id.tvFaultTime)
tvFaultType = mFloatLayout.findViewById(R.id.tvFaultType)
@@ -179,28 +179,34 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
rvFaultList.layoutManager = linearLayoutManager
orderReasonAdapter = OrderReasonAdapter()
orderReasonAdapter.setListener(object: OrderReasonAdapter.ReasonSelectListener{
orderReasonAdapter.setListener(object : OrderReasonAdapter.ReasonSelectListener {
override fun onSelectReason(reason: CategoryInfo, mSource: Int) {
if(mSource == 1){
if (mSource == 1) {
//类型
tvFaultType.text = reason.name
//选择了故障类型
tvFaultType.performClick()
if(level2Id != 0 && level2Id == reason.id){
if (level2Id != 0 && level2Id == reason.id) {
//故障类型选择没有变化
reasonList?.let { orderReasonAdapter.setData(it,2) }
}else{
reasonList?.let { orderReasonAdapter.setData(it, 2) }
} else {
//故障类型发生了变化
level2Id = reason.id
level2Name = reason.name
source = 2
//获取故障三级分类即故障原因
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,3,level2Id,type,0)
CallerDevaToolsManager.getCategories(
BadCaseConfig.tenantId,
3,
level2Id,
type,
0
)
tvFaultReason.text = ""
level3Id = 0
level3Name = ""
}
}else{
} else {
//原因
tvFaultReason.text = reason.name
tvFaultReason.performClick()
@@ -213,33 +219,32 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
}
@SuppressLint("SetTextI18n")
private fun initEvent(){
private fun initEvent() {
CallerDevaToolsListenerManager.addListener(TAG, this)
CallerOrderListenerManager.addListener(TAG,this)
val iconDown = ContextCompat.getDrawable(mActivity, R.drawable.icon_fault_expand)
iconDown?.setBounds(0, 0, iconDown.minimumWidth, iconDown.minimumHeight)
val iconUp = ContextCompat.getDrawable(mActivity, R.drawable.icon_fault_retract)
iconUp?.setBounds(0, 0, iconUp.minimumWidth, iconUp.minimumHeight)
//获取一级分类
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,1,0,type,0)
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId, 1, 0, type, 0)
//弹窗展示时间
tvFaultTime.text = mActivity.resources.getString(R.string.take_over_time) +
millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())
//故障类型选择
tvFaultType.setOnClickListener {
if(!hasLevel2){
if (!hasLevel2) {
ToastUtils.showShort("运营后台没有配置故障类型")
return@setOnClickListener
}
if(faultTypeSelectStatus){
if (faultTypeSelectStatus) {
//关闭
faultTypeSelectStatus = false
tvFaultType.setCompoundDrawables(null, null, iconDown, null)
//隐藏列表
rvFaultList.visibility = View.GONE
}else{
} else {
//如果故障原因此时为打开状态,则关闭
if(faultReasonSelectStatus){
if (faultReasonSelectStatus) {
tvFaultReason.performClick()
}
//打开
@@ -247,68 +252,76 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
tvFaultType.setCompoundDrawables(null, null, iconUp, null)
//展示列表
rvFaultList.visibility = View.VISIBLE
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tvFaultType
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom =
R.id.tvFaultType
source = 1
if(typeList.isNullOrEmpty()){
if (typeList.isNullOrEmpty()) {
//获取故障二级分类即故障类型
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,2,level1Id,type,0)
}else{
orderReasonAdapter.setData(typeList!!,source)
CallerDevaToolsManager.getCategories(
BadCaseConfig.tenantId,
2,
level1Id,
type,
0
)
} else {
orderReasonAdapter.setData(typeList!!, source)
}
}
}
//故障原因选择
tvFaultReason.setOnClickListener {
if(tvFaultType.text.isEmpty()){
if (tvFaultType.text.isEmpty()) {
ToastUtils.showShort("请先选择故障类型")
return@setOnClickListener
}
if(faultReasonSelectStatus){
if (faultReasonSelectStatus) {
//关闭
faultReasonSelectStatus = false
tvFaultReason.setCompoundDrawables(null, null, iconDown, null)
//隐藏列表
rvFaultList.visibility = View.GONE
}else{
} else {
//打开
faultReasonSelectStatus = true
tvFaultReason.setCompoundDrawables(null, null, iconUp, null)
//展示列表
rvFaultList.visibility = View.VISIBLE
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tvFaultReason
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom =
R.id.tvFaultReason
}
}
//发生时间
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
ivTimeReduce.setOnClickListener {
workOrderOccurrenceTime -= 60000
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
tvOccurrenceTime.text =
millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
}
ivTimeAdd.setOnClickListener {
if(workOrderOccurrenceTime + 60000 > System.currentTimeMillis()){
if (workOrderOccurrenceTime + 60000 > System.currentTimeMillis()) {
ToastUtils.showShort("发生时间应在当前时间之前")
return@setOnClickListener
}
workOrderOccurrenceTime += 60000
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
tvOccurrenceTime.text =
millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
}
//补充描述
etNoteInput.onFocusChangeListener = OnFocusChangeListener { v, hasFocus ->
val edit = v as EditText
if(hasFocus){
if (hasFocus) {
edit.hint = ""
}else{
} else {
edit.hint = "手动输入"
}
}
etNoteInput.addTextChangedListener(object: TextWatcher{
etNoteInput.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
@@ -325,26 +338,30 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
//问题描述录音
ivNoteAudio.setOnClickListener {
audioStatus = !audioStatus
if(audioStatus){
ivNoteAudio.setImageDrawable(ContextCompat.getDrawable(
mActivity,
R.drawable.icon_reason_audio_pressed
))
}else{
ivNoteAudio.setImageDrawable(ContextCompat.getDrawable(
mActivity,
R.drawable.icon_reason_audio_normal
))
if (audioStatus) {
ivNoteAudio.setImageDrawable(
ContextCompat.getDrawable(
mActivity,
R.drawable.icon_reason_audio_pressed
)
)
} else {
ivNoteAudio.setImageDrawable(
ContextCompat.getDrawable(
mActivity,
R.drawable.icon_reason_audio_normal
)
)
}
setAudio(audioStatus)
}
//上报
tvFaultReport.setOnClickListener{
if(level2Name.isEmpty()){
tvFaultReport.setOnClickListener {
if (level2Name.isEmpty()) {
ToastUtils.showShort("请完整填写再上报")
return@setOnClickListener
}
if(hasLevel3 && level3Name.isEmpty()){
if (hasLevel3 && level3Name.isEmpty()) {
ToastUtils.showShort("请完整填写再上报")
return@setOnClickListener
}
@@ -354,22 +371,26 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
faultCodeList.add(it.faultId)
}
val geocodeSearch = GeocodeSearch(mActivity)
geocodeSearch.setOnGeocodeSearchListener(object: GeocodeSearch.OnGeocodeSearchListener {
geocodeSearch.setOnGeocodeSearchListener(object :
GeocodeSearch.OnGeocodeSearchListener {
override fun onRegeocodeSearched(regeocodeResult: RegeocodeResult?, p1: Int) {
regeocodeResult?.regeocodeAddress?.formatAddress?.let {
address = it
}
val padProblemList= ArrayList<PadProblemInfo>()
val note = if(reportNote.isEmpty()){
val padProblemList = ArrayList<PadProblemInfo>()
val note = if (reportNote.isEmpty()) {
"$level1Name-$level2Name-$level3Name"
}else{
} else {
"$level1Name-$level2Name-$level3Name($reportNote)"
}
val padProblemInfo = PadProblemInfo(address,faultCodeList,millis2String(workOrderOccurrenceTime),level1Id,
level2Id,level3Id,BadCaseConfig.lineName,note,reportType,
SharedPrefsMgr.getInstance().getString("och_account",""))
val padProblemInfo = PadProblemInfo(
address, faultCodeList, millis2String(workOrderOccurrenceTime), level1Id,
level2Id, level3Id, BadCaseConfig.lineName, note, reportType,
SharedPrefsMgr.getInstance().getString("och_account", "")
)
padProblemList.add(padProblemInfo)
val padAddProblemReq = PadAddProblemReq(padProblemList,AppConfigInfo.plateNumber)
val padAddProblemReq =
PadAddProblemReq(padProblemList, AppConfigInfo.plateNumber)
CallerDevaToolsManager.problemPadAdd(padAddProblemReq)
}
@@ -377,8 +398,11 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
}
})
val latLon = LatLonPoint(CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude, CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude)
val q = RegeocodeQuery(latLon,200f,GeocodeSearch.AMAP)
val latLon = LatLonPoint(
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude,
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude
)
val q = RegeocodeQuery(latLon, 200f, GeocodeSearch.AMAP)
geocodeSearch.getFromLocationAsyn(q)
}
//取消
@@ -388,8 +412,8 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
}
private fun setAudio(status: Boolean){
if(status){
private fun setAudio(status: Boolean) {
if (status) {
//开始录音
mIat?.let {
//清空之前的内容
@@ -405,11 +429,12 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
val scaleAnimation = ScaleAnimation(
1.0f, 0.8f, 1.0f, 0.8f,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f)
Animation.RELATIVE_TO_SELF, 0.5f
)
scaleAnimation.duration = 1000
scaleAnimation.repeatCount = -1
ivNoteAudio.startAnimation(scaleAnimation)
}else{
} else {
//停止语音听写
mIat?.stopListening()
//结束动画
@@ -433,7 +458,7 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
/**
* 听写监听器。
*/
private val mRecognizerListener: RecognizerListener = object : RecognizerListener{
private val mRecognizerListener: RecognizerListener = object : RecognizerListener {
override fun onVolumeChanged(p0: Int, p1: ByteArray?) {
//showTip("当前正在说话,音量大小 = " + volume + " 返回音频数据 = " + data.length);
}
@@ -479,15 +504,16 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
private fun printResult(results: RecognizerResult) {
val text: String = JsonParser.parseIatResult(results.resultString)
Log.i(TAG, "语音内容=$text")
if(text.isNotEmpty()){
if(etNoteInput.text.toString().isEmpty()){
if (text.isNotEmpty()) {
if (etNoteInput.text.toString().isEmpty()) {
etNoteInput.setText(text)
etNoteInput.setSelection(text.length)
}else{
val startStr = etNoteInput.text.toString().substring(0,etNoteInput.selectionStart)
val endStr = etNoteInput.text.toString().substring(etNoteInput.selectionEnd,etNoteInput.text.toString().length)
etNoteInput.setText(startStr+text+endStr)
etNoteInput.setSelection(startStr.length+text.length)
} else {
val startStr = etNoteInput.text.toString().substring(0, etNoteInput.selectionStart)
val endStr = etNoteInput.text.toString()
.substring(etNoteInput.selectionEnd, etNoteInput.text.toString().length)
etNoteInput.setText(startStr + text + endStr)
etNoteInput.setSelection(startStr.length + text.length)
}
}
@@ -505,6 +531,7 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
mInScreenX = motionEvent.rawX
mInScreenY = motionEvent.rawY
}
MotionEvent.ACTION_MOVE -> {
// 更新浮动窗口位置参数
mInScreenX = motionEvent.rawX
@@ -523,19 +550,16 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
val metrics = DisplayMetrics()
// 默认固定位置,靠屏幕右边缘的中间
mWindowManager!!.defaultDisplay.getMetrics(metrics)
mWindowParams!!.x = metrics.widthPixels-890
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight()-1140
mWindowParams!!.x = metrics.widthPixels - 890
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight() - 1140
mWindowManager!!.addView(mFloatLayout, mWindowParams)
}
}
fun hideFloatWindow() {
etNoteInput.clearFocus()
CallerDevaToolsListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
if (mFloatLayout.parent != null){
if (mFloatLayout.parent != null) {
mWindowManager!!.removeView(mFloatLayout)
}
}
@@ -563,7 +587,7 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
val successHandler = Handler(Looper.getMainLooper())
successHandler.postDelayed({
hideFloatWindow()
},1500)
}, 1500)
}
}
@@ -575,28 +599,34 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
override fun getCategoriesSuccess(list: List<CategoryInfo>) {
super.getCategoriesSuccess(list)
ThreadUtils.runOnUiThread {
if(list.isNotEmpty()){
if(source == 0){
if (list.isNotEmpty()) {
if (source == 0) {
level1Id = list[0].id
level1Name = list[0].name
source = 1
//获取故障二级分类即故障类型
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,2,level1Id,type,0)
}else{
if(source == 1){
CallerDevaToolsManager.getCategories(
BadCaseConfig.tenantId,
2,
level1Id,
type,
0
)
} else {
if (source == 1) {
typeList = list
hasLevel2 = true
}else{
} else {
reasonList = list
hasLevel3 = true
}
orderReasonAdapter.setData(list,source)
orderReasonAdapter.setData(list, source)
}
}else{
if(source == 2){
} else {
if (source == 2) {
hasLevel3 = false
}else{
} else {
hasLevel2 = false
ToastUtils.showShort("故障类型列表为空")
}

View File

@@ -6,6 +6,7 @@ import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.call.och.CallerOchBizFunctionCall4EagleManager
import com.mogo.eagle.core.function.call.och.CallerOchCustomViewManager
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_bone_container.view.clBoneBiz
import kotlinx.android.synthetic.main.view_bone_container.view.clBoneTab
@@ -31,6 +32,10 @@ class BoneContainerView @JvmOverloads constructor(
clBoneTab.loginOut {
CallerOchBizFunctionCall4EagleManager.logout()
}
val bizView = CallerOchCustomViewManager.getOchBusinessView(context)
bizView?.let{
clBoneBiz.addView(it)
}
}
fun addBizView(view: View) {

View File

@@ -7,16 +7,11 @@ import android.os.Handler
import android.os.Looper
import android.text.Editable
import android.text.TextWatcher
import com.iflytek.cloud.ErrorCode
import com.iflytek.cloud.InitListener
import com.iflytek.cloud.RecognizerListener
import com.iflytek.cloud.RecognizerResult
import com.iflytek.cloud.SpeechError
import com.iflytek.cloud.SpeechRecognizer
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.View.OnFocusChangeListener
import android.view.animation.Animation
import android.view.animation.ScaleAnimation
import android.widget.EditText
@@ -28,17 +23,21 @@ import com.amap.api.services.geocoder.GeocodeResult
import com.amap.api.services.geocoder.GeocodeSearch
import com.amap.api.services.geocoder.RegeocodeQuery
import com.amap.api.services.geocoder.RegeocodeResult
import com.iflytek.cloud.ErrorCode
import com.iflytek.cloud.InitListener
import com.iflytek.cloud.RecognizerListener
import com.iflytek.cloud.RecognizerResult
import com.iflytek.cloud.SpeechError
import com.iflytek.cloud.SpeechRecognizer
import com.mogo.commons.storage.SharedPrefsMgr
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.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.JsonParser
import com.mogo.eagle.core.utilcode.util.ThreadUtils
@@ -69,12 +68,13 @@ class FaultReasonView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoDevaToolsListener, IOrderListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoDevaToolsListener {
private val TAG = "FaultReasonView"
// 语音听写对象
private var mIat: SpeechRecognizer? = null
// 用HashMap存储听写结果
private val mIatResults: HashMap<String, String> = LinkedHashMap()
@@ -102,8 +102,8 @@ class FaultReasonView @JvmOverloads constructor(
private var hasLevel2: Boolean = false //是否有二级分类
private var hasLevel3: Boolean = false //是否有三级分类
private var typeList: List<CategoryInfo> ?= null //故障类型列表
private var reasonList: List<CategoryInfo> ?= null //故障原因列表
private var typeList: List<CategoryInfo>? = null //故障类型列表
private var reasonList: List<CategoryInfo>? = null //故障原因列表
private var faultTypeSelectStatus: Boolean = false //故障类型选择状态
private var faultReasonSelectStatus: Boolean = false //故障原因选择状态
@@ -116,7 +116,7 @@ class FaultReasonView @JvmOverloads constructor(
initEvent()
}
private fun initView(){
private fun initView() {
// 初始化识别无UI识别对象
// 使用SpeechRecognizer对象可根据回调消息自定义界面
mIat = SpeechRecognizer.createRecognizer(context, mInitListener)
@@ -124,28 +124,34 @@ class FaultReasonView @JvmOverloads constructor(
linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
rvFaultList.layoutManager = linearLayoutManager
orderReasonAdapter = OrderReasonAdapter()
orderReasonAdapter.setListener(object: OrderReasonAdapter.ReasonSelectListener{
orderReasonAdapter.setListener(object : OrderReasonAdapter.ReasonSelectListener {
override fun onSelectReason(reason: CategoryInfo, mSource: Int) {
if(mSource == 1){
if (mSource == 1) {
//类型
tvFaultType.text = reason.name
//选择了故障类型
tvFaultType.performClick()
if(level2Id != 0 && level2Id == reason.id){
if (level2Id != 0 && level2Id == reason.id) {
//故障类型选择没有变化
reasonList?.let { orderReasonAdapter.setData(it,2) }
}else{
reasonList?.let { orderReasonAdapter.setData(it, 2) }
} else {
//故障类型发生了变化
level2Id = reason.id
level2Name = reason.name
source = 2
//获取故障三级分类即故障原因
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,3,level2Id,type,0)
CallerDevaToolsManager.getCategories(
BadCaseConfig.tenantId,
3,
level2Id,
type,
0
)
tvFaultReason.text = ""
level3Id = 0
level3Name = ""
}
}else{
} else {
//原因
tvFaultReason.text = reason.name
tvFaultReason.performClick()
@@ -158,32 +164,32 @@ class FaultReasonView @JvmOverloads constructor(
}
@SuppressLint("SetTextI18n")
private fun initEvent(){
private fun initEvent() {
CallerDevaToolsListenerManager.addListener(TAG, this)
CallerOrderListenerManager.addListener(TAG,this)
val iconDown = ContextCompat.getDrawable(context, R.drawable.icon_fault_expand)
iconDown?.setBounds(0, 0, iconDown.minimumWidth, iconDown.minimumHeight)
val iconUp = ContextCompat.getDrawable(context, R.drawable.icon_fault_retract)
iconUp?.setBounds(0, 0, iconUp.minimumWidth, iconUp.minimumHeight)
//获取一级分类
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,1,0,type,0)
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId, 1, 0, type, 0)
//弹窗展示时间
tvFaultTime.text = millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())
tvFaultTime.text =
millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())
//故障类型选择
tvFaultType.setOnClickListener {
if(!hasLevel2){
if (!hasLevel2) {
ToastUtils.showShort("运营后台没有配置故障类型")
return@setOnClickListener
}
if(faultTypeSelectStatus){
if (faultTypeSelectStatus) {
//关闭
faultTypeSelectStatus = false
tvFaultType.setCompoundDrawables(null, null, iconDown, null)
//隐藏列表
rvFaultList.visibility = View.GONE
}else{
} else {
//如果故障原因此时为打开状态,则关闭
if(faultReasonSelectStatus){
if (faultReasonSelectStatus) {
tvFaultReason.performClick()
}
//打开
@@ -191,36 +197,44 @@ class FaultReasonView @JvmOverloads constructor(
tvFaultType.setCompoundDrawables(null, null, iconUp, null)
//展示列表
rvFaultList.visibility = View.VISIBLE
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tvFaultType
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom =
R.id.tvFaultType
source = 1
if(typeList.isNullOrEmpty()){
if (typeList.isNullOrEmpty()) {
//获取故障二级分类即故障类型
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,2,level1Id,type,0)
}else{
orderReasonAdapter.setData(typeList!!,source)
CallerDevaToolsManager.getCategories(
BadCaseConfig.tenantId,
2,
level1Id,
type,
0
)
} else {
orderReasonAdapter.setData(typeList!!, source)
}
}
}
//故障原因选择
tvFaultReason.setOnClickListener {
if(tvFaultType.text.isEmpty()){
if (tvFaultType.text.isEmpty()) {
ToastUtils.showShort("请先选择故障类型")
return@setOnClickListener
}
if(faultReasonSelectStatus){
if (faultReasonSelectStatus) {
//关闭
faultReasonSelectStatus = false
tvFaultReason.setCompoundDrawables(null, null, iconDown, null)
//隐藏列表
rvFaultList.visibility = View.GONE
}else{
} else {
//打开
faultReasonSelectStatus = true
tvFaultReason.setCompoundDrawables(null, null, iconUp, null)
//展示列表
rvFaultList.visibility = View.VISIBLE
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tvFaultReason
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom =
R.id.tvFaultReason
}
}
@@ -228,27 +242,29 @@ class FaultReasonView @JvmOverloads constructor(
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
ivTimeReduce.setOnClickListener {
workOrderOccurrenceTime -= 60000
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
tvOccurrenceTime.text =
millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
}
ivTimeAdd.setOnClickListener {
if(workOrderOccurrenceTime + 60000 > System.currentTimeMillis()){
if (workOrderOccurrenceTime + 60000 > System.currentTimeMillis()) {
ToastUtils.showShort("发生时间应在当前时间之前")
return@setOnClickListener
}
workOrderOccurrenceTime += 60000
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
tvOccurrenceTime.text =
millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
}
//补充描述
etNoteInput.onFocusChangeListener = OnFocusChangeListener { v, hasFocus ->
val edit = v as EditText
if(hasFocus){
if (hasFocus) {
edit.hint = ""
}else{
} else {
edit.hint = "手动输入"
}
}
etNoteInput.addTextChangedListener(object: TextWatcher {
etNoteInput.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
@@ -265,26 +281,30 @@ class FaultReasonView @JvmOverloads constructor(
//问题描述录音
ivNoteAudio.setOnClickListener {
audioStatus = !audioStatus
if(audioStatus){
ivNoteAudio.setImageDrawable(ContextCompat.getDrawable(
context,
R.drawable.icon_reason_audio_pressed
))
}else{
ivNoteAudio.setImageDrawable(ContextCompat.getDrawable(
context,
R.drawable.icon_reason_audio_normal
))
if (audioStatus) {
ivNoteAudio.setImageDrawable(
ContextCompat.getDrawable(
context,
R.drawable.icon_reason_audio_pressed
)
)
} else {
ivNoteAudio.setImageDrawable(
ContextCompat.getDrawable(
context,
R.drawable.icon_reason_audio_normal
)
)
}
setAudio(audioStatus)
}
//上报
tvFaultReport.setOnClickListener{
if(level2Name.isEmpty()){
tvFaultReport.setOnClickListener {
if (level2Name.isEmpty()) {
ToastUtils.showShort("请完整填写再上报")
return@setOnClickListener
}
if(hasLevel3 && level3Name.isEmpty()){
if (hasLevel3 && level3Name.isEmpty()) {
ToastUtils.showShort("请完整填写再上报")
return@setOnClickListener
}
@@ -294,22 +314,26 @@ class FaultReasonView @JvmOverloads constructor(
faultCodeList.add(it.faultId)
}
val geocodeSearch = GeocodeSearch(context)
geocodeSearch.setOnGeocodeSearchListener(object: GeocodeSearch.OnGeocodeSearchListener {
geocodeSearch.setOnGeocodeSearchListener(object :
GeocodeSearch.OnGeocodeSearchListener {
override fun onRegeocodeSearched(regeocodeResult: RegeocodeResult?, p1: Int) {
regeocodeResult?.regeocodeAddress?.formatAddress?.let {
address = it
}
val padProblemList= ArrayList<PadProblemInfo>()
val note = if(reportNote.isEmpty()){
val padProblemList = ArrayList<PadProblemInfo>()
val note = if (reportNote.isEmpty()) {
"$level1Name-$level2Name-$level3Name"
}else{
} else {
"$level1Name-$level2Name-$level3Name($reportNote)"
}
val padProblemInfo = PadProblemInfo(address,faultCodeList,millis2String(workOrderOccurrenceTime),level1Id,
level2Id,level3Id,BadCaseConfig.lineName,note,reportType,
SharedPrefsMgr.getInstance().getString("och_account",""))
val padProblemInfo = PadProblemInfo(
address, faultCodeList, millis2String(workOrderOccurrenceTime), level1Id,
level2Id, level3Id, BadCaseConfig.lineName, note, reportType,
SharedPrefsMgr.getInstance().getString("och_account", "")
)
padProblemList.add(padProblemInfo)
val padAddProblemReq = PadAddProblemReq(padProblemList, AppConfigInfo.plateNumber)
val padAddProblemReq =
PadAddProblemReq(padProblemList, AppConfigInfo.plateNumber)
CallerDevaToolsManager.problemPadAdd(padAddProblemReq)
}
@@ -317,8 +341,11 @@ class FaultReasonView @JvmOverloads constructor(
}
})
val latLon = LatLonPoint(CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude, CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude)
val q = RegeocodeQuery(latLon,200f,GeocodeSearch.AMAP)
val latLon = LatLonPoint(
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude,
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude
)
val q = RegeocodeQuery(latLon, 200f, GeocodeSearch.AMAP)
geocodeSearch.getFromLocationAsyn(q)
}
@@ -329,8 +356,8 @@ class FaultReasonView @JvmOverloads constructor(
}
}
private fun setAudio(status: Boolean){
if(status){
private fun setAudio(status: Boolean) {
if (status) {
//开始录音
mIat?.let {
//清空之前的内容
@@ -346,11 +373,12 @@ class FaultReasonView @JvmOverloads constructor(
val scaleAnimation = ScaleAnimation(
1.0f, 0.8f, 1.0f, 0.8f,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f)
Animation.RELATIVE_TO_SELF, 0.5f
)
scaleAnimation.duration = 1000
scaleAnimation.repeatCount = -1
ivNoteAudio.startAnimation(scaleAnimation)
}else{
} else {
//停止语音听写
mIat?.stopListening()
//结束动画
@@ -370,7 +398,7 @@ class FaultReasonView @JvmOverloads constructor(
/**
* 听写监听器。
*/
private val mRecognizerListener: RecognizerListener = object : RecognizerListener{
private val mRecognizerListener: RecognizerListener = object : RecognizerListener {
override fun onVolumeChanged(p0: Int, p1: ByteArray?) {
//showTip("当前正在说话,音量大小 = " + volume + " 返回音频数据 = " + data.length);
}
@@ -412,15 +440,16 @@ class FaultReasonView @JvmOverloads constructor(
private fun printResult(results: RecognizerResult) {
val text: String = JsonParser.parseIatResult(results.resultString)
Log.i(TAG, "语音内容=$text")
if(text.isNotEmpty()){
if(etNoteInput.text.toString().isEmpty()){
if (text.isNotEmpty()) {
if (etNoteInput.text.toString().isEmpty()) {
etNoteInput.setText(text)
etNoteInput.setSelection(text.length)
}else{
val startStr = etNoteInput.text.toString().substring(0,etNoteInput.selectionStart)
val endStr = etNoteInput.text.toString().substring(etNoteInput.selectionEnd,etNoteInput.text.toString().length)
etNoteInput.setText(startStr+text+endStr)
etNoteInput.setSelection(startStr.length+text.length)
} else {
val startStr = etNoteInput.text.toString().substring(0, etNoteInput.selectionStart)
val endStr = etNoteInput.text.toString()
.substring(etNoteInput.selectionEnd, etNoteInput.text.toString().length)
etNoteInput.setText(startStr + text + endStr)
etNoteInput.setSelection(startStr.length + text.length)
}
}
@@ -450,7 +479,7 @@ class FaultReasonView @JvmOverloads constructor(
successHandler.postDelayed({
this@FaultReasonView.visibility = View.GONE
clickListener?.closeFaultReasonView()
},1500)
}, 1500)
}
}
@@ -462,28 +491,34 @@ class FaultReasonView @JvmOverloads constructor(
override fun getCategoriesSuccess(list: List<CategoryInfo>) {
super.getCategoriesSuccess(list)
ThreadUtils.runOnUiThread {
if(list.isNotEmpty()){
if(source == 0){
if (list.isNotEmpty()) {
if (source == 0) {
level1Id = list[0].id
level1Name = list[0].name
source = 1
//获取故障二级分类即故障类型
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,2,level1Id,type,0)
}else{
if(source == 1){
CallerDevaToolsManager.getCategories(
BadCaseConfig.tenantId,
2,
level1Id,
type,
0
)
} else {
if (source == 1) {
typeList = list
hasLevel2 = true
}else{
} else {
reasonList = list
hasLevel3 = true
}
orderReasonAdapter.setData(list,source)
orderReasonAdapter.setData(list, source)
}
}else{
if(source == 2){
} else {
if (source == 2) {
hasLevel3 = false
}else{
} else {
hasLevel2 = false
ToastUtils.showShort("故障类型列表为空")
}

View File

@@ -12,13 +12,13 @@ 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.IDataCenterBizListener
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.datacenter.CallerDataCenterBizListener
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.bone.tab.adapter.MsgBoxTabAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
@@ -38,8 +38,7 @@ class MsgBoxTabView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener, IMsgBoxEventListener,
IOrderListener {
) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener, IMsgBoxEventListener, IDataCenterBizListener {
init {
LayoutInflater.from(context).inflate(R.layout.view_msg_box_tab, this, true)
@@ -285,7 +284,7 @@ class MsgBoxTabView @JvmOverloads constructor(
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerDataCenterBizListener.addListener(TAG,this)
EventBus.getDefault().register(this)
}
@@ -293,7 +292,7 @@ class MsgBoxTabView @JvmOverloads constructor(
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
EventBus.getDefault().unregister(this)
}
@@ -338,7 +337,8 @@ class MsgBoxTabView @JvmOverloads constructor(
}
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
override fun invokeOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}
}

View File

@@ -9,13 +9,13 @@ import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelStoreOwner
import com.mogo.commons.env.ProjectUtils
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.api.och.toolkit.IToolKitItemClickListener
import com.mogo.eagle.core.function.api.och.toolkit.ToolKitCustomItemAddParam
import com.mogo.eagle.core.function.api.och.toolkit.ToolKitDefaultItemAddParam
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.bone.toolkit.custom.ToolDriverRomaView
import com.mogo.eagle.core.function.hmi.bone.toolkit.custom.ToolRestartSystemView
@@ -32,7 +32,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import java.util.concurrent.ConcurrentHashMap
import kotlin.system.exitProcess
object ToolKitDataManager : IToolKitItemClickListener, IOrderListener {
object ToolKitDataManager : IToolKitItemClickListener, IDataCenterBizListener {
const val TAG = "ToolKitDataManager"
enum class ToolTypeEnum {
@@ -76,7 +76,7 @@ object ToolKitDataManager : IToolKitItemClickListener, IOrderListener {
return
}
// 注册登录/登出 监听
CallerOrderListenerManager.addListener(TAG, this)
CallerDataCenterBizListener.addListener(TAG, this)
// 添加默认的工具箱items
toolList.also {
it += ToolKitBean(
@@ -360,8 +360,8 @@ object ToolKitDataManager : IToolKitItemClickListener, IOrderListener {
// }
}
override fun onLoginStatusUpdate(isLogin: Boolean) {
super.onLoginStatusUpdate(isLogin)
override fun invokeLoginStatus(isLogin: Boolean) {
super.invokeLoginStatus(isLogin)
Logger.i(TAG, "onLoginStatusUpdate isLogin=$isLogin")
if (!isLogin) {
unInit()
@@ -371,4 +371,5 @@ object ToolKitDataManager : IToolKitItemClickListener, IOrderListener {
}
}
}
}

View File

@@ -14,8 +14,8 @@ 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
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener
import com.mogo.map.listener.IMogoMapListener
@@ -29,7 +29,8 @@ class MapContainerLayout @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMogoMapListener, IOrderListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMogoMapListener,
IDataCenterBizListener {
@Volatile
private var isScaled = false
@@ -104,7 +105,7 @@ class MapContainerLayout @JvmOverloads constructor(
"${TAG}${this.hashCode()}",
this
)
CallerOrderListenerManager.addListener("${TAG}${this.hashCode()}", this)
CallerDataCenterBizListener.addListener("${TAG}${this.hashCode()}", this)
}
override fun onDetachedFromWindow() {
@@ -125,8 +126,8 @@ class MapContainerLayout @JvmOverloads constructor(
super.onMapClick(latLng)
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
super.onUpdateOrderStatus(inOrder)
override fun invokeOrderStatus(inOrder: Boolean) {
super.invokeOrderStatus(inOrder)
if (!inOrder) {// 订单结束
if (isScaled) {// 行程总览地图
overMapView.clearAllMarkersAndPolyline()

View File

@@ -17,19 +17,18 @@ 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.IDataCenterBizListener
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.CallerAutoPilotControlManager
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.datacenter.CallerDataCenterBizListener
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.DriverMsgBoxBubbleAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.SoundPoolUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.zhjt.mogo.adas.data.AdasConstants
@@ -47,22 +46,25 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener,IOrderListener,
IMoGoNodeStateListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener,
IMoGoNodeStateListener, IDataCenterBizListener {
init {
LayoutInflater.from(context).inflate(R.layout.layout_driver_msg_box_bubble, this, true)
initView()
}
var driverMsgBoxBubbleAdapter: DriverMsgBoxBubbleAdapter ?=null
var driverMsgBoxBubbleAdapter: DriverMsgBoxBubbleAdapter? = null
private val TAG = "DriverMsgBoxBubbleView"
private val dataList :ArrayList<MsgBoxCountDownBean> = ArrayList()
private val TAG = "DriverMsgBoxBubbleView"
private val dataList: ArrayList<MsgBoxCountDownBean> = ArrayList()
private var isShowData = true
private var isShowSummary = false //是否展示汇总消息
private val fsmNodeState by lazy { // 是否存在 FSM 模块
AtomicReference<NodeState>(CallerAutoPilotControlManager.getNodeStateInfo(AdasConstants.NodeName.FSM2024)?.nodeState ?: NodeState.NODE_UNKNOWN)
AtomicReference<NodeState>(
CallerAutoPilotControlManager.getNodeStateInfo(AdasConstants.NodeName.FSM2024)?.nodeState
?: NodeState.NODE_UNKNOWN
)
}
private fun initView() {
@@ -71,9 +73,10 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
linearLayoutManager.stackFromEnd = true
linearLayoutManager.reverseLayout = true
driverMsgBoxBubbleAdapter = DriverMsgBoxBubbleAdapter(context as Activity)
driverMsgBoxBubbleAdapter?.setChangeListener(object : DriverMsgBoxBubbleAdapter.ChangeViewListener{
driverMsgBoxBubbleAdapter?.setChangeListener(object :
DriverMsgBoxBubbleAdapter.ChangeViewListener {
override fun notifyView() {
if(dataList.isEmpty()){
if (dataList.isEmpty()) {
clMsgBubbleLayout.visibility = View.GONE
}
}
@@ -87,7 +90,7 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
* 是否展示接收消息,消息盒子打开状态下不再展示气泡消息
* @param show true 展示false 不展示
*/
fun isShowData(show: Boolean){
fun isShowData(show: Boolean) {
isShowData = show
}
@@ -97,86 +100,97 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
MsgCategory.NOTICE -> {
MsgBoxConfig.noticeList.add(msgBoxBean)
}
MsgCategory.SYS_INFO -> {
MsgBoxConfig.systemInfoList.add(msgBoxBean)
}
MsgCategory.RECORD_BAG -> {
MsgBoxConfig.recordBagList.add(msgBoxBean)
}
else -> {}
}
if(isShowData){
if(category == MsgCategory.RECORD_BAG){
if(!FunctionBuildConfig.isDemoMode && FunctionBuildConfig.isShowBagRecordWindow){
if (isShowData) {
if (category == MsgCategory.RECORD_BAG) {
if (!FunctionBuildConfig.isDemoMode && FunctionBuildConfig.isShowBagRecordWindow) {
//弹出被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean,context as Activity,true)
CallerDevaToolsManager.onReceiveBadCaseRecord(
msgBoxBean,
context as Activity,
true
)
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
}
} else if(category == MsgCategory.SYS_INFO){
} else if (category == MsgCategory.SYS_INFO) {
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
if(msgBoxBean.type == MsgBoxType.REPORT){
if (msgBoxBean.type == MsgBoxType.REPORT) {
val reportMsg = msgBoxBean.bean as ReportEntity
//P8-P1均只收在消息盒子里P0消息盒子弹出其中P0弹出时需要判断驾驶状态非自动驾驶、非平行驾驶状态不弹出其余状态弹出
var isShowReport = false
for(action in reportMsg.actionsList){
if("ACTION_MANUAL_HANDLE_IMMEDIATELY" == action){
if(CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7){
for (action in reportMsg.actionsList) {
if ("ACTION_MANUAL_HANDLE_IMMEDIATELY" == action) {
if (CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7
) {
isShowReport = true
}
}
}
if(isShowReport){
if (isShowReport) {
//展示消息
showData(msgBoxBean)
}
}
} else if(category == MsgCategory.FM_INFO){
} else if (category == MsgCategory.FM_INFO) {
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
if(FunctionBuildConfig.isTakeoverRemind){
if (FunctionBuildConfig.isTakeoverRemind) {
//属于停车警示(包括择机靠边停车、立即舒适停车、就地紧急停车)时,需要弹出消息气泡并伴有提示音
val fmInfoMsg = msgBoxBean.bean as FMInfoMsg
var curFaultLevel = 5 //默认级别遍历数组找出级别最高的level数越小级别越高
fmInfoMsg.fmInfoList?.forEach { faultInfo ->
if(faultInfo.faultActionCount>0){
faultInfo.faultActionList.forEach {actionCode ->
if (faultInfo.faultActionCount > 0) {
faultInfo.faultActionList.forEach { actionCode ->
//获取建议操作级别,得到建议操作级别最高的操作
if(MsgFmData.FaultAction.getFaultLevel(actionCode) < curFaultLevel){
curFaultLevel = MsgFmData.FaultAction.getFaultLevel(actionCode)
if (MsgFmData.FaultAction.getFaultLevel(actionCode) < curFaultLevel) {
curFaultLevel =
MsgFmData.FaultAction.getFaultLevel(actionCode)
}
}
}
}
//P0级消息弹出时需要判断驾驶状态非自动驾驶、非平行驾驶状态不弹出其余状态弹出
if(curFaultLevel == 0){
if (curFaultLevel == 0) {
//自动驾驶状态 0是不可用 1是ready 2是自动驾驶中 7:平行驾驶中
if(CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7){
if (CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7
) {
// 6.6.0 ,因为 FSM 模块也会弹修改为只有没有 FSM 模块才弹
// 6.6.0 20240823 考虑到 FSM 初期消息不一定全,先不加限制,产品先观察功能后再考虑是否过滤
// if (hasNoneFSMNode()) {
//语音提示
try {
SoundPoolUtils.getSoundPool().playSoundWithRedId(context,R.raw.weak_net_tips)
}catch (e: Exception){
e.printStackTrace()
}
//展示消息
showData(msgBoxBean)
//语音提示
try {
SoundPoolUtils.getSoundPool()
.playSoundWithRedId(context, R.raw.weak_net_tips)
} catch (e: Exception) {
e.printStackTrace()
}
//展示消息
showData(msgBoxBean)
//}
}
}
}
} else{
if(msgBoxBean.sourceType == DataSourceType.SUMMARY){
} else {
if (msgBoxBean.sourceType == DataSourceType.SUMMARY) {
//在一次订单中汇总消息只展示一次
if(isShowSummary){
if (isShowSummary) {
showData(msgBoxBean)
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
isShowSummary = false
}
}else{
if(msgBoxBean.type == MsgBoxType.V2X){
} else {
if (msgBoxBean.type == MsgBoxType.V2X) {
//鹰眼650需求不再展示气泡态V2X消息
return@post
}
@@ -190,23 +204,27 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerNodeStateListenerManager.addNodeStateListener(TAG, setOf(AdasConstants.NodeName.FSM2024), this)
CallerMsgBoxListenerManager.addListener(TAG, this)
CallerDataCenterBizListener.addListener(TAG, this)
CallerNodeStateListenerManager.addNodeStateListener(
TAG,
setOf(AdasConstants.NodeName.FSM2024),
this
)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
CallerNodeStateListenerManager.removeNodeStateListener(TAG)
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
override fun invokeOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}
private fun showData(msgBoxBean: MsgBoxBean){
private fun showData(msgBoxBean: MsgBoxBean) {
clMsgBubbleLayout.visibility = View.VISIBLE
val msgBoxCountDownBean = MsgBoxCountDownBean(msgBoxBean)
dataList.add(msgBoxCountDownBean)

View File

@@ -7,21 +7,19 @@ import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.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.IDataCenterBizListener
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.datacenter.CallerDataCenterBizListener
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.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.layout_driver_msg_box_list.view.*
import org.greenrobot.eventbus.EventBus
@@ -37,8 +35,7 @@ class DriverMsgBoxListView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener, IMsgBoxEventListener,
IOrderListener {
) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener, IMsgBoxEventListener, IDataCenterBizListener {
init {
LayoutInflater.from(context).inflate(R.layout.layout_driver_msg_box_list, this, true)
@@ -280,7 +277,7 @@ class DriverMsgBoxListView @JvmOverloads constructor(
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerDataCenterBizListener.addListener(TAG,this)
EventBus.getDefault().register(this)
}
@@ -288,7 +285,7 @@ class DriverMsgBoxListView @JvmOverloads constructor(
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
EventBus.getDefault().unregister(this)
}
@@ -333,7 +330,8 @@ class DriverMsgBoxListView @JvmOverloads constructor(
}
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
override fun invokeOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}
}

View File

@@ -6,10 +6,10 @@ import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_m1_msg_box_button.view.*
@@ -20,7 +20,8 @@ class MMsgBoxButtonView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
): ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxEventListener, IOrderListener {
): ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxEventListener,
IDataCenterBizListener {
companion object {
const val TAG = "MMsgBoxButtonView"
@@ -43,13 +44,13 @@ class MMsgBoxButtonView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMsgBoxEventListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerDataCenterBizListener.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxEventListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
}
override fun onSummaryClickEvent() {
@@ -88,7 +89,8 @@ class MMsgBoxButtonView @JvmOverloads constructor(
fun showMsgBoxList(show: Boolean)
}
override fun onOrderRemoval() {
override fun invokeOrderRemoval() {
super.invokeOrderRemoval()
//核销订单,去除红点
msgBoxMTipView.visibility = View.GONE
}

View File

@@ -13,13 +13,13 @@ 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.function.api.datacenter.IDataCenterBizListener
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.datacenter.CallerDataCenterBizListener
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.MMsgBoxListAdapter
import com.mogo.eagle.core.utilcode.util.ResourceUtils.getDrawable
@@ -33,11 +33,12 @@ class MMsgBoxListView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IMsgBoxEventListener,
IOrderListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IMsgBoxEventListener, IDataCenterBizListener {
private val TAG = "MMsgBoxListView"
var mMsgBoxListAdapter: MMsgBoxListAdapter?= null
companion object{
private const val TAG = "MMsgBoxListView"
}
private var mMsgBoxListAdapter: MMsgBoxListAdapter?= null
private var noticeList: ArrayList<MsgBoxBean> ?= null
init{
@@ -89,14 +90,14 @@ class MMsgBoxListView @JvmOverloads constructor(
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerDataCenterBizListener.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
}
override fun onSummaryClickEvent() {
@@ -121,7 +122,7 @@ class MMsgBoxListView @JvmOverloads constructor(
}
override fun onOrderRemoval() {
override fun invokeOrderRemoval() {
//清除历史消息,并刷新列表
CallerMsgBoxManager.delMsgTable(context)
noticeList?.let {

View File

@@ -16,13 +16,13 @@ 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.datacenter.IDataCenterBizListener
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.datacenter.CallerDataCenterBizListener
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.MsgBoxToastAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
@@ -38,22 +38,25 @@ class MsgBoxToastView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IOrderListener{
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener,
IDataCenterBizListener {
companion object {
private const val TAG = "MsgBoxToastView"
}
init {
LayoutInflater.from(context).inflate(R.layout.layout_msg_box_bubble, this, true)
initView()
}
var msgBoxToastAdapter: MsgBoxToastAdapter ?= null
private val TAG = "MsgBoxBubbleView"
private val dataList :ArrayList<MsgBoxCountDownBean> = ArrayList()
private var msgBoxToastAdapter: MsgBoxToastAdapter? = null
private val dataList: ArrayList<MsgBoxCountDownBean> = ArrayList()
private var isShowData = true
private var isShowSummary = false //是否展示汇总消息
private fun initView(){
private fun initView() {
val linearLayoutManager = LinearLayoutManager(context)
linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
linearLayoutManager.stackFromEnd = true
@@ -61,7 +64,7 @@ class MsgBoxToastView @JvmOverloads constructor(
msgBoxToastAdapter = MsgBoxToastAdapter(context as Activity)
msgBoxToastAdapter?.setChangeListener(object : MsgBoxToastAdapter.ChangeViewListener{
override fun notifyView() {
if(dataList.isEmpty()){
if (dataList.isEmpty()) {
llMsgBubbleLayout.visibility = View.GONE
}
}
@@ -75,7 +78,7 @@ class MsgBoxToastView @JvmOverloads constructor(
* 是否展示接收消息,消息盒子打开状态下不再展示气泡消息
* @param show true 展示false 不展示
*/
fun isShowData(show: Boolean){
fun isShowData(show: Boolean) {
isShowData = show
}
@@ -85,68 +88,79 @@ class MsgBoxToastView @JvmOverloads constructor(
MsgCategory.NOTICE -> {
MsgBoxConfig.noticeList.add(msgBoxBean)
}
MsgCategory.SYS_INFO -> {
MsgBoxConfig.systemInfoList.add(msgBoxBean)
}
MsgCategory.RECORD_BAG -> {
MsgBoxConfig.recordBagList.add(msgBoxBean)
}
else -> {}
}
if(isShowData){
if(category == MsgCategory.RECORD_BAG){
if(!FunctionBuildConfig.isDemoMode && FunctionBuildConfig.isShowBagRecordWindow){
if (isShowData) {
if (category == MsgCategory.RECORD_BAG) {
if (!FunctionBuildConfig.isDemoMode && FunctionBuildConfig.isShowBagRecordWindow) {
//弹出被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean,context as Activity,true)
CallerDevaToolsManager.onReceiveBadCaseRecord(
msgBoxBean,
context as Activity,
true
)
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
}
} else if(category == MsgCategory.SYS_INFO){
} else if (category == MsgCategory.SYS_INFO) {
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
if(msgBoxBean.type == MsgBoxType.REPORT){
if (msgBoxBean.type == MsgBoxType.REPORT) {
val reportMsg = msgBoxBean.bean as ReportEntity
//P8-P1均只收在消息盒子里P0消息盒子弹出其中P0弹出时需要判断驾驶状态非自动驾驶、非平行驾驶状态不弹出其余状态弹出
var isShowReport = false
for(action in reportMsg.actionsList){
if("ACTION_MANUAL_HANDLE_IMMEDIATELY" == action){
if(CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7){
for (action in reportMsg.actionsList) {
if ("ACTION_MANUAL_HANDLE_IMMEDIATELY" == action) {
if (CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7
) {
isShowReport = true
}
}
}
if(isShowReport){
if (isShowReport) {
//展示消息
showData(msgBoxBean)
}
}
} else if(category == MsgCategory.FM_INFO){
} else if (category == MsgCategory.FM_INFO) {
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
if(FunctionBuildConfig.isTakeoverRemind){
if (FunctionBuildConfig.isTakeoverRemind) {
//属于停车警示(包括择机靠边停车、立即舒适停车、就地紧急停车)时,需要弹出消息气泡并伴有提示音
val fmInfoMsg = msgBoxBean.bean as FMInfoMsg
var curFaultLevel = 5 //默认级别遍历数组找出级别最高的level数越小级别越高
fmInfoMsg.fmInfoList?.forEach { faultInfo ->
if(faultInfo.faultActionCount>0){
faultInfo.faultActionList.forEach {actionCode ->
if (faultInfo.faultActionCount > 0) {
faultInfo.faultActionList.forEach { actionCode ->
//获取建议操作级别,得到建议操作级别最高的操作
if(MsgFmData.FaultAction.getFaultLevel(actionCode) < curFaultLevel){
curFaultLevel = MsgFmData.FaultAction.getFaultLevel(actionCode)
if (MsgFmData.FaultAction.getFaultLevel(actionCode) < curFaultLevel) {
curFaultLevel =
MsgFmData.FaultAction.getFaultLevel(actionCode)
}
}
}
}
//P0级消息弹出时需要判断驾驶状态非自动驾驶、非平行驾驶状态不弹出其余状态弹出
if(curFaultLevel == 0){
if (curFaultLevel == 0) {
//自动驾驶状态 0是不可用 1是ready 2是自动驾驶中 7:平行驾驶中
if(CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7){
if (CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7
) {
// 6.6.0 ,因为 FSM 模块也会弹修改为只有没有 FSM 模块才弹
// 6.6.0 20240823 考虑到 FSM 初期消息不一定全,先不加限制,产品先观察功能后再考虑是否过滤
// if (hasNoneFSMNode()) {
//语音提示
try {
SoundPoolUtils.getSoundPool().playSoundWithRedId(context,R.raw.weak_net_tips)
}catch (e: Exception){
SoundPoolUtils.getSoundPool()
.playSoundWithRedId(context, R.raw.weak_net_tips)
} catch (e: Exception) {
e.printStackTrace()
}
//展示消息
@@ -155,16 +169,16 @@ class MsgBoxToastView @JvmOverloads constructor(
}
}
}
} else{
if(msgBoxBean.sourceType == DataSourceType.SUMMARY){
} else {
if (msgBoxBean.sourceType == DataSourceType.SUMMARY) {
//在一次订单中汇总消息只展示一次
if(isShowSummary){
if (isShowSummary) {
showData(msgBoxBean)
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
isShowSummary = false
}
}else{
if(msgBoxBean.type == MsgBoxType.V2X){
} else {
if (msgBoxBean.type == MsgBoxType.V2X) {
//鹰眼650需求不再展示气泡态V2X消息
return@post
}
@@ -178,21 +192,21 @@ class MsgBoxToastView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerMsgBoxListenerManager.addListener(TAG, this)
CallerDataCenterBizListener.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
override fun invokeOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}
private fun showData(msgBoxBean: MsgBoxBean){
private fun showData(msgBoxBean: MsgBoxBean) {
llMsgBubbleLayout.visibility = View.VISIBLE
val msgBoxCountDownBean = MsgBoxCountDownBean(msgBoxBean)
dataList.add(msgBoxCountDownBean)

View File

@@ -12,12 +12,12 @@ 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.VoiceMsg
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
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.datacenter.CallerDataCenterBizListener
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.PassengerMsgBoxBubbleAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
@@ -34,8 +34,8 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IOrderListener,
IMsgBoxEventListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener,
IMsgBoxEventListener, IDataCenterBizListener {
private val TAG = "PassengerMsgBoxBubbleView"
private val dataList :ArrayList<MsgBoxCountDownBean> = ArrayList()
@@ -174,18 +174,18 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerDataCenterBizListener.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
override fun invokeOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}

View File

@@ -11,13 +11,13 @@ import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
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.datacenter.CallerDataCenterBizListener
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.PassengerMsgBoxListAdapter
import com.mogo.eagle.core.utilcode.util.ResourceUtils.getDrawable
@@ -34,7 +34,7 @@ class PassengerMsgBoxListView @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IMsgBoxEventListener,
IOrderListener {
IDataCenterBizListener {
private val TAG = "PassengerMsgBoxListView"
var passengerMsgBoxListAdapter: PassengerMsgBoxListAdapter ?= null
@@ -93,14 +93,14 @@ class PassengerMsgBoxListView @JvmOverloads constructor(
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerDataCenterBizListener.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
}
override fun onSummaryClickEvent() {
@@ -125,7 +125,7 @@ class PassengerMsgBoxListView @JvmOverloads constructor(
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
override fun invokeOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}

View File

@@ -7,9 +7,8 @@ import android.view.View
import android.view.WindowManager
import android.view.animation.OvershootInterpolator
import com.mogo.eagle.core.data.enums.SidePattern
import com.mogo.eagle.core.data.status.StatusSummaryEntity
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
import com.mogo.eagle.core.function.hmi.notification.anim.DefaultAnimator
import com.mogo.eagle.core.utilcode.util.BarUtils
@@ -33,9 +32,9 @@ class StatusView private constructor() {
}
init {
CallerOrderListenerManager.addListener(TAG, object : IOrderListener{
override fun onLoginStatusUpdate(isLogin: Boolean) {
super.onLoginStatusUpdate(isLogin)
CallerDataCenterBizListener.addListener(TAG, object : IDataCenterBizListener {
override fun invokeLoginStatus(isLogin: Boolean) {
super.invokeLoginStatus(isLogin)
if (!isLogin) {
dismiss()
}
@@ -43,7 +42,11 @@ class StatusView private constructor() {
})
}
fun toggle(context: Context, gravity: Int = Gravity.RIGHT, sidePattern: SidePattern = SidePattern.RIGHT) {
fun toggle(
context: Context,
gravity: Int = Gravity.RIGHT,
sidePattern: SidePattern = SidePattern.RIGHT
) {
if (mStatusSummaryViewFloat != null) {
dismiss()
} else {
@@ -57,7 +60,7 @@ class StatusView private constructor() {
}
val height = AutoSizeUtils.dp2px(context, 1100f)
val maxHeight = ScreenUtils.getScreenHeight() - BarUtils.getStatusBarHeight()
val currentHeight = if(height>maxHeight) maxHeight else height
val currentHeight = if (height > maxHeight) maxHeight else height
mStatusSummaryViewFloat = WarningFloat.with(context)
.setTag("StatusSummaryView")
.setLayout(mStatusSummaryView!!)

View File

@@ -20,7 +20,7 @@
android:id="@+id/clBoneBiz"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_309"
android:layout_marginTop="@dimen/dp_385"
android:layout_marginStart="@dimen/dp_19"
android:elevation="1dp"
app:layout_constraintLeft_toLeftOf="parent"
@@ -30,7 +30,7 @@
android:id="@+id/clBoneTab"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_309"
android:layout_marginTop="@dimen/dp_385"
android:elevation="20dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -124,7 +124,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_39"
android:layout_marginEnd="@dimen/dp_23"
android:visibility="visible"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -134,7 +134,7 @@
android:layout_height="@dimen/dp_790"
android:layout_marginTop="@dimen/dp_39"
android:layout_marginEnd="@dimen/dp_4"
android:visibility="visible"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />