desc:优化

main
xiaowusky 1 year ago
parent ebda6d1a5b
commit 92ba453ec4

@ -273,11 +273,11 @@ object ParseHelper {
*/
@OptIn(DelicateCoroutinesApi::class)
private fun updateGasTypeDb(type: GasTypeEnum, sensorIndex: Int, status: Int) {
GasCache.setStatus(type.desc, getShowStatus(CommonApplication.getContext(), status))
if (statusChange(type.desc, status)) {
GlobalScope.launch(Dispatchers.Unconfined) {
val typeDao = DBUtils.gasTypeDao()
val gasType = typeDao.getByName(type.desc)
GasCache.setStatus(type.desc, getShowStatus(CommonApplication.getContext(), status))
gasType?.type = type.desc
gasType?.status = status
gasType?.sensorIndex = sensorIndex

@ -259,17 +259,20 @@ class HomeActivity : NoOptionsActivity() {
}
}
launch(Dispatchers.Main) {
val warnText = builder.toString()
if (warnText.isNotEmpty()) {
SoundUtils.warnSound(isOverHighThreshold(warnText))
} else {
SoundUtils.warnSoundClose()
}
lifecycleScope.launchWhenResumed {
val warnText = builder.toString()
if (warnText.isNotEmpty()) {
mBinding.tvWarn.text = warnText
mBinding.tvWarn.visibility = View.VISIBLE
LztekUtil.openLinkI0()
SoundUtils.warnSound(isOverHighThreshold(warnText))
} else {
mBinding.tvWarn.visibility = View.GONE
LztekUtil.closeLinkIO()
SoundUtils.warnSoundClose()
}
}
}

@ -160,7 +160,7 @@ class GlobalMonitorActivity : NoOptionsActivity() {
// showDelErrorDialog()
// return
// }
// mBinding.tvStatus!!.text = info.SSID + "删除成功!"
mBinding.tvStatus!!.text = info.SSID + "删除成功!"
for (connectInfo in mData!!) {
if (!TextUtils.isEmpty(info.SSID) && info.SSID == connectInfo.scanResult.SSID) {
connectInfo.configuration = null

Loading…
Cancel
Save