File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
pythonforandroid/bootstraps/webview/build/src/main/java/org/kivy/android Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 3434
3535import android .webkit .WebViewClient ;
3636import android .webkit .WebView ;
37+ import android .net .Uri ;
3738
3839import org .renpy .android .ResourceManager ;
3940
@@ -45,6 +46,7 @@ public class PythonActivity extends Activity {
4546 private static final String TAG = "PythonActivity" ;
4647
4748 public static PythonActivity mActivity = null ;
49+ public static boolean mOpenExternalLinksInBrowser = false ;
4850
4951 /** If shared libraries (e.g. SDL or the native application) could not be loaded. */
5052 public static boolean mBrokenLibraries ;
@@ -163,6 +165,13 @@ public void onClick(DialogInterface dialog,int id) {
163165 mWebView .setWebViewClient (new WebViewClient () {
164166 @ Override
165167 public boolean shouldOverrideUrlLoading (WebView view , String url ) {
168+ if (mOpenExternalLinksInBrowser ) {
169+ if (!(url .startsWith ("file:" ) || url .startsWith ("http://127.0.0.1:" ))) {
170+ Intent i = new Intent (Intent .ACTION_VIEW , Uri .parse (url ));
171+ startActivity (i );
172+ return true ;
173+ }
174+ }
166175 view .loadUrl (url );
167176 return false ;
168177 }
You can’t perform that action at this time.
0 commit comments