11
22package org .kivy .android ;
33
4+ import java .net .Socket ;
5+ import java .net .InetSocketAddress ;
6+
7+ import android .os .SystemClock ;
8+
49import java .io .InputStream ;
510import java .io .FileInputStream ;
611import java .io .FileOutputStream ;
4247
4348import org .kivy .android .PythonUtil ;
4449
50+ import org .kivy .android .WebViewLoader ;
51+
4552import org .renpy .android .ResourceManager ;
4653import org .renpy .android .AssetExtract ;
4754
48-
4955public class PythonActivity extends Activity {
5056 // This activity is modified from a mixture of the SDLActivity and
5157 // PythonActivity in the SDL2 bootstrap, but removing all the SDL2
@@ -130,7 +136,9 @@ public void onClick(DialogInterface dialog,int id) {
130136 // Set up the webview
131137 mWebView = new WebView (this );
132138 mWebView .getSettings ().setJavaScriptEnabled (true );
139+ mWebView .getSettings ().setDomStorageEnabled (true );
133140 mWebView .loadUrl ("file:///" + mActivity .getFilesDir ().getAbsolutePath () + "/_load.html" );
141+ // mWebView.loadUrl("http://localhost:5000/");
134142
135143 mWebView .setLayoutParams (new LayoutParams (LayoutParams .FILL_PARENT , LayoutParams .FILL_PARENT ));
136144 mWebView .setWebViewClient (new WebViewClient () {
@@ -154,7 +162,7 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
154162 PythonActivity .nativeSetEnv ("ANDROID_ENTRYPOINT" , "main.pyo" );
155163 PythonActivity .nativeSetEnv ("PYTHONHOME" , mFilesDirectory );
156164 PythonActivity .nativeSetEnv ("PYTHONPATH" , mFilesDirectory + ":" + mFilesDirectory + "/lib" );
157-
165+
158166 try {
159167 Log .v (TAG , "Access to our meta-data..." );
160168 this .mMetaData = this .mActivity .getPackageManager ().getApplicationInfo (
@@ -170,9 +178,12 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
170178 final Thread pythonThread = new Thread (new PythonMain (), "PythonThread" );
171179 PythonActivity .mPythonThread = pythonThread ;
172180 pythonThread .start ();
173-
174- }
175181
182+ final Thread wvThread = new Thread (new TestMain (), "WvThread" );
183+ wvThread .start ();
184+
185+ }
186+
176187 public void loadLibraries () {
177188 PythonUtil .loadLibraries (getFilesDir ());
178189 }
@@ -374,3 +385,10 @@ public void run() {
374385 PythonActivity .nativeInit (new String [0 ]);
375386 }
376387}
388+
389+ class TestMain implements Runnable {
390+ @ Override
391+ public void run () {
392+ WebViewLoader .testConnection ();
393+ }
394+ }
0 commit comments