diff --git a/app/src/main/java/com/casic/br/app/view/StartCheckByYoloActivity.kt b/app/src/main/java/com/casic/br/app/view/StartCheckByYoloActivity.kt index 05adca1..dbf6c4b 100644 --- a/app/src/main/java/com/casic/br/app/view/StartCheckByYoloActivity.kt +++ b/app/src/main/java/com/casic/br/app/view/StartCheckByYoloActivity.kt @@ -65,6 +65,7 @@ private val locationManager by lazy { LocationManager(this) } private val targetSet by lazy { HashSet() } private val detectedSceneSet by lazy { HashSet() } + private val detectedTargetSet by lazy { HashSet() } private val yolov8ncnn by lazy { Yolov8ncnn() } private val weakReferenceHandler by lazy { WeakReferenceHandler(this) } private val detectResultDialog by lazy { DetectResultDialog(this) } @@ -457,6 +458,7 @@ if (warnings == "") { return } + //显示弹框 val message = weakReferenceHandler.obtainMessage() message.what = 2024082902 @@ -527,16 +529,23 @@ binding.tipsTagView.visibility = View.VISIBLE binding.tipsTagView.text = "${targetSet.size}" + val target = msg.obj as String + if (detectedTargetSet.contains(target)) { + "该目标/隐患已识别过".show(this) + return true + } + //弹框 if (detectResultDialog.isShowing) { return true } if (mat.width() > 0 || mat.height() > 0) { - detectResultDialog.updateDialogContentView("${msg.obj}", mat, + detectResultDialog.updateDialogContentView(target, mat, object : DetectResultDialog.OnDialogButtonClickListener { override fun onConfirmClick(file: File) { imageFileViewModel.uploadImage(file) + detectedTargetSet.add(target) } }).show() }