mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
allow to open link directly in local/offile help
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user