allow to open link directly in local/offile help

This commit is contained in:
adbenitez
2025-11-23 22:14:47 +01:00
parent 3c9a289e2d
commit a66b4d8923
2 changed files with 19 additions and 10 deletions
@@ -14,6 +14,9 @@ public class LocalHelpActivity extends WebViewActivity
{
public static final String SECTION_EXTRA = "section_extra";
@Override
protected boolean shouldAskToOpenLink() { return false; }
@Override
protected boolean allowInLockedMode() { return true; }
@@ -37,6 +37,8 @@ public class WebViewActivity extends PassphraseRequiredActionBarActivity
protected WebView webView;
protected boolean shouldAskToOpenLink() { return true; }
protected void toggleFakeProxy(boolean enable) {
if (WebViewFeature.isFeatureSupported(WebViewFeature.PROXY_OVERRIDE)) {
if (enable) {
@@ -277,16 +279,20 @@ public class WebViewActivity extends PassphraseRequiredActionBarActivity
return true; // abort internal loading
}
new AlertDialog.Builder(this)
.setTitle(R.string.open_url_confirmation)
.setMessage(IDN.toASCII(url))
.setNeutralButton(R.string.cancel, null)
.setPositiveButton(R.string.open, (d, w) -> IntentUtils.showInBrowser(this, url))
.setNegativeButton(R.string.global_menu_edit_copy_desktop, (d, w) -> {
Util.writeTextToClipboard(this, url);
Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show();
})
.show();
if (shouldAskToOpenLink()) {
new AlertDialog.Builder(this)
.setTitle(R.string.open_url_confirmation)
.setMessage(IDN.toASCII(url))
.setNeutralButton(R.string.cancel, null)
.setPositiveButton(R.string.open, (d, w) -> IntentUtils.showInBrowser(this, url))
.setNegativeButton(R.string.global_menu_edit_copy_desktop, (d, w) -> {
Util.writeTextToClipboard(this, url);
Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show();
})
.show();
} else {
IntentUtils.showInBrowser(this, url);
}
// returning `true` causes the WebView to abort loading
return true;