diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java b/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java index 5130cb6460..29222eb2f2 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java @@ -22,6 +22,7 @@ package eu.faircode.email; import static androidx.browser.customtabs.CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION; import android.app.Dialog; +import android.content.ActivityNotFoundException; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; @@ -566,6 +567,22 @@ public class FragmentDialogOpenLink extends FragmentDialogBase { Log.i("Open link cancelled"); } }) + .setNeutralButton(R.string.title_browse, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + // https://developer.android.com/training/basics/intents/sending#AppChooser + Uri uri = Uri.parse(etLink.getText().toString()); + Log.i("Open link with uri=" + uri); + Intent view = new Intent(Intent.ACTION_VIEW, uri); + Intent chooser = Intent.createChooser(view, context.getString(R.string.title_select_app)); + try { + startActivity(chooser); + } catch (ActivityNotFoundException ex) { + Log.w(ex); + Helper.view(context, uri, true, true); + } + } + }) .create(); }