Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
BluToysApplication
Overview
Overview
Details
Activity
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
chengchong
BluToysApplication
Commits
4d8f4ea6
Commit
4d8f4ea6
authored
Feb 05, 2021
by
韩飞虎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
搞定时间联动
parent
d935d3c2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
6 deletions
+38
-6
PlayActivity.java
...main/java/com/example/blu/toys/activity/PlayActivity.java
+6
-2
SelectDeviceActivity.java
...a/com/example/blu/toys/activity/SelectDeviceActivity.java
+5
-1
SelectTimerActivity.java
...va/com/example/blu/toys/activity/SelectTimerActivity.java
+4
-1
SetTimeActivity.java
...n/java/com/example/blu/toys/activity/SetTimeActivity.java
+0
-0
BlePlay.java
app/src/main/java/com/example/blu/toys/ble/BlePlay.java
+1
-1
TimeBean.java
app/src/main/java/com/example/blu/toys/utils/TimeBean.java
+15
-0
TimeUtil.java
app/src/main/java/com/example/blu/toys/utils/TimeUtil.java
+7
-1
No files found.
app/src/main/java/com/example/blu/toys/activity/PlayActivity.java
View file @
4d8f4ea6
...
@@ -76,7 +76,9 @@ public class PlayActivity extends BaseActivity {
...
@@ -76,7 +76,9 @@ public class PlayActivity extends BaseActivity {
public
void
handleMessage
(
Message
msg
)
{
public
void
handleMessage
(
Message
msg
)
{
super
.
handleMessage
(
msg
);
super
.
handleMessage
(
msg
);
LogUtils
.
e
(
"定时器在走111"
,
msg
.
what
,
mHour
,
mMin
,
mSecond
);
LogUtils
.
e
(
"定时器在走111"
,
msg
.
what
,
mHour
,
mMin
,
mSecond
);
if
((
mHour
+
mMin
+
mSecond
)<
1
){
suspendAndContinue
=
0
;
}
if
(
suspendAndContinue
==
1
)
{
if
(
suspendAndContinue
==
1
)
{
computeTime
();
computeTime
();
String
mHourStr
=
addZeroForNum
(
mHour
+
""
,
2
);
String
mHourStr
=
addZeroForNum
(
mHour
+
""
,
2
);
...
@@ -183,7 +185,9 @@ public class PlayActivity extends BaseActivity {
...
@@ -183,7 +185,9 @@ public class PlayActivity extends BaseActivity {
@OnClick
(
R
.
id
.
back_but
)
@OnClick
(
R
.
id
.
back_but
)
public
void
onViewClicked
()
{
public
void
onViewClicked
()
{
timerManager
.
cancelTimer
();
timerManager
.
cancelTimer
();
finish
();
Intent
intent
=
new
Intent
(
PlayActivity
.
this
,
SetTimeActivity
.
class
);
startActivity
(
intent
);
}
}
@OnClick
({
R
.
id
.
cancel_but
,
R
.
id
.
pause_but
,
R
.
id
.
resume_but
})
@OnClick
({
R
.
id
.
cancel_but
,
R
.
id
.
pause_but
,
R
.
id
.
resume_but
})
...
...
app/src/main/java/com/example/blu/toys/activity/SelectDeviceActivity.java
View file @
4d8f4ea6
package
com
.
example
.
blu
.
toys
.
activity
;
package
com
.
example
.
blu
.
toys
.
activity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
...
@@ -85,6 +86,8 @@ public class SelectDeviceActivity extends BaseActivity {
...
@@ -85,6 +86,8 @@ public class SelectDeviceActivity extends BaseActivity {
@OnClick
(
R
.
id
.
back_but
)
@OnClick
(
R
.
id
.
back_but
)
public
void
onViewClicked
()
{
public
void
onViewClicked
()
{
finish
();
Intent
intent
=
new
Intent
(
SelectDeviceActivity
.
this
,
AddDeviceActivity
.
class
);
startActivity
(
intent
);
}
}
}
}
\ No newline at end of file
app/src/main/java/com/example/blu/toys/activity/SelectTimerActivity.java
View file @
4d8f4ea6
...
@@ -92,6 +92,8 @@ public class SelectTimerActivity extends BaseActivity {
...
@@ -92,6 +92,8 @@ public class SelectTimerActivity extends BaseActivity {
@OnClick
(
R
.
id
.
back_but
)
@OnClick
(
R
.
id
.
back_but
)
public
void
onViewClicked
()
{
public
void
onViewClicked
()
{
finish
();
Intent
intent
=
new
Intent
(
SelectTimerActivity
.
this
,
SelectDeviceActivity
.
class
);
startActivity
(
intent
);
}
}
}
}
\ No newline at end of file
app/src/main/java/com/example/blu/toys/activity/SetTimeActivity.java
View file @
4d8f4ea6
This diff is collapsed.
Click to expand it.
app/src/main/java/com/example/blu/toys/ble/BlePlay.java
View file @
4d8f4ea6
...
@@ -91,7 +91,7 @@ public class BlePlay {
...
@@ -91,7 +91,7 @@ public class BlePlay {
public
void
scanBle
()
{
public
void
scanBle
()
{
BleScanRuleConfig
scanRuleConfig
=
new
BleScanRuleConfig
.
Builder
().
setAutoConnect
(
false
)
BleScanRuleConfig
scanRuleConfig
=
new
BleScanRuleConfig
.
Builder
().
setAutoConnect
(
false
)
//.setServiceUuids(serviceIds)
//.setServiceUuids(serviceIds)
.
setScanTimeOut
(
1
000
).
build
();
.
setScanTimeOut
(
5
000
).
build
();
BleManager
.
getInstance
().
initScanRule
(
scanRuleConfig
);
BleManager
.
getInstance
().
initScanRule
(
scanRuleConfig
);
BleManager
.
getInstance
().
scan
(
new
BleScanCallback
()
{
BleManager
.
getInstance
().
scan
(
new
BleScanCallback
()
{
@Override
@Override
...
...
app/src/main/java/com/example/blu/toys/utils/TimeBean.java
View file @
4d8f4ea6
package
com
.
example
.
blu
.
toys
.
utils
;
package
com
.
example
.
blu
.
toys
.
utils
;
import
com.blankj.utilcode.util.LogUtils
;
public
class
TimeBean
{
public
class
TimeBean
{
private
int
mHour
;
private
int
mHour
;
private
int
mMin
;
private
int
mMin
;
private
int
mSecond
;
private
int
mSecond
;
public
int
getTotalMillisecond
(){
return
(
mHour
*
3600
+
mMin
*
60
+
mSecond
)*
1000
;
}
public
int
getTotalSecond
(){
return
(
mHour
*
3600
+
mMin
*
60
+
mSecond
);
}
public
void
toTime
(){
LogUtils
.
e
(
mHour
+
":"
+
mMin
+
":"
+
mSecond
);
}
private
String
[]
tims
;
private
String
[]
tims
;
public
String
[]
getTims
()
{
public
String
[]
getTims
()
{
...
...
app/src/main/java/com/example/blu/toys/utils/TimeUtil.java
View file @
4d8f4ea6
...
@@ -36,13 +36,19 @@ public class TimeUtil {
...
@@ -36,13 +36,19 @@ public class TimeUtil {
timeBean
.
setTims
(
tims
);
timeBean
.
setTims
(
tims
);
timeBean
.
setmHour
(
Integer
.
valueOf
(
tims
[
0
].
trim
()));
timeBean
.
setmHour
(
Integer
.
valueOf
(
tims
[
0
].
trim
()));
timeBean
.
setmMin
(
Integer
.
valueOf
(
tims
[
1
].
trim
()));
timeBean
.
setmMin
(
Integer
.
valueOf
(
tims
[
1
].
trim
()));
try
{
timeBean
.
setmSecond
(
Integer
.
valueOf
(
tims
[
2
].
split
(
","
)[
0
].
trim
()));
timeBean
.
setmSecond
(
Integer
.
valueOf
(
tims
[
2
].
split
(
","
)[
0
].
trim
()));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
timeBean
;
return
timeBean
;
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
Integer
.
valueOf
(
"00"
));
System
.
out
.
println
(
Integer
.
valueOf
(
"00"
));
TimeBean
timeBean
=
getTimeBeanBySecond
(
6
0
l
);
TimeBean
timeBean
=
getTimeBeanBySecond
(
0
l
);
System
.
out
.
printf
(
timeBean
.
getmHour
()+
":"
+
timeBean
.
getmMin
()+
":"
+
timeBean
.
getmSecond
());
System
.
out
.
printf
(
timeBean
.
getmHour
()+
":"
+
timeBean
.
getmMin
()+
":"
+
timeBean
.
getmSecond
());
...
...
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