From ad7ce25ef8e572617f4f3d5d2f95685f89abff84 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 28 Jun 2020 10:37:48 +0200 Subject: [PATCH] Added two solutions for no public key --- .../eu/faircode/email/FragmentCompose.java | 33 ++++++++++++++++--- app/src/main/res/layout/fragment_compose.xml | 7 ++++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 7a4ecd8ae9..36d2718a92 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -2603,10 +2603,35 @@ public class FragmentCompose extends FragmentBase { new Intent(getContext(), ActivitySetup.class) .putExtra("tab", "encryption")); else { - FragmentDialogSend fragment = new FragmentDialogSend(); - fragment.setArguments(args); - fragment.setTargetFragment(FragmentCompose.this, REQUEST_SEND); - fragment.show(getParentFragmentManager(), "compose:send"); + View vwAnchor = view.findViewById(R.id.vwAnchor); + PopupMenuLifecycle popupMenu = new PopupMenuLifecycle(getContext(), getViewLifecycleOwner(), vwAnchor); + popupMenu.getMenu().add(Menu.NONE, R.string.title_send_dialog, 1, R.string.title_send_dialog); + popupMenu.getMenu().add(Menu.NONE, R.string.title_advanced_manage_certificates, 2, R.string.title_advanced_manage_certificates); + + popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + switch (item.getItemId()) { + case R.string.title_send_dialog: + FragmentDialogSend fragment = new FragmentDialogSend(); + fragment.setArguments(args); + fragment.setTargetFragment(FragmentCompose.this, REQUEST_SEND); + fragment.show(getParentFragmentManager(), "compose:send"); + return true; + + case R.string.title_advanced_manage_certificates: + startActivity( + new Intent(getContext(), ActivitySetup.class) + .putExtra("tab", "encryption")); + return true; + + default: + return false; + } + } + }); + + popupMenu.show(); } } }); diff --git a/app/src/main/res/layout/fragment_compose.xml b/app/src/main/res/layout/fragment_compose.xml index b7672c1cb1..26336d3d80 100644 --- a/app/src/main/res/layout/fragment_compose.xml +++ b/app/src/main/res/layout/fragment_compose.xml @@ -459,6 +459,13 @@ + +