diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt index 148b66816f..f84134d115 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt @@ -36,7 +36,6 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.MsgCategory import com.mogo.eagle.core.data.msgbox.RecordBagMsg import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatisticsListener 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 @@ -84,7 +83,7 @@ import kotlin.math.abs internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordListener, IMoGoChassisLocationGCJ02Listener, IMsgBoxListener, IMoGoDevaToolsListener, IMogoStatusChangedListener, IMoGoMapScreenListener , IMoGoFsm2024Listener, - IMoGoAutopilotStatisticsListener, IMoGoChassisStatesListener, IMoGoAutopilotStatusListener, + IMoGoChassisStatesListener, IMoGoAutopilotStatusListener, IDataCenterBizListener { const val TAG = "BadCase" @@ -127,7 +126,6 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis .registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this) if(ProjectUtils.isSaas()){ // CallerFsm2024ListenerManager.addListener(TAG,this) - CallerAutopilotStatisticsListenerManager.addListener(TAG,this) CallerDataCenterBizListener.addListener(TAG,this) CallerAutoPilotStatusListenerManager.addListener("RecordViewManager",this) CallerChassisStatesListenerManager.addListener(TAG,this) @@ -601,36 +599,6 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis // } } - /** - * 启动自动驾驶状态统计 - * 触发机制:下发启动自动驾驶命令,根据MAP返回状态判断成功或失败 - * 统计四种状态:成功 失败 取消 超时 - * @param statistics 统计数据 - */ - override fun onAutopilotStatistics(statistics: AutopilotStatistics?) { - statistics?.let { - Log.i(TAG,"onAutopilotStatistics status = "+ it.status) -// if(it.status == AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED){ - //触发一键上报 -// ThreadUtils.runOnUiThread{ -// val activity = AppStateManager.currentActivity() -// if (activity !is AppCompatActivity) { -// return@runOnUiThread -// } -// if(reportTypeWindow == null){ -// reportTypeWindow = ReportTypeWindow(activity) -// reportTypeWindow?.setClickListener(object: ReportTypeWindow.ClickListener{ -// override fun closeWindow() { -// reportTypeWindow?.hideFloatWindow() -// reportTypeWindow = null -// } -// }) -// } -// reportTypeWindow?.showOneClickReportWindow(xPosition,yPosition) -// } -// } - } - } /** * 刹车 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneTabLayout.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneTabLayout.kt index b0ddf476d8..b82c3296c9 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneTabLayout.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneTabLayout.kt @@ -153,6 +153,7 @@ class BoneTabLayout @JvmOverloads constructor( reportTypeView.showTypeSelectView() } else { reportTypeView.visibility = GONE + reportTypeView.hideTypeSelectView() } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/ReportTypeView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/ReportTypeView.kt index 6639288af8..82065a2c01 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/ReportTypeView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/ReportTypeView.kt @@ -6,6 +6,7 @@ import android.os.Handler import android.os.Looper import android.os.SystemClock import android.util.AttributeSet +import android.util.Log import android.view.LayoutInflater import android.view.View import androidx.constraintlayout.widget.ConstraintLayout @@ -20,17 +21,18 @@ 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.autopilot.IMoGoAutopilotStatisticsListener 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.CallerAutopilotStatisticsListenerManager 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 import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.TimeUtils.millis2String import com.mogo.eagle.core.utilcode.util.ToastUtils +import com.zhjt.mogo.adas.data.bean.AutopilotStatistics import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig import kotlinx.android.synthetic.main.view_report_type.view.ivOneClickReport import kotlinx.android.synthetic.main.view_report_type.view.oneClickGroup @@ -52,11 +54,10 @@ class ReportTypeView @JvmOverloads constructor( attrs: AttributeSet? = null, defStyleAttr: Int = 0 ) : ConstraintLayout(context, attrs, defStyleAttr), - IMoGoDevaToolsListener { + IMoGoDevaToolsListener, IMoGoAutopilotStatisticsListener { private val TAG = "ReportTypeView" - private var isOneClickType: Boolean = false //是否是一键上报类型 private var hasReportOperate: Boolean = false //是否点击了一键上报按钮 private var oneClickTimer: CountDownTimer?= null @@ -74,6 +75,7 @@ class ReportTypeView @JvmOverloads constructor( private var level: Int = 1 private var canOneReport: Boolean = false //是否可以一键上报 + private var typeSelectStatus: Boolean = false //当前视图是否是类型选择视图 init { LayoutInflater.from(context).inflate(R.layout.view_report_type, this, true) @@ -81,12 +83,6 @@ class ReportTypeView @JvmOverloads constructor( } private fun initView(){ - CallerDevaToolsListenerManager.addListener(TAG, this) - if(isOneClickType){ - showOneCLickReportView() - }else{ - showTypeSelectView() - } //一键上报 ivOneClickReport.setOnClickListener { if(!canOneReport){ @@ -156,14 +152,28 @@ class ReportTypeView @JvmOverloads constructor( } } + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerDevaToolsListenerManager.addListener(TAG, this) + CallerAutopilotStatisticsListenerManager.addListener(TAG,this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerDevaToolsListenerManager.removeListener(TAG) + CallerAutopilotStatisticsListenerManager.removeListener(TAG) + } + /** * 展示一键上报视图 */ private fun showOneCLickReportView(){ + this@ReportTypeView.visibility = View.VISIBLE oneClickGroup.visibility = View.VISIBLE reportTypeGroup.visibility = View.GONE tvReportSuccess.visibility = View.GONE tvOneClickReportTitle.text = String.format(resources.getString(R.string.identified_vehicle_malfunction),5) + oneClickTimer?.cancel() oneClickTimer = object : CountDownTimer(5000, 1000) { override fun onTick(count: Long) { ThreadUtils.runOnUiThread { @@ -176,7 +186,6 @@ class ReportTypeView @JvmOverloads constructor( if(!hasReportOperate){ ThreadUtils.runOnUiThread { this@ReportTypeView.visibility = View.GONE - clickListener?.closeReportView() } } } @@ -191,6 +200,15 @@ class ReportTypeView @JvmOverloads constructor( oneClickGroup.visibility = View.GONE reportTypeGroup.visibility = View.VISIBLE tvReportSuccess.visibility = View.GONE + oneClickTimer?.cancel() + typeSelectStatus = true + } + + /** + * 隐藏类型选择视图 + */ + fun hideTypeSelectView(){ + typeSelectStatus = false } /** @@ -267,4 +285,24 @@ class ReportTypeView @JvmOverloads constructor( this.clickListener = clickListener } + /** + * 启动自动驾驶状态统计 + * 触发机制:下发启动自动驾驶命令,根据MAP返回状态判断成功或失败 + * 统计四种状态:成功 失败 取消 超时 + * @param statistics 统计数据 + */ + override fun onAutopilotStatistics(statistics: AutopilotStatistics?) { + statistics?.let{ + Log.i(TAG,"onAutopilotStatistics status = "+ it.status) + if(it.status == AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED){ + //触发一键上报 + ThreadUtils.runOnUiThread { + if(!typeSelectStatus){ + showOneCLickReportView() + } + } + } + } + } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_tab.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_tab.xml index da9590293b..b5e58fd049 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_tab.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_tab.xml @@ -33,18 +33,6 @@ app:layout_constraintTop_toTopOf="parent" /> - - + + +