desc:优化

main
xiaowusky 1 year ago
parent ebda6d1a5b
commit 92ba453ec4

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

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

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

Loading…
Cancel
Save