Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
Widget
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Android Widget
Widget
Commits
219d0177
Commit
219d0177
authored
Feb 02, 2023
by
tongzifang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
负数 优化
parent
fdd59633
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
15 deletions
+20
-15
build.gradle
zqtoolkit/build.gradle
+1
-1
ScaleBaseKit.kt
...c/main/java/com/qmai/zqtoolkit/base/scale/ScaleBaseKit.kt
+19
-14
No files found.
zqtoolkit/build.gradle
View file @
219d0177
...
...
@@ -30,7 +30,7 @@ android {
}
}
group
'com.qmai.android.zqtoolkit'
version
'1.2.8'
version
'1.2.8
.1
'
gradlePublish
{
...
...
zqtoolkit/src/main/java/com/qmai/zqtoolkit/base/scale/ScaleBaseKit.kt
View file @
219d0177
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment