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 7c34acf..8a95734 100644 --- a/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt +++ b/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt @@ -179,7 +179,7 @@ energy = 50 } - if (energy > 6) { + if (energy >= 5) { depthButton.isEnabled = true depthButton.setTextColor(Color.WHITE) depthButton.setBackgroundResource(R.mipmap.left_button_enable) @@ -188,8 +188,8 @@ degreeButton.setBackgroundResource(R.mipmap.right_button_enable) searchResultView.text = "已检测到标识器" - searchResultView.setTextColor(Color.parseColor("#8C5700")) - searchResultView.setBackgroundResource(R.mipmap.bg_small_text_yellow) + searchResultView.setTextColor(Color.parseColor("#428d00")) + searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) } else { depthButton.isEnabled = false depthButton.setTextColor(Color.parseColor("#CCCCCC")) @@ -203,7 +203,7 @@ searchResultView.setBackgroundResource(R.mipmap.bg_small_text_red) } - if (energy > 41) { + if (energy >= 41) { isPlaying = if (!isPlaying) { fastSoundPool.play(fastResId, 1f, 1f, 0, 0, 1f) true @@ -211,7 +211,7 @@ fastSoundPool.stop(fastResId) false } - } else if (energy in 6..41) { + } else { isPlaying = if (!isPlaying) { slowSoundPool.play(slowResId, 1f, 1f, 0, 0, 1f) true @@ -221,20 +221,18 @@ } } - if (energy < 6) {//47° + if (energy <= 13) {//18° energyTipsView.text = "标识器信号较弱,可能距离较远" - } else if (energy > 41) {//148° - energyTipsView.text = "标识器信号极强,可能在正下方" - } else {//[47°,148°] - energyTipsView.text = "已靠近标识器,请继续移动位置" - } - - if (energy < 6) { energyTipsView.setTextColor(Color.parseColor("#8D1717")) - energyTipsView.setBackgroundResource(R.mipmap.bg_small_text_red) - } else { + energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) + } else if (energy >= 41) {//148° + energyTipsView.text = "标识器信号极强,可能在正下方" + energyTipsView.setTextColor(Color.parseColor("#428d00")) + energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) + } else {//[18°,148°] + energyTipsView.text = "已靠近标识器,请继续移动位置" energyTipsView.setTextColor(Color.parseColor("#8C5700")) - energyTipsView.setBackgroundResource(R.mipmap.bg_small_text_yellow) + energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) } //转换为转动的角度 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 7c34acf..8a95734 100644 --- a/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt +++ b/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt @@ -179,7 +179,7 @@ energy = 50 } - if (energy > 6) { + if (energy >= 5) { depthButton.isEnabled = true depthButton.setTextColor(Color.WHITE) depthButton.setBackgroundResource(R.mipmap.left_button_enable) @@ -188,8 +188,8 @@ degreeButton.setBackgroundResource(R.mipmap.right_button_enable) searchResultView.text = "已检测到标识器" - searchResultView.setTextColor(Color.parseColor("#8C5700")) - searchResultView.setBackgroundResource(R.mipmap.bg_small_text_yellow) + searchResultView.setTextColor(Color.parseColor("#428d00")) + searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) } else { depthButton.isEnabled = false depthButton.setTextColor(Color.parseColor("#CCCCCC")) @@ -203,7 +203,7 @@ searchResultView.setBackgroundResource(R.mipmap.bg_small_text_red) } - if (energy > 41) { + if (energy >= 41) { isPlaying = if (!isPlaying) { fastSoundPool.play(fastResId, 1f, 1f, 0, 0, 1f) true @@ -211,7 +211,7 @@ fastSoundPool.stop(fastResId) false } - } else if (energy in 6..41) { + } else { isPlaying = if (!isPlaying) { slowSoundPool.play(slowResId, 1f, 1f, 0, 0, 1f) true @@ -221,20 +221,18 @@ } } - if (energy < 6) {//47° + if (energy <= 13) {//18° energyTipsView.text = "标识器信号较弱,可能距离较远" - } else if (energy > 41) {//148° - energyTipsView.text = "标识器信号极强,可能在正下方" - } else {//[47°,148°] - energyTipsView.text = "已靠近标识器,请继续移动位置" - } - - if (energy < 6) { energyTipsView.setTextColor(Color.parseColor("#8D1717")) - energyTipsView.setBackgroundResource(R.mipmap.bg_small_text_red) - } else { + energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) + } else if (energy >= 41) {//148° + energyTipsView.text = "标识器信号极强,可能在正下方" + energyTipsView.setTextColor(Color.parseColor("#428d00")) + energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) + } else {//[18°,148°] + energyTipsView.text = "已靠近标识器,请继续移动位置" energyTipsView.setTextColor(Color.parseColor("#8C5700")) - energyTipsView.setBackgroundResource(R.mipmap.bg_small_text_yellow) + energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) } //转换为转动的角度 diff --git a/app/src/main/res/layout/activity_search_label.xml b/app/src/main/res/layout/activity_search_label.xml index bf9c019..a3fc530 100644 --- a/app/src/main/res/layout/activity_search_label.xml +++ b/app/src/main/res/layout/activity_search_label.xml @@ -29,11 +29,11 @@ android:background="@mipmap/center_screen"> + android:orientation="vertical"> + android:textSize="28sp" /> + android:textSize="@dimen/sp_20" /> 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 7c34acf..8a95734 100644 --- a/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt +++ b/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt @@ -179,7 +179,7 @@ energy = 50 } - if (energy > 6) { + if (energy >= 5) { depthButton.isEnabled = true depthButton.setTextColor(Color.WHITE) depthButton.setBackgroundResource(R.mipmap.left_button_enable) @@ -188,8 +188,8 @@ degreeButton.setBackgroundResource(R.mipmap.right_button_enable) searchResultView.text = "已检测到标识器" - searchResultView.setTextColor(Color.parseColor("#8C5700")) - searchResultView.setBackgroundResource(R.mipmap.bg_small_text_yellow) + searchResultView.setTextColor(Color.parseColor("#428d00")) + searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) } else { depthButton.isEnabled = false depthButton.setTextColor(Color.parseColor("#CCCCCC")) @@ -203,7 +203,7 @@ searchResultView.setBackgroundResource(R.mipmap.bg_small_text_red) } - if (energy > 41) { + if (energy >= 41) { isPlaying = if (!isPlaying) { fastSoundPool.play(fastResId, 1f, 1f, 0, 0, 1f) true @@ -211,7 +211,7 @@ fastSoundPool.stop(fastResId) false } - } else if (energy in 6..41) { + } else { isPlaying = if (!isPlaying) { slowSoundPool.play(slowResId, 1f, 1f, 0, 0, 1f) true @@ -221,20 +221,18 @@ } } - if (energy < 6) {//47° + if (energy <= 13) {//18° energyTipsView.text = "标识器信号较弱,可能距离较远" - } else if (energy > 41) {//148° - energyTipsView.text = "标识器信号极强,可能在正下方" - } else {//[47°,148°] - energyTipsView.text = "已靠近标识器,请继续移动位置" - } - - if (energy < 6) { energyTipsView.setTextColor(Color.parseColor("#8D1717")) - energyTipsView.setBackgroundResource(R.mipmap.bg_small_text_red) - } else { + energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) + } else if (energy >= 41) {//148° + energyTipsView.text = "标识器信号极强,可能在正下方" + energyTipsView.setTextColor(Color.parseColor("#428d00")) + energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) + } else {//[18°,148°] + energyTipsView.text = "已靠近标识器,请继续移动位置" energyTipsView.setTextColor(Color.parseColor("#8C5700")) - energyTipsView.setBackgroundResource(R.mipmap.bg_small_text_yellow) + energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) } //转换为转动的角度 diff --git a/app/src/main/res/layout/activity_search_label.xml b/app/src/main/res/layout/activity_search_label.xml index bf9c019..a3fc530 100644 --- a/app/src/main/res/layout/activity_search_label.xml +++ b/app/src/main/res/layout/activity_search_label.xml @@ -29,11 +29,11 @@ android:background="@mipmap/center_screen"> + android:orientation="vertical"> + android:textSize="28sp" /> + android:textSize="@dimen/sp_20" /> diff --git a/app/src/main/res/mipmap-xhdpi/bg_large_text_green.png b/app/src/main/res/mipmap-xhdpi/bg_large_text_green.png new file mode 100644 index 0000000..0009a2e --- /dev/null +++ b/app/src/main/res/mipmap-xhdpi/bg_large_text_green.png Binary files differ 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 7c34acf..8a95734 100644 --- a/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt +++ b/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt @@ -179,7 +179,7 @@ energy = 50 } - if (energy > 6) { + if (energy >= 5) { depthButton.isEnabled = true depthButton.setTextColor(Color.WHITE) depthButton.setBackgroundResource(R.mipmap.left_button_enable) @@ -188,8 +188,8 @@ degreeButton.setBackgroundResource(R.mipmap.right_button_enable) searchResultView.text = "已检测到标识器" - searchResultView.setTextColor(Color.parseColor("#8C5700")) - searchResultView.setBackgroundResource(R.mipmap.bg_small_text_yellow) + searchResultView.setTextColor(Color.parseColor("#428d00")) + searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) } else { depthButton.isEnabled = false depthButton.setTextColor(Color.parseColor("#CCCCCC")) @@ -203,7 +203,7 @@ searchResultView.setBackgroundResource(R.mipmap.bg_small_text_red) } - if (energy > 41) { + if (energy >= 41) { isPlaying = if (!isPlaying) { fastSoundPool.play(fastResId, 1f, 1f, 0, 0, 1f) true @@ -211,7 +211,7 @@ fastSoundPool.stop(fastResId) false } - } else if (energy in 6..41) { + } else { isPlaying = if (!isPlaying) { slowSoundPool.play(slowResId, 1f, 1f, 0, 0, 1f) true @@ -221,20 +221,18 @@ } } - if (energy < 6) {//47° + if (energy <= 13) {//18° energyTipsView.text = "标识器信号较弱,可能距离较远" - } else if (energy > 41) {//148° - energyTipsView.text = "标识器信号极强,可能在正下方" - } else {//[47°,148°] - energyTipsView.text = "已靠近标识器,请继续移动位置" - } - - if (energy < 6) { energyTipsView.setTextColor(Color.parseColor("#8D1717")) - energyTipsView.setBackgroundResource(R.mipmap.bg_small_text_red) - } else { + energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) + } else if (energy >= 41) {//148° + energyTipsView.text = "标识器信号极强,可能在正下方" + energyTipsView.setTextColor(Color.parseColor("#428d00")) + energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) + } else {//[18°,148°] + energyTipsView.text = "已靠近标识器,请继续移动位置" energyTipsView.setTextColor(Color.parseColor("#8C5700")) - energyTipsView.setBackgroundResource(R.mipmap.bg_small_text_yellow) + energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) } //转换为转动的角度 diff --git a/app/src/main/res/layout/activity_search_label.xml b/app/src/main/res/layout/activity_search_label.xml index bf9c019..a3fc530 100644 --- a/app/src/main/res/layout/activity_search_label.xml +++ b/app/src/main/res/layout/activity_search_label.xml @@ -29,11 +29,11 @@ android:background="@mipmap/center_screen"> + android:orientation="vertical"> + android:textSize="28sp" /> + android:textSize="@dimen/sp_20" /> diff --git a/app/src/main/res/mipmap-xhdpi/bg_large_text_green.png b/app/src/main/res/mipmap-xhdpi/bg_large_text_green.png new file mode 100644 index 0000000..0009a2e --- /dev/null +++ b/app/src/main/res/mipmap-xhdpi/bg_large_text_green.png Binary files differ diff --git a/app/src/main/res/mipmap-xhdpi/bg_small_text_green.png b/app/src/main/res/mipmap-xhdpi/bg_small_text_green.png new file mode 100644 index 0000000..019f0f5 --- /dev/null +++ b/app/src/main/res/mipmap-xhdpi/bg_small_text_green.png Binary files differ