Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import android.webkit.WebViewClient;
import android.webkit.WebView;
import android.net.Uri;

import org.renpy.android.ResourceManager;

Expand All @@ -45,6 +46,7 @@ public class PythonActivity extends Activity {
private static final String TAG = "PythonActivity";

public static PythonActivity mActivity = null;
public static boolean mOpenExternalLinksInBrowser = false;

/** If shared libraries (e.g. SDL or the native application) could not be loaded. */
public static boolean mBrokenLibraries;
Expand Down Expand Up @@ -163,6 +165,13 @@ public void onClick(DialogInterface dialog,int id) {
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (mOpenExternalLinksInBrowser) {
if (!(url.startsWith("file:") || url.startsWith("http://127.0.0.1:"))) {
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(i);
return true;
}
}
view.loadUrl(url);
return false;
}
Expand Down