From 1bc688dac37d60d761568e929ac87dffd1f24ce1 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 14 Aug 2022 08:23:32 +0200 Subject: [PATCH] Fixed choosing custom tabs --- .../main/java/eu/faircode/email/Helper.java | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java index 98f50475a0..3f61ae68a5 100644 --- a/app/src/main/java/eu/faircode/email/Helper.java +++ b/app/src/main/java/eu/faircode/email/Helper.java @@ -945,27 +945,21 @@ public class Helper { if (task) view.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - if ("chooser".equals(open_with_pkg)) { + if ("chooser".equals(open_with_pkg) && !open_with_tabs) { try { - if (open_with_tabs) { - EntityLog.log(context, "Launching direct uri=" + uri + - " intent=" + view + - " extras=" + TextUtils.join(", ", Log.getExtras(view.getExtras()))); - context.startActivity(view); - } else { - EntityLog.log(context, "Launching chooser uri=" + uri + - " intent=" + view + - " extras=" + TextUtils.join(", ", Log.getExtras(view.getExtras()))); - Intent chooser = Intent.createChooser(view, context.getString(R.string.title_select_app)); - context.startActivity(chooser); - } + EntityLog.log(context, "Launching chooser uri=" + uri + + " intent=" + view + + " extras=" + TextUtils.join(", ", Log.getExtras(view.getExtras()))); + Intent chooser = Intent.createChooser(view, context.getString(R.string.title_select_app)); + context.startActivity(chooser); } catch (ActivityNotFoundException ex) { Log.w(ex); reportNoViewer(context, uri, ex); } } else if (browse || !open_with_tabs) { try { - view.setPackage(open_with_pkg); + if (!"chooser".equals(open_with_pkg)) + view.setPackage(open_with_pkg); EntityLog.log(context, "Launching view uri=" + uri + " intent=" + view + " extras=" + TextUtils.join(", ", Log.getExtras(view.getExtras()))); @@ -1015,7 +1009,8 @@ public class Helper { CustomTabsIntent customTabsIntent = builder.build(); customTabsIntent.intent.putExtra(Browser.EXTRA_HEADERS, headers); - customTabsIntent.intent.setPackage(open_with_pkg); + if (!"chooser".equals(open_with_pkg)) + customTabsIntent.intent.setPackage(open_with_pkg); try { EntityLog.log(context, "Launching tab uri=" + uri +