Bring back open with

pull/208/head
M66B 3 years ago
parent 81519209d4
commit 855e277e83

@ -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();
}

Loading…
Cancel
Save