nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7bf0e23
)
lib/android: if there is no activities, run UI code on the caller thread
author
Alexis Laferrière
<alexis.laf@xymus.net>
Fri, 11 Mar 2016 18:55:55 +0000
(13:55 -0500)
committer
Alexis Laferrière
<alexis.laf@xymus.net>
Sun, 13 Mar 2016 14:23:24 +0000
(10:23 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/android/http_request.nit
patch
|
blob
|
history
diff --git
a/lib/android/http_request.nit
b/lib/android/http_request.nit
index
d7427c3
..
2b9fd14
100644
(file)
--- a/
lib/android/http_request.nit
+++ b/
lib/android/http_request.nit
@@
-30,7
+30,15
@@
in "Java" `{
`}
redef class App
- redef fun run_on_ui_thread(task) do app.native_activity.run_on_ui_thread task
+ redef fun run_on_ui_thread(task)
+ do
+ if app.activities.not_empty then
+ app.native_activity.run_on_ui_thread task
+ else
+ # There is no UI, it must be a service, run on the caller thread
+ task.main
+ end
+ end
end
redef class Text