From 28aaf8ee0507ea670f2a74ad07be65fa715a1235 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 5 Feb 2020 10:59:48 +0100 Subject: [PATCH] Select account improvements --- .../java/eu/faircode/email/FragmentGmail.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentGmail.java b/app/src/main/java/eu/faircode/email/FragmentGmail.java index dd7c4a409e..7ba1a84836 100644 --- a/app/src/main/java/eu/faircode/email/FragmentGmail.java +++ b/app/src/main/java/eu/faircode/email/FragmentGmail.java @@ -109,17 +109,20 @@ public class FragmentGmail extends FragmentBase { if (TextUtils.isEmpty(name)) throw new IllegalArgumentException(getString(R.string.title_no_name)); - startActivityForResult( - Helper.getChooser(getContext(), newChooseAccountIntent( - null, - null, - new String[]{"com.google"}, - false, - null, - null, - null, - null)), - ActivitySetup.REQUEST_CHOOSE_ACCOUNT); + + Intent intent = newChooseAccountIntent( + null, + null, + new String[]{"com.google"}, + false, + null, + null, + null, + null); + PackageManager pm = getContext().getPackageManager(); + if (intent.resolveActivity(pm) == null) + throw new IllegalArgumentException(getString(R.string.title_no_viewer, intent)); + startActivityForResult(intent, ActivitySetup.REQUEST_CHOOSE_ACCOUNT); } catch (Throwable ex) { if (ex instanceof IllegalArgumentException) tvError.setText(ex.getMessage());