Commit 219d0177 authored by tongzifang's avatar tongzifang

负数 优化

parent fdd59633
......@@ -30,7 +30,7 @@ android {
}
}
group 'com.qmai.android.zqtoolkit'
version '1.2.8'
version '1.2.8.1'
gradlePublish {
......
......@@ -13,6 +13,7 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.launch
import java.math.BigDecimal
/**
* tongzi
......@@ -77,23 +78,27 @@ abstract class ScaleBaseKit : ScaleBaseAction, ScaleUpdateAction {
//稳定状态且读数正常
if (weight.isStable && !weight.isReadErr) {
readErrCache.clear()
when {
stableWeight.size == STABLE_COUNT -> {
var single = stableWeight.distinctBy { it.weight }
if (single.size == 1) {
//给业务的unit要小写
if (weight.unit.isNotEmpty())
weight.unit = weight.unit.lowercase()
single.firstOrNull()?.let {
_livingWeight.emit(it)
if (BigDecimal(weight.weight) < BigDecimal.ZERO) {
_livingWeight.emit(weight)
} else {
when {
stableWeight.size == STABLE_COUNT -> {
var single = stableWeight.distinctBy { it.weight }
if (single.size == 1) {
//给业务的unit要小写
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 {
_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