diff --git a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt index dd6f28d..497f4bd 100644 --- a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt @@ -98,6 +98,22 @@ return taskBeanDao.queryBuilder().where(TaskBeanDao.Properties.TaskId.eq(taskId)).list() } + fun queryTaskLabelByIdAndState(identifierId: String, state: String): TaskBean? { + return taskBeanDao.queryBuilder() + .where( + TaskBeanDao.Properties.MarkerRealId.eq(identifierId), + TaskBeanDao.Properties.State.eq(state) + ).list().firstOrNull() + } + + fun updateTaskLabel(taskBean: TaskBean?) { + if (taskBean == null) { + return + } + taskBean.state = "已探测" + taskBeanDao.update(taskBean) + } + fun deleteTaskById(taskId: String?) { if (taskId.isNullOrBlank()) { return diff --git a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt index dd6f28d..497f4bd 100644 --- a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt @@ -98,6 +98,22 @@ return taskBeanDao.queryBuilder().where(TaskBeanDao.Properties.TaskId.eq(taskId)).list() } + fun queryTaskLabelByIdAndState(identifierId: String, state: String): TaskBean? { + return taskBeanDao.queryBuilder() + .where( + TaskBeanDao.Properties.MarkerRealId.eq(identifierId), + TaskBeanDao.Properties.State.eq(state) + ).list().firstOrNull() + } + + fun updateTaskLabel(taskBean: TaskBean?) { + if (taskBean == null) { + return + } + taskBean.state = "已探测" + taskBeanDao.update(taskBean) + } + fun deleteTaskById(taskId: String?) { if (taskId.isNullOrBlank()) { return 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 8eeb2bc..75249d4 100644 --- a/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt +++ b/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt @@ -8,19 +8,25 @@ import android.os.Message import android.view.animation.Animation import android.view.animation.RotateAnimation +import androidx.lifecycle.ViewModelProvider import com.casic.detector.R import com.casic.detector.base.SerialPortActivity +import com.casic.detector.bean.TaskBean import com.casic.detector.extensions.hexToString import com.casic.detector.extensions.initLayoutImmersionBar import com.casic.detector.extensions.toHex import com.casic.detector.utils.DataBaseManager import com.casic.detector.utils.GpioManager import com.casic.detector.utils.LoadingDialogHub +import com.casic.detector.utils.LocaleConstant +import com.casic.detector.vm.TaskViewModel import com.gyf.immersionbar.ImmersionBar import com.pengxh.kt.lite.extensions.navigatePageTo import com.pengxh.kt.lite.extensions.show import com.pengxh.kt.lite.extensions.toJson +import com.pengxh.kt.lite.utils.SaveKeyValues import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState import com.pengxh.kt.lite.widget.dialog.AlertMessageDialog import kotlinx.android.synthetic.main.activity_search_label.* import java.io.IOException @@ -30,54 +36,41 @@ class SearchLabelActivity : SerialPortActivity(), Handler.Callback { private val kTag = "SearchLabelActivity" - private lateinit var soundPool: SoundPool - private lateinit var mediumSoundPool: SoundPool + private lateinit var slowSoundPool: SoundPool private lateinit var fastSoundPool: SoundPool - private var soundResId = 0 - private var mediumResId = 0 + private var slowResId = 0 private var fastResId = 0 private val gpioManager by lazy { GpioManager() } private lateinit var weakReferenceHandler: WeakReferenceHandler private val timer by lazy { Timer() } private val decimal by lazy { DecimalFormat("#.0") } - private var isDetectDepth = false private var identifierId = "" private val lastDegreeMap by lazy { HashMap() } + private var isPlaying = false + private var isDetectDepth = false + private lateinit var taskViewModel: TaskViewModel + private var taskLabel: TaskBean? = null override fun initData(savedInstanceState: Bundle?) { gpioManager.setGpioHigh("18") - + //角度 + lastDegreeMap["lastDegree"] = 0f weakReferenceHandler = WeakReferenceHandler(this) + taskViewModel = ViewModelProvider(this)[TaskViewModel::class.java] - /** - * maxStreams:最大同时支持音频播放数; - * streamType:音频流类型,一般为AudioManager.STREAM_MUSIC; - * srcQuality:采样的转换的质量,目前没有作用,以0为默认值。 - * 在版本为21以上时,推荐使用Builder去构建SoundPool,默认的构造方法已经过时。 - * */ val audioAttributes = AudioAttributes.Builder() .setUsage(AudioAttributes.USAGE_MEDIA) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) .build() - soundPool = SoundPool.Builder() - .setMaxStreams(16) - .setAudioAttributes(audioAttributes) - .build() /** * 声音效果速度 * ling - soundPool.play(soundResId, 1f, 1f, 0, -1, 1f) - } - - //能量值音频 - mediumSoundPool = SoundPool.Builder() + slowSoundPool = SoundPool.Builder() .setMaxStreams(16) .setAudioAttributes(audioAttributes) .build() - mediumResId = mediumSoundPool.load(this, R.raw.ring4, 1) + slowResId = slowSoundPool.load(this, R.raw.ring4, 1) fastSoundPool = SoundPool.Builder() .setMaxStreams(16) @@ -85,9 +78,6 @@ .build() fastResId = fastSoundPool.load(this, R.raw.ring2, 1) - //角度 - lastDegreeMap["lastDegree"] = 0f - //搜索信号 timer.schedule(object : TimerTask() { override fun run() { @@ -100,7 +90,7 @@ e.printStackTrace() } } - }, 150, 100) + }, 100, 150) //发送搜索能量指令 timer.schedule(object : TimerTask() { @@ -209,10 +199,10 @@ } } else { isPlaying = if (!isPlaying) { - mediumSoundPool.play(mediumResId, 1f, 1f, 0, 0, 1f) + slowSoundPool.play(slowResId, 1f, 1f, 0, 0, 1f) true } else { - mediumSoundPool.stop(mediumResId) + slowSoundPool.stop(slowResId) false } } @@ -223,6 +213,11 @@ } else if (energy > 40) { energyTipsView.text = "标识器信号极强,可能就在附近" energyTipsView.setTextColor(Color.GREEN) + + searchResultView.text = "已搜索到标识器" + searchResultView.setTextColor(Color.RED) + depthButton.isEnabled = true + degreeButton.isEnabled = true } else { energyTipsView.text = "标识器信号不稳定,请继续移动位置" energyTipsView.setTextColor(Color.YELLOW) @@ -270,24 +265,28 @@ identifierId = hex.substring(0, 20).hexToString() val regex = "^[a-z0-9A-Z]+$" if (identifierId.matches(Regex(regex))) { - searchResultView.text = "已搜索到标识器" - searchResultView.setTextColor(Color.RED) - depthButton.isEnabled = true - degreeButton.isEnabled = true - - soundPool.stop(soundResId) + //自动上传标识器 + taskLabel = DataBaseManager.get.queryTaskLabelByIdAndState(identifierId, "未开始") + if (taskLabel != null) { + val userName = + SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + taskViewModel.uploadMarker(userName, identifierId) + } } } } return true } - private var isPlaying = false - override fun initLayoutView(): Int = R.layout.activity_search_label override fun observeRequestState() { - + taskViewModel.loadState.observe(this) { + if (it == LoadState.Success) { + "标识器${identifierId}已探测!".show(this) + DataBaseManager.get.updateTaskLabel(taskLabel) + } + } } override fun setupTopBarLayout() { @@ -296,7 +295,6 @@ } override fun onDestroy() { - soundPool.stop(soundResId) gpioManager.setGpioLow("18") super.onDestroy() } diff --git a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt index dd6f28d..497f4bd 100644 --- a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt @@ -98,6 +98,22 @@ return taskBeanDao.queryBuilder().where(TaskBeanDao.Properties.TaskId.eq(taskId)).list() } + fun queryTaskLabelByIdAndState(identifierId: String, state: String): TaskBean? { + return taskBeanDao.queryBuilder() + .where( + TaskBeanDao.Properties.MarkerRealId.eq(identifierId), + TaskBeanDao.Properties.State.eq(state) + ).list().firstOrNull() + } + + fun updateTaskLabel(taskBean: TaskBean?) { + if (taskBean == null) { + return + } + taskBean.state = "已探测" + taskBeanDao.update(taskBean) + } + fun deleteTaskById(taskId: String?) { if (taskId.isNullOrBlank()) { return 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 8eeb2bc..75249d4 100644 --- a/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt +++ b/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt @@ -8,19 +8,25 @@ import android.os.Message import android.view.animation.Animation import android.view.animation.RotateAnimation +import androidx.lifecycle.ViewModelProvider import com.casic.detector.R import com.casic.detector.base.SerialPortActivity +import com.casic.detector.bean.TaskBean import com.casic.detector.extensions.hexToString import com.casic.detector.extensions.initLayoutImmersionBar import com.casic.detector.extensions.toHex import com.casic.detector.utils.DataBaseManager import com.casic.detector.utils.GpioManager import com.casic.detector.utils.LoadingDialogHub +import com.casic.detector.utils.LocaleConstant +import com.casic.detector.vm.TaskViewModel import com.gyf.immersionbar.ImmersionBar import com.pengxh.kt.lite.extensions.navigatePageTo import com.pengxh.kt.lite.extensions.show import com.pengxh.kt.lite.extensions.toJson +import com.pengxh.kt.lite.utils.SaveKeyValues import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState import com.pengxh.kt.lite.widget.dialog.AlertMessageDialog import kotlinx.android.synthetic.main.activity_search_label.* import java.io.IOException @@ -30,54 +36,41 @@ class SearchLabelActivity : SerialPortActivity(), Handler.Callback { private val kTag = "SearchLabelActivity" - private lateinit var soundPool: SoundPool - private lateinit var mediumSoundPool: SoundPool + private lateinit var slowSoundPool: SoundPool private lateinit var fastSoundPool: SoundPool - private var soundResId = 0 - private var mediumResId = 0 + private var slowResId = 0 private var fastResId = 0 private val gpioManager by lazy { GpioManager() } private lateinit var weakReferenceHandler: WeakReferenceHandler private val timer by lazy { Timer() } private val decimal by lazy { DecimalFormat("#.0") } - private var isDetectDepth = false private var identifierId = "" private val lastDegreeMap by lazy { HashMap() } + private var isPlaying = false + private var isDetectDepth = false + private lateinit var taskViewModel: TaskViewModel + private var taskLabel: TaskBean? = null override fun initData(savedInstanceState: Bundle?) { gpioManager.setGpioHigh("18") - + //角度 + lastDegreeMap["lastDegree"] = 0f weakReferenceHandler = WeakReferenceHandler(this) + taskViewModel = ViewModelProvider(this)[TaskViewModel::class.java] - /** - * maxStreams:最大同时支持音频播放数; - * streamType:音频流类型,一般为AudioManager.STREAM_MUSIC; - * srcQuality:采样的转换的质量,目前没有作用,以0为默认值。 - * 在版本为21以上时,推荐使用Builder去构建SoundPool,默认的构造方法已经过时。 - * */ val audioAttributes = AudioAttributes.Builder() .setUsage(AudioAttributes.USAGE_MEDIA) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) .build() - soundPool = SoundPool.Builder() - .setMaxStreams(16) - .setAudioAttributes(audioAttributes) - .build() /** * 声音效果速度 * ling - soundPool.play(soundResId, 1f, 1f, 0, -1, 1f) - } - - //能量值音频 - mediumSoundPool = SoundPool.Builder() + slowSoundPool = SoundPool.Builder() .setMaxStreams(16) .setAudioAttributes(audioAttributes) .build() - mediumResId = mediumSoundPool.load(this, R.raw.ring4, 1) + slowResId = slowSoundPool.load(this, R.raw.ring4, 1) fastSoundPool = SoundPool.Builder() .setMaxStreams(16) @@ -85,9 +78,6 @@ .build() fastResId = fastSoundPool.load(this, R.raw.ring2, 1) - //角度 - lastDegreeMap["lastDegree"] = 0f - //搜索信号 timer.schedule(object : TimerTask() { override fun run() { @@ -100,7 +90,7 @@ e.printStackTrace() } } - }, 150, 100) + }, 100, 150) //发送搜索能量指令 timer.schedule(object : TimerTask() { @@ -209,10 +199,10 @@ } } else { isPlaying = if (!isPlaying) { - mediumSoundPool.play(mediumResId, 1f, 1f, 0, 0, 1f) + slowSoundPool.play(slowResId, 1f, 1f, 0, 0, 1f) true } else { - mediumSoundPool.stop(mediumResId) + slowSoundPool.stop(slowResId) false } } @@ -223,6 +213,11 @@ } else if (energy > 40) { energyTipsView.text = "标识器信号极强,可能就在附近" energyTipsView.setTextColor(Color.GREEN) + + searchResultView.text = "已搜索到标识器" + searchResultView.setTextColor(Color.RED) + depthButton.isEnabled = true + degreeButton.isEnabled = true } else { energyTipsView.text = "标识器信号不稳定,请继续移动位置" energyTipsView.setTextColor(Color.YELLOW) @@ -270,24 +265,28 @@ identifierId = hex.substring(0, 20).hexToString() val regex = "^[a-z0-9A-Z]+$" if (identifierId.matches(Regex(regex))) { - searchResultView.text = "已搜索到标识器" - searchResultView.setTextColor(Color.RED) - depthButton.isEnabled = true - degreeButton.isEnabled = true - - soundPool.stop(soundResId) + //自动上传标识器 + taskLabel = DataBaseManager.get.queryTaskLabelByIdAndState(identifierId, "未开始") + if (taskLabel != null) { + val userName = + SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + taskViewModel.uploadMarker(userName, identifierId) + } } } } return true } - private var isPlaying = false - override fun initLayoutView(): Int = R.layout.activity_search_label override fun observeRequestState() { - + taskViewModel.loadState.observe(this) { + if (it == LoadState.Success) { + "标识器${identifierId}已探测!".show(this) + DataBaseManager.get.updateTaskLabel(taskLabel) + } + } } override fun setupTopBarLayout() { @@ -296,7 +295,6 @@ } override fun onDestroy() { - soundPool.stop(soundResId) gpioManager.setGpioLow("18") super.onDestroy() } diff --git a/app/src/main/java/com/casic/detector/vm/TaskViewModel.kt b/app/src/main/java/com/casic/detector/vm/TaskViewModel.kt index a81ad98..2716154 100644 --- a/app/src/main/java/com/casic/detector/vm/TaskViewModel.kt +++ b/app/src/main/java/com/casic/detector/vm/TaskViewModel.kt @@ -170,13 +170,16 @@ }) fun uploadMarker(userName: String, taskDetailId: String) = launch({ + loadState.value = LoadState.Loading val response = RetrofitServiceManager.uploadMarker(userName, taskDetailId) if (response.separateResponseState()) { - + loadState.value = LoadState.Success } else { + loadState.value = LoadState.Fail response.toErrorMessage().show(BaseApplication.get()) } }, { + loadState.value = LoadState.Fail it.convertChinese().show(BaseApplication.get()) }) } \ No newline at end of file diff --git a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt index dd6f28d..497f4bd 100644 --- a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt @@ -98,6 +98,22 @@ return taskBeanDao.queryBuilder().where(TaskBeanDao.Properties.TaskId.eq(taskId)).list() } + fun queryTaskLabelByIdAndState(identifierId: String, state: String): TaskBean? { + return taskBeanDao.queryBuilder() + .where( + TaskBeanDao.Properties.MarkerRealId.eq(identifierId), + TaskBeanDao.Properties.State.eq(state) + ).list().firstOrNull() + } + + fun updateTaskLabel(taskBean: TaskBean?) { + if (taskBean == null) { + return + } + taskBean.state = "已探测" + taskBeanDao.update(taskBean) + } + fun deleteTaskById(taskId: String?) { if (taskId.isNullOrBlank()) { return 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 8eeb2bc..75249d4 100644 --- a/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt +++ b/app/src/main/java/com/casic/detector/view/SearchLabelActivity.kt @@ -8,19 +8,25 @@ import android.os.Message import android.view.animation.Animation import android.view.animation.RotateAnimation +import androidx.lifecycle.ViewModelProvider import com.casic.detector.R import com.casic.detector.base.SerialPortActivity +import com.casic.detector.bean.TaskBean import com.casic.detector.extensions.hexToString import com.casic.detector.extensions.initLayoutImmersionBar import com.casic.detector.extensions.toHex import com.casic.detector.utils.DataBaseManager import com.casic.detector.utils.GpioManager import com.casic.detector.utils.LoadingDialogHub +import com.casic.detector.utils.LocaleConstant +import com.casic.detector.vm.TaskViewModel import com.gyf.immersionbar.ImmersionBar import com.pengxh.kt.lite.extensions.navigatePageTo import com.pengxh.kt.lite.extensions.show import com.pengxh.kt.lite.extensions.toJson +import com.pengxh.kt.lite.utils.SaveKeyValues import com.pengxh.kt.lite.utils.WeakReferenceHandler +import com.pengxh.kt.lite.vm.LoadState import com.pengxh.kt.lite.widget.dialog.AlertMessageDialog import kotlinx.android.synthetic.main.activity_search_label.* import java.io.IOException @@ -30,54 +36,41 @@ class SearchLabelActivity : SerialPortActivity(), Handler.Callback { private val kTag = "SearchLabelActivity" - private lateinit var soundPool: SoundPool - private lateinit var mediumSoundPool: SoundPool + private lateinit var slowSoundPool: SoundPool private lateinit var fastSoundPool: SoundPool - private var soundResId = 0 - private var mediumResId = 0 + private var slowResId = 0 private var fastResId = 0 private val gpioManager by lazy { GpioManager() } private lateinit var weakReferenceHandler: WeakReferenceHandler private val timer by lazy { Timer() } private val decimal by lazy { DecimalFormat("#.0") } - private var isDetectDepth = false private var identifierId = "" private val lastDegreeMap by lazy { HashMap() } + private var isPlaying = false + private var isDetectDepth = false + private lateinit var taskViewModel: TaskViewModel + private var taskLabel: TaskBean? = null override fun initData(savedInstanceState: Bundle?) { gpioManager.setGpioHigh("18") - + //角度 + lastDegreeMap["lastDegree"] = 0f weakReferenceHandler = WeakReferenceHandler(this) + taskViewModel = ViewModelProvider(this)[TaskViewModel::class.java] - /** - * maxStreams:最大同时支持音频播放数; - * streamType:音频流类型,一般为AudioManager.STREAM_MUSIC; - * srcQuality:采样的转换的质量,目前没有作用,以0为默认值。 - * 在版本为21以上时,推荐使用Builder去构建SoundPool,默认的构造方法已经过时。 - * */ val audioAttributes = AudioAttributes.Builder() .setUsage(AudioAttributes.USAGE_MEDIA) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) .build() - soundPool = SoundPool.Builder() - .setMaxStreams(16) - .setAudioAttributes(audioAttributes) - .build() /** * 声音效果速度 * ling - soundPool.play(soundResId, 1f, 1f, 0, -1, 1f) - } - - //能量值音频 - mediumSoundPool = SoundPool.Builder() + slowSoundPool = SoundPool.Builder() .setMaxStreams(16) .setAudioAttributes(audioAttributes) .build() - mediumResId = mediumSoundPool.load(this, R.raw.ring4, 1) + slowResId = slowSoundPool.load(this, R.raw.ring4, 1) fastSoundPool = SoundPool.Builder() .setMaxStreams(16) @@ -85,9 +78,6 @@ .build() fastResId = fastSoundPool.load(this, R.raw.ring2, 1) - //角度 - lastDegreeMap["lastDegree"] = 0f - //搜索信号 timer.schedule(object : TimerTask() { override fun run() { @@ -100,7 +90,7 @@ e.printStackTrace() } } - }, 150, 100) + }, 100, 150) //发送搜索能量指令 timer.schedule(object : TimerTask() { @@ -209,10 +199,10 @@ } } else { isPlaying = if (!isPlaying) { - mediumSoundPool.play(mediumResId, 1f, 1f, 0, 0, 1f) + slowSoundPool.play(slowResId, 1f, 1f, 0, 0, 1f) true } else { - mediumSoundPool.stop(mediumResId) + slowSoundPool.stop(slowResId) false } } @@ -223,6 +213,11 @@ } else if (energy > 40) { energyTipsView.text = "标识器信号极强,可能就在附近" energyTipsView.setTextColor(Color.GREEN) + + searchResultView.text = "已搜索到标识器" + searchResultView.setTextColor(Color.RED) + depthButton.isEnabled = true + degreeButton.isEnabled = true } else { energyTipsView.text = "标识器信号不稳定,请继续移动位置" energyTipsView.setTextColor(Color.YELLOW) @@ -270,24 +265,28 @@ identifierId = hex.substring(0, 20).hexToString() val regex = "^[a-z0-9A-Z]+$" if (identifierId.matches(Regex(regex))) { - searchResultView.text = "已搜索到标识器" - searchResultView.setTextColor(Color.RED) - depthButton.isEnabled = true - degreeButton.isEnabled = true - - soundPool.stop(soundResId) + //自动上传标识器 + taskLabel = DataBaseManager.get.queryTaskLabelByIdAndState(identifierId, "未开始") + if (taskLabel != null) { + val userName = + SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + taskViewModel.uploadMarker(userName, identifierId) + } } } } return true } - private var isPlaying = false - override fun initLayoutView(): Int = R.layout.activity_search_label override fun observeRequestState() { - + taskViewModel.loadState.observe(this) { + if (it == LoadState.Success) { + "标识器${identifierId}已探测!".show(this) + DataBaseManager.get.updateTaskLabel(taskLabel) + } + } } override fun setupTopBarLayout() { @@ -296,7 +295,6 @@ } override fun onDestroy() { - soundPool.stop(soundResId) gpioManager.setGpioLow("18") super.onDestroy() } diff --git a/app/src/main/java/com/casic/detector/vm/TaskViewModel.kt b/app/src/main/java/com/casic/detector/vm/TaskViewModel.kt index a81ad98..2716154 100644 --- a/app/src/main/java/com/casic/detector/vm/TaskViewModel.kt +++ b/app/src/main/java/com/casic/detector/vm/TaskViewModel.kt @@ -170,13 +170,16 @@ }) fun uploadMarker(userName: String, taskDetailId: String) = launch({ + loadState.value = LoadState.Loading val response = RetrofitServiceManager.uploadMarker(userName, taskDetailId) if (response.separateResponseState()) { - + loadState.value = LoadState.Success } else { + loadState.value = LoadState.Fail response.toErrorMessage().show(BaseApplication.get()) } }, { + loadState.value = LoadState.Fail it.convertChinese().show(BaseApplication.get()) }) } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_search_label.xml b/app/src/main/res/layout/activity_search_label.xml index 7edacf9..81d2ffa 100644 --- a/app/src/main/res/layout/activity_search_label.xml +++ b/app/src/main/res/layout/activity_search_label.xml @@ -55,7 +55,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/energyValueView" - android:layout_marginStart="@dimen/dp_20" + android:layout_marginStart="@dimen/dp_15" android:layout_toEndOf="@id/energyValueView" android:text="dB" android:textColor="#32CD32"