diff --git a/app/build.gradle b/app/build.gradle index 04d8402..b861428 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,6 +6,15 @@ apply plugin: 'org.greenrobot.greendao' android { + signingConfigs { + release { + storeFile file('/Users/a203/Desktop/AndroidProjects/CommonDetector/app/Detector.jks') + storePassword '123456789' + keyAlias 'key0' + keyPassword '123456789' + } + } + compileSdkVersion 32 defaultConfig { diff --git a/app/build.gradle b/app/build.gradle index 04d8402..b861428 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,6 +6,15 @@ apply plugin: 'org.greenrobot.greendao' android { + signingConfigs { + release { + storeFile file('/Users/a203/Desktop/AndroidProjects/CommonDetector/app/Detector.jks') + storePassword '123456789' + keyAlias 'key0' + keyPassword '123456789' + } + } + compileSdkVersion 32 defaultConfig { diff --git a/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt b/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt index 2e4c7b8..6307cec 100644 --- a/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt +++ b/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt @@ -115,18 +115,10 @@ val result = DataBaseManager.get.queryLabelById(identifierId) if (result.isNotEmpty()) { val tag = when (result.first().identifierType) { - "EM30" -> { - "7" - } - "EM50" -> { - "8" - } - "EM14" -> { - "9" - } - else -> { - "1" - } + "EM30" -> "7" + "EM50" -> "8" + "EM14" -> "9" + else -> "1" } if (tag == "1") { "此标识器无法读取埋深!".show(this) @@ -189,6 +181,20 @@ energy = 50 } + if (energy > 14) { + depthButton.isEnabled = true + degreeButton.isEnabled = true + + searchResultView.text = "已搜索到标识器" + searchResultView.setTextColor(Color.RED) + } else { + depthButton.isEnabled = false + degreeButton.isEnabled = false + + searchResultView.text = "标识器搜索中" + searchResultView.setTextColor(Color.WHITE) + } + if (energy > 41) { isPlaying = if (!isPlaying) { fastSoundPool.play(fastResId, 1f, 1f, 0, 0, 1f) @@ -207,19 +213,15 @@ } } - if (energy < 11) { + if (energy < 11) {//40° energyTipsView.text = "标识器信号较弱,可能距离较远" energyTipsView.setTextColor(Color.RED) - } else if (energy > 41) { + //重新测试更精确的能量值,不让测距 + } else if (energy > 41) {//150° energyTipsView.text = "标识器信号极强,可能就在附近" energyTipsView.setTextColor(Color.GREEN) - - searchResultView.text = "已搜索到标识器" - searchResultView.setTextColor(Color.RED) - depthButton.isEnabled = true - degreeButton.isEnabled = true - } else { - energyTipsView.text = "标识器信号不稳定,请继续移动位置" + } else {//[40°,150°] + energyTipsView.text = "标识器器信号波动,请继续移动位置" energyTipsView.setTextColor(Color.YELLOW) } @@ -262,14 +264,17 @@ e.printStackTrace() } } else { - identifierId = hex.substring(0, 20).hexToString() + val identifierId = hex.substring(0, 20).hexToString() val regex = "^[a-z0-9A-Z]+$" if (identifierId.matches(Regex(regex))) { + this.identifierId = identifierId + //自动上传标识器 taskLabel = DataBaseManager.get.queryTaskLabelByIdAndState(identifierId, "未开始") if (taskLabel != null) { - val userName = - SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + val userName = SaveKeyValues.getValue( + LocaleConstant.USER_NAME, "" + ) as String taskViewModel.uploadMarker(userName, identifierId) } }