Skip to content

Commit a034b4b

Browse files
committed
Added webview splash loader to bootstrap folders
1 parent f59c0be commit a034b4b

File tree

3 files changed

+63
-2
lines changed

3 files changed

+63
-2
lines changed

pythonforandroid/bootstraps/webview/build/build.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ def make_package(args):
236236
tar_dirs.append('private')
237237
if exists('crystax_python'):
238238
tar_dirs.append('crystax_python')
239+
tar_dirs.append('webview_includes')
239240
if args.private:
240241
make_tar('assets/private.mp3', tar_dirs, args.ignore_path)
241242
# else:
@@ -408,7 +409,7 @@ def parse_args(args=None):
408409
ap.add_argument('--wakelock', dest='wakelock', action='store_true',
409410
help=('Indicate if the application needs the device '
410411
'to stay on'))
411-
ap.add_argument('--window', dest='window', action='store_true',
412+
ap.add_argument('--window', dest='window', action='store_false',
412413
help='Indicate if the application will be windowed')
413414
ap.add_argument('--blacklist', dest='blacklist',
414415
default=join(curdir, 'blacklist.txt'),

pythonforandroid/bootstraps/webview/build/src/org/kivy/android/PythonActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public void onClick(DialogInterface dialog,int id) {
130130
// Set up the webview
131131
mWebView = new WebView(this);
132132
mWebView.getSettings().setJavaScriptEnabled(true);
133-
mWebView.loadUrl("file:///" + mActivity.getFilesDir().getAbsolutePath() + "/load.html");
133+
mWebView.loadUrl("file:///" + mActivity.getFilesDir().getAbsolutePath() + "/_load.html");
134134

135135
mWebView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
136136
mWebView.setWebViewClient(new WebViewClient() {
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<html>
4+
<head>
5+
<meta charset="utf-8">
6+
<link href="static/style.css" rel="stylesheet" type="text/css">
7+
<title>
8+
Python WebView loader
9+
</title>
10+
11+
</head>
12+
13+
<body>
14+
15+
<div id="load" style="height:100%">
16+
<div class="loader" >Loading...</div>
17+
</div>
18+
19+
20+
<div id="result" >
21+
</div>
22+
23+
<script>
24+
console.log('called!');
25+
var resultElem = document.getElementById('result');
26+
27+
function queryFlask() {
28+
29+
var request = new XMLHttpRequest();
30+
request.open('HEAD', 'http://127.0.0.1:5000/', true);
31+
request.send();
32+
request.onerror = function(e) {
33+
console.log('error!');
34+
console.log(e);
35+
resultElem.innerHTML = 'workederr';
36+
}
37+
request.onreadystatechange = function() {
38+
if (request.status == 500) {
39+
console.log('500!!!!!');
40+
}
41+
if (request.readyState == 4 & request.status == 200) {
42+
resultElem.innerHTML = 'worked';
43+
console.log('worked');
44+
} else {
45+
resultElem.innerHTML = 'failed';
46+
console.log(request.status);
47+
console.log('done');
48+
}
49+
50+
51+
}
52+
}
53+
54+
/* window.setInterval(queryFlask, 500); */
55+
window.setTimeout(function() {location.replace('http://127.0.0.1:5000/')}, 1000)
56+
</script>
57+
58+
</body>
59+
60+
</html>

0 commit comments

Comments
 (0)