File tree 1 file changed +9
-0
lines changed
pythonforandroid/bootstraps/webview/build/src/main/java/org/kivy/android 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 34
34
35
35
import android .webkit .WebViewClient ;
36
36
import android .webkit .WebView ;
37
+ import android .net .Uri ;
37
38
38
39
import org .renpy .android .ResourceManager ;
39
40
@@ -45,6 +46,7 @@ public class PythonActivity extends Activity {
45
46
private static final String TAG = "PythonActivity" ;
46
47
47
48
public static PythonActivity mActivity = null ;
49
+ public static boolean mOpenExternalLinksInBrowser = false ;
48
50
49
51
/** If shared libraries (e.g. SDL or the native application) could not be loaded. */
50
52
public static boolean mBrokenLibraries ;
@@ -163,6 +165,13 @@ public void onClick(DialogInterface dialog,int id) {
163
165
mWebView .setWebViewClient (new WebViewClient () {
164
166
@ Override
165
167
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
+ }
166
175
view .loadUrl (url );
167
176
return false ;
168
177
}
You can’t perform that action at this time.
0 commit comments