From 7df83464b98a6146dac22b6ebb6168ab6948b109 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 25 Aug 2024 07:55:55 +0200 Subject: [PATCH] Send dialog: check for OpenKeychain --- .../eu/faircode/email/FragmentDialogSend.java | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogSend.java b/app/src/main/java/eu/faircode/email/FragmentDialogSend.java index fdae8caab8..2da324fb61 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogSend.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogSend.java @@ -342,23 +342,24 @@ public class FragmentDialogSend extends FragmentDialogBase { spEncrypt.setTag(position); setEncrypt(encryptValues[position]); + tvEncrypt.setPaintFlags(tvEncrypt.getPaintFlags() & ~Paint.UNDERLINE_TEXT_FLAG); + tvEncrypt.setOnClickListener(null); + if ((encryptValues[position] == EntityMessage.PGP_SIGNONLY || encryptValues[position] == EntityMessage.PGP_ENCRYPTONLY || - encryptValues[position] == EntityMessage.PGP_SIGNENCRYPT) && - PgpHelper.isOpenKeychainInstalled(context)) { - tvEncrypt.setPaintFlags(tvEncrypt.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); - tvEncrypt.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - String pkg = PgpHelper.getPackageName(v.getContext()); - PackageManager pm = v.getContext().getPackageManager(); - v.getContext().startActivity(pm.getLaunchIntentForPackage(pkg)); - } - }); - } else { - tvEncrypt.setPaintFlags(tvEncrypt.getPaintFlags() & ~Paint.UNDERLINE_TEXT_FLAG); - tvEncrypt.setOnClickListener(null); - } + encryptValues[position] == EntityMessage.PGP_SIGNENCRYPT)) + if (PgpHelper.isOpenKeychainInstalled(context)) { + tvEncrypt.setPaintFlags(tvEncrypt.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); + tvEncrypt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + String pkg = PgpHelper.getPackageName(v.getContext()); + PackageManager pm = v.getContext().getPackageManager(); + v.getContext().startActivity(pm.getLaunchIntentForPackage(pkg)); + } + }); + } else + ToastEx.makeText(context, R.string.title_no_openpgp, ToastEx.LENGTH_LONG).show(); } }