Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dave Griffiths
mongoose-2000
Commits
d8230d01
Commit
d8230d01
authored
Dec 11, 2013
by
Dave Griffiths
Browse files
sync loop and new sound
parent
870a616c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
17 deletions
+32
-17
android/assets/starwisp.scm
android/assets/starwisp.scm
+22
-15
android/res/raw/active.wav
android/res/raw/active.wav
+0
-0
android/src/foam/mongoose/StarwispBuilder.java
android/src/foam/mongoose/StarwispBuilder.java
+10
-2
No files found.
android/assets/starwisp.scm
View file @
d8230d01
...
...
@@ -303,7 +303,9 @@
(
debug!
(
string-append
"Requesting "
(
number->string
(
length
r
))
" entities"
))
r
)))))))
(
cons
(
play-sound
"active"
)
r
))))))))
(
define
(
build-dirty
)
(
let
((
sync
(
get-dirty-stats
db
"sync"
))
...
...
@@ -320,7 +322,8 @@
((
>
(
length
r
)
0
)
(
debug!
(
string-append
"Uploading "
(
number->string
(
length
r
))
" items..."
))
(
list
(
toast
"Uploading data..."
)))
(
toast
"Uploading data..."
)
(
play-sound
"active"
)))
(
else
(
debug!
"No data changed to upload"
)
(
set-current!
'upload
1
)
...
...
@@ -517,9 +520,21 @@
(
get-current
'debug-text
""
)))
(
define
(
debug-timer-cb
)
(
list
(
delayed
"debug-timer"
1000
debug-timer-cb
)
(
update-debug
)))
(
append
(
cond
((
get-current
'sync-on
#f
)
(
set-current!
'upload
0
)
(
set-current!
'download
0
)
(
connect-to-net
(
lambda
()
(
append
(
list
(
toast
"sync-cb"
))
(
upload-dirty
db
)
(
suck-new
db
"sync"
)))))
(
else
'
()))
(
list
(
delayed
"debug-timer"
(
+
5000
(
random
5000
))
debug-timer-cb
)
(
update-debug
))))
(
define
pf-length
20
)
;; minutes...
...
...
@@ -1826,16 +1841,7 @@
(
text-view
(
make-id
"sync-title"
)
"Sync database"
40
fillwrap
)
(
mtext
"sync-dirty"
"..."
)
(
horiz
(
mbutton2
"sync-all"
"Sync me"
(
lambda
()
(
set-current!
'upload
0
)
(
set-current!
'download
0
)
(
connect-to-net
(
lambda
()
(
append
(
upload-dirty
db
)
(
suck-new
db
"sync"
))))))
(
mtoggle-button2
"sync-all"
"Sync me"
(
lambda
(
v
)
(
set-current!
'sync-on
v
)))
(
mbutton2
"sync-syncall"
"Push all"
(
lambda
()
(
let
((
r
(
append
...
...
@@ -1903,6 +1909,7 @@
(
lambda
(
activity
arg
)
(
activity-layout
activity
))
(
lambda
(
activity
arg
)
(
set-current!
'sync-on
#f
)
(
append
(
debug-timer-cb
)
(
list
...
...
android/res/raw/active.wav
0 → 100644
View file @
d8230d01
File added
android/src/foam/mongoose/StarwispBuilder.java
View file @
d8230d01
...
...
@@ -690,8 +690,16 @@ public class StarwispBuilder
}
if
(
token
.
equals
(
"play-sound"
))
{
MediaPlayer
mp
=
MediaPlayer
.
create
(
ctx
,
R
.
raw
.
ping
);
mp
.
start
();
String
name
=
arr
.
getString
(
3
);
if
(
name
.
equals
(
"ping"
))
{
MediaPlayer
mp
=
MediaPlayer
.
create
(
ctx
,
R
.
raw
.
ping
);
mp
.
start
();
}
if
(
name
.
equals
(
"active"
))
{
MediaPlayer
mp
=
MediaPlayer
.
create
(
ctx
,
R
.
raw
.
active
);
mp
.
start
();
}
}
if
(
token
.
equals
(
"vibrate"
))
{
...
...
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