[6.7.0]修改一键上报

This commit is contained in:
xuxinchao
2024-09-29 14:44:10 +08:00
parent 145b7d40f8
commit 81a2643a4e
4 changed files with 65 additions and 56 deletions

View File

@@ -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)
// }
// }
}
}
/**
* 刹车

View File

@@ -153,6 +153,7 @@ class BoneTabLayout @JvmOverloads constructor(
reportTypeView.showTypeSelectView()
} else {
reportTypeView.visibility = GONE
reportTypeView.hideTypeSelectView()
}
}

View File

@@ -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()
}
}
}
}
}
}

View File

@@ -33,18 +33,6 @@
app:layout_constraintTop_toTopOf="parent"
/>
<com.mogo.eagle.core.function.hmi.bone.tab.ReportTypeView
android:id="@+id/reportTypeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginStart="@dimen/dp_270"
android:layout_marginBottom="@dimen/dp_170"
/>
<com.mogo.eagle.core.function.hmi.bone.tab.FaultReasonView
android:id="@+id/faultReasonView"
android:layout_width="@dimen/dp_960"
@@ -76,6 +64,20 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.eagle.core.function.hmi.bone.tab.ReportTypeView
android:id="@+id/reportTypeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginStart="@dimen/dp_270"
android:layout_marginBottom="@dimen/dp_170"
android:elevation="@dimen/dp_100"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout