修复主动点击两次采集,出来两个弹窗后,在第2个弹窗点击上报,上报成功后,又收到回调和弹窗
This commit is contained in:
xuxinchao
2022-07-22 13:00:47 +08:00
parent 6993d5abe7
commit e33c8bb78d
2 changed files with 31 additions and 48 deletions

View File

@@ -19,6 +19,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.eagle.core.utilcode.util.AppUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils.millis2String
import com.zhjt.mogo_core_function_devatools.R
@@ -61,7 +62,9 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
private lateinit var tvCollectCancel: TextView //取消按钮
private var collectReason: String = "大型车:大货、大巴、特种车辆"
@Volatile
private var recordKey: String?=null //录制bag包key
@Volatile
private var recordFileName: String?=null //录制文件包名
private var longitude: Double?=null
private var latitude: Double?=null
@@ -108,9 +111,9 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
BadCaseConfig.windowNum++
tvCollectTime.text ="时间:${millis2String(System.currentTimeMillis(),TimeUtils.getHourMinSecondFormat())}"
//采集结果回调监听
CallerAutopilotRecordListenerManager.addListener(TAG,this)
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(),this)
// 添加 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
CallerAutopilotCarStatusListenerManager.addListener(this.hashCode().toString(), this)
//开始录制AI数据采集Bag包
CallerAutoPilotManager.recordPackage(
99,
@@ -265,28 +268,16 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
override fun onAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) {
CallerLogger.d("${M_DEVA}${TAG}", "-- 收到工控机录制任务回调 -- $recordPanel")
if(recordKey==null){
recordKey = recordPanel.key.toString()
BadCaseConfig.recordKeyList.add(recordPanel.key)
}
if(recordFileName==null){
recordFileName = recordPanel.filename
ThreadUtils.runOnUiThread{
if(recordKey==null){
recordKey = recordPanel.key.toString()
BadCaseConfig.recordKeyList.add(recordPanel.key)
}
if(recordFileName==null){
recordFileName = recordPanel.filename
}
}
// when(recordPanel.stat){
// 100, 101 ->{
// //成功结束录制
// TipToast.shortTip("${millis2String(System.currentTimeMillis(),TimeUtils.getHourMinSecondFormat())}:bag录制成功")
// }
// 300 ->{
// //开始录制
//
// }
// 200 ->{
// //录制失败
// TipToast.shortTip("${millis2String(System.currentTimeMillis(),TimeUtils.getHourMinSecondFormat())}:bag录制失败")
// }
// }
}
private fun setRadioButtonStatus(largeCarStatus: Boolean,trafficLightStatus: Boolean,waterStatus: Boolean,
@@ -338,9 +329,9 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
fun hideFloatWindow() {
//注销采集结果回调监听
CallerAutopilotRecordListenerManager.removeListener(TAG)
CallerAutopilotRecordListenerManager.removeListener(this.hashCode().toString())
// 移除 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
CallerAutopilotCarStatusListenerManager.removeListener(this.hashCode().toString())
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
}

View File

@@ -22,6 +22,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.eagle.core.utilcode.util.AppUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils.millis2String
import com.zhidao.loglib.call.LogInfoManagerFactory
@@ -78,7 +79,9 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
private var audioFileName:String?=null //录音文件名称
private var uploadReason: StringBuilder = StringBuilder() //上报原因,标签
@Volatile
private var recordKey: String?=null //录制bag包key
@Volatile
private var recordFileName: String?=null //录制文件包名
private var longitude: Double?=null
private var latitude: Double?=null
@@ -130,9 +133,9 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
tvInitiativeIdentity.text = "身份:${BadCaseConfig.identity}"
//采集结果回调监听
CallerAutopilotRecordListenerManager.addListener(TAG,this)
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(),this)
// 添加 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
CallerAutopilotCarStatusListenerManager.addListener(this.hashCode().toString(), this)
//开启录包
CallerAutoPilotManager.recordPackage(BadCaseConfig.type,
Random(SystemClock.elapsedRealtime()).nextInt(),
@@ -329,9 +332,9 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
fun hideFloatWindow() {
//注销采集结果回调监听
CallerAutopilotRecordListenerManager.removeListener(TAG)
CallerAutopilotRecordListenerManager.removeListener(this.hashCode().toString())
// 移除 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
CallerAutopilotCarStatusListenerManager.removeListener(this.hashCode().toString())
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
}
@@ -356,27 +359,16 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
override fun onAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) {
CallerLogger.d("${M_DEVA}${TAG}", "-- 收到工控机录制任务回调 -- $recordPanel")
if(recordKey==null){
recordKey = recordPanel.key.toString()
BadCaseConfig.recordKeyList.add(recordPanel.key)
ThreadUtils.runOnUiThread {
if(recordKey==null){
recordKey = recordPanel.key.toString()
BadCaseConfig.recordKeyList.add(recordPanel.key)
}
if(recordFileName==null){
recordFileName = recordPanel.filename
}
}
if(recordFileName==null){
recordFileName = recordPanel.filename
}
// when(recordPanel.stat){
// 100, 101 ->{
// //成功结束录制
// TipToast.shortTip("${millis2String(System.currentTimeMillis(),TimeUtils.getHourMinSecondFormat())}:bag录制成功")
// }
// 300 ->{
// //开始录制
//
// }
// 200 ->{
// //录制失败
// TipToast.shortTip("${millis2String(System.currentTimeMillis(),TimeUtils.getHourMinSecondFormat())}:bag录制失败")
// }
// }
}
fun setClickListener(clickListener: ClickListener) {