Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
huangzhicong
/
SmartCanteen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ca258f22
authored
Aug 13, 2019
by
patpat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码
parent
88210ec0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
app/src/main/java/com/bgycc/smartcanteen/action/WifiAction.kt
+1
-1
app/src/main/java/com/bgycc/smartcanteen/helper/TimerHelper.kt
+3
-3
No files found.
app/src/main/java/com/bgycc/smartcanteen/action/WifiAction.kt
View file @
ca258f22
...
...
@@ -76,7 +76,7 @@ class WifiAction private constructor() : Action(ActionEnum.CONFIG_WIFI.name) {
}
EventBus
.
getDefault
().
post
(
WifiStateEvent
(
30
,
"正在连接Wifi"
))
TimerHelper
.
loop
({
id
,
isLastTime
->
TimerHelper
.
loop
({
_
,
isLastTime
->
if
(
isLastTime
)
{
if
(
state
==
State
.
STARTED
)
{
state
=
State
.
FAIL
...
...
app/src/main/java/com/bgycc/smartcanteen/helper/TimerHelper.kt
View file @
ca258f22
...
...
@@ -41,7 +41,7 @@ object TimerHelper {
try
{
runnable
()
}
catch
(
e
:
Exception
)
{
Log
.
w
(
TAG
,
"timeout id: $id
times
error: ${e.message}"
)
Log
.
w
(
TAG
,
"timeout id: $id error: ${e.message}"
)
}
},
time
,
TimeUnit
.
MILLISECONDS
))
return
id
...
...
@@ -60,7 +60,7 @@ object TimerHelper {
fun
loop
(
runnable
:
(
id
:
Long
,
isLastTime
:
Boolean
)
->
Boolean
,
period
:
Long
,
times
:
Int
=
-
1
):
Long
{
val
id
=
mId
mFutureList
.
put
(
id
,
mScheduledExecutorService
.
schedule
WithFixedDelay
(
object
:
Runnable
{
mFutureList
.
put
(
id
,
mScheduledExecutorService
.
schedule
AtFixedRate
(
object
:
Runnable
{
var
vTimes
=
0
override
fun
run
()
{
if
(
times
>=
0
)
{
...
...
@@ -75,7 +75,7 @@ object TimerHelper {
cancel
(
id
)
}
}
catch
(
e
:
Exception
)
{
Log
.
w
(
TAG
,
"loop id: $id times error: ${e.message}"
)
Log
.
w
(
TAG
,
"loop id: $id times
: $vTimes
error: ${e.message}"
)
}
}
},
0
,
period
,
TimeUnit
.
MILLISECONDS
))
...
...
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