[opt3.0]fix删除Bag包列表偶现ConcurrentModificationException问题
This commit is contained in:
@@ -61,6 +61,8 @@ class BadCaseManagerView @JvmOverloads constructor(
|
||||
|
||||
private var isNameModify = false
|
||||
|
||||
private val deleteDataList: ArrayList<BagInfoEntity> = ArrayList()
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.layout_badcase_manager, this, true)
|
||||
initView()
|
||||
@@ -381,14 +383,23 @@ class BadCaseManagerView @JvmOverloads constructor(
|
||||
0 -> {
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶成功")
|
||||
}
|
||||
1 -> {
|
||||
//执行中
|
||||
}
|
||||
2 -> {
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶copy过程失败,原因:${bagManager.uploadCosResp.message}")
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶执行python失败")
|
||||
}
|
||||
3 -> {
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶合并过程失败,原因:${bagManager.uploadCosResp.message}")
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶拷贝过程失败")
|
||||
}
|
||||
4 -> {
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶上传过程失败,原因:${bagManager.uploadCosResp.message}")
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶合并过程失败")
|
||||
}
|
||||
5 -> {
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶上传过程失败")
|
||||
}
|
||||
else -> {
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶 ${bagManager.uploadCosResp.message}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,39 +415,55 @@ class BadCaseManagerView @JvmOverloads constructor(
|
||||
bagManagerList.remove(deleteBagInfo)
|
||||
//更新列表
|
||||
// bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
|
||||
if(bagManagerList.size>0){
|
||||
//继续执行删除命令
|
||||
bagManagerEntity.reqType = 4
|
||||
bagManagerEntity.keyReq = bagManagerList[0].key
|
||||
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
|
||||
}
|
||||
}
|
||||
}
|
||||
//遍历列表,如当天Bag全部删除,同时把日期标题也删除更新列表
|
||||
deleteDataList.clear()
|
||||
val titleIterator = bagManagerEntity.bagsInfoResp.iterator()
|
||||
while(titleIterator.hasNext()){
|
||||
val titleBagInfo = titleIterator.next()
|
||||
if(titleBagInfo.itemType == 1){
|
||||
val bagIterator = bagManagerEntity.bagsInfoResp.iterator()
|
||||
var hasBag = false
|
||||
var bagBagInfo: BagInfoEntity ?= null
|
||||
while(bagIterator.hasNext()){
|
||||
val bagBagInfo = bagIterator.next()
|
||||
bagBagInfo = bagIterator.next()
|
||||
if(bagBagInfo.itemType == 0){
|
||||
bagBagInfo.timestamp?.let {
|
||||
if(it.contains(titleBagInfo.timestamp.toString())){
|
||||
bagBagInfo.timestamp.let {
|
||||
if(it.contains(titleBagInfo.timestamp)){
|
||||
hasBag = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!hasBag){
|
||||
bagIterator.remove()
|
||||
// bagIterator.remove()
|
||||
titleBagInfo.let { deleteDataList.add(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(deleteDataList.isNotEmpty()){
|
||||
val deleteIterator = bagManagerEntity.bagsInfoResp.iterator()
|
||||
while(deleteIterator.hasNext()){
|
||||
val deleteInfo = deleteIterator.next()
|
||||
if(deleteDataList.contains(deleteInfo)){
|
||||
deleteIterator.remove()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(bagManagerList.size == 0){
|
||||
tvCancelSelect.performClick()
|
||||
}
|
||||
|
||||
if(bagManagerList.size>0){
|
||||
//继续执行删除命令
|
||||
bagManagerEntity.reqType = 4
|
||||
bagManagerEntity.keyReq = bagManagerList[0].key
|
||||
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
|
||||
}
|
||||
|
||||
//更新列表
|
||||
bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user