Skip to content

Commit 17e6f45

Browse files
committed
Moved WebViewLoader to template to set port
1 parent 63c4652 commit 17e6f45

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

pythonforandroid/bootstraps/webview/build/src/org/kivy/android/WebViewLoader.java renamed to pythonforandroid/bootstraps/webview/build/templates/WebViewLoader.tmpl.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,29 @@ public class WebViewLoader {
1818
public static void testConnection() {
1919

2020
while (true) {
21-
if (WebViewLoader.pingHost("localhost", 5000, 100)) {
22-
Log.v(TAG, "Cuccessfully pinged localhost:5000");
21+
if (WebViewLoader.pingHost("localhost", {{ args.port }}, 100)) {
22+
Log.v(TAG, "Successfully pinged localhost:{{ args.port }}");
2323
Handler mainHandler = new Handler(PythonActivity.mActivity.getMainLooper());
2424

2525
Runnable myRunnable = new Runnable() {
2626
@Override
2727
public void run() {
28-
PythonActivity.mActivity.mWebView.loadUrl("http://127.0.0.1:5000/");
28+
PythonActivity.mActivity.mWebView.loadUrl("http://127.0.0.1:{{ args.port }}/");
2929
Log.v(TAG, "Loaded webserver in webview");
3030
}
3131
};
3232
mainHandler.post(myRunnable);
3333
break;
3434

3535
} else {
36-
Log.v(TAG, "Could not ping localhost:5000");
36+
Log.v(TAG, "Could not ping localhost:{{ args.port }}");
3737
try {
3838
Thread.sleep(100);
3939
} catch(InterruptedException e) {
4040
Log.v(TAG, "InterruptedException occurred when sleeping");
4141
}
4242
}
4343
}
44-
45-
Log.v(TAG, "testConnection finished");
46-
4744
}
4845

4946
public static boolean pingHost(String host, int port, int timeout) {

0 commit comments

Comments
 (0)