Commit 219d0177 authored by tongzifang's avatar tongzifang

负数 优化

parent fdd59633
...@@ -30,7 +30,7 @@ android { ...@@ -30,7 +30,7 @@ android {
} }
} }
group 'com.qmai.android.zqtoolkit' group 'com.qmai.android.zqtoolkit'
version '1.2.8' version '1.2.8.1'
gradlePublish { gradlePublish {
......
...@@ -13,6 +13,7 @@ import kotlinx.coroutines.GlobalScope ...@@ -13,6 +13,7 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.math.BigDecimal
/** /**
* tongzi * tongzi
...@@ -77,23 +78,27 @@ abstract class ScaleBaseKit : ScaleBaseAction, ScaleUpdateAction { ...@@ -77,23 +78,27 @@ abstract class ScaleBaseKit : ScaleBaseAction, ScaleUpdateAction {
//稳定状态且读数正常 //稳定状态且读数正常
if (weight.isStable && !weight.isReadErr) { if (weight.isStable && !weight.isReadErr) {
readErrCache.clear() readErrCache.clear()
when { if (BigDecimal(weight.weight) < BigDecimal.ZERO) {
stableWeight.size == STABLE_COUNT -> { _livingWeight.emit(weight)
var single = stableWeight.distinctBy { it.weight } } else {
if (single.size == 1) { when {
//给业务的unit要小写 stableWeight.size == STABLE_COUNT -> {
if (weight.unit.isNotEmpty()) var single = stableWeight.distinctBy { it.weight }
weight.unit = weight.unit.lowercase() if (single.size == 1) {
single.firstOrNull()?.let { //给业务的unit要小写
_livingWeight.emit(it) if (weight.unit.isNotEmpty())
weight.unit = weight.unit.lowercase()
single.firstOrNull()?.let {
_livingWeight.emit(it)
}
} }
stableWeight.clear()
} }
stableWeight.clear() stableWeight.size > STABLE_COUNT -> {
} stableWeight.clear()
stableWeight.size > STABLE_COUNT -> { }
stableWeight.clear() else -> stableWeight.add(weight)
} }
else -> stableWeight.add(weight)
} }
} else { } else {
_livingWeight.emit(weight) _livingWeight.emit(weight)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment