diff --git a/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java b/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java index 7ba01e003f..3374b04768 100644 --- a/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java +++ b/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java @@ -485,35 +485,7 @@ public class FragmentQuickSetup extends FragmentBase { tvImap.setText(result == null ? null : result.imap.toString()); tvSmtp.setText(result == null ? null : result.smtp.toString()); grpSetup.setVisibility(result == null ? View.GONE : View.VISIBLE); - - X509Certificate imap_certificate = - (X509Certificate) args.getSerializable("imap_certificate"); - X509Certificate smtp_certificate = - (X509Certificate) args.getSerializable("smtp_certificate"); - - List imapNames = new ArrayList<>(); - if (imap_certificate != null) - try { - imapNames = EntityCertificate.getDnsNames(imap_certificate); - } catch (Throwable ignored) { - } - - List smtpNames = new ArrayList<>(); - if (smtp_certificate != null) - try { - smtpNames = EntityCertificate.getDnsNames(smtp_certificate); - } catch (Throwable ignored) { - } - - tvImapFingerprint.setText(EntityCertificate.getKeyFingerprint(imap_certificate)); - tvImapDnsNames.setText(TextUtils.join(", ", imapNames)); - tvSmtpFingerprint.setText(EntityCertificate.getKeyFingerprint(smtp_certificate)); - tvSmtpDnsNames.setText(TextUtils.join(", ", smtpNames)); - - grpCertificate.setVisibility( - imap_certificate == null && smtp_certificate == null - ? View.GONE : View.VISIBLE); - + showCertInfo(args); btnSave.setVisibility(result == null ? View.GONE : View.VISIBLE); } else { FragmentDialogAccount fragment = new FragmentDialogAccount(); @@ -583,6 +555,36 @@ public class FragmentQuickSetup extends FragmentBase { } } + private void showCertInfo(Bundle args) { + X509Certificate imap_certificate = + (X509Certificate) args.getSerializable("imap_certificate"); + X509Certificate smtp_certificate = + (X509Certificate) args.getSerializable("smtp_certificate"); + + List imapNames = new ArrayList<>(); + if (imap_certificate != null) + try { + imapNames = EntityCertificate.getDnsNames(imap_certificate); + } catch (Throwable ignored) { + } + + List smtpNames = new ArrayList<>(); + if (smtp_certificate != null) + try { + smtpNames = EntityCertificate.getDnsNames(smtp_certificate); + } catch (Throwable ignored) { + } + + tvImapFingerprint.setText(EntityCertificate.getKeyFingerprint(imap_certificate)); + tvImapDnsNames.setText(TextUtils.join(", ", imapNames)); + tvSmtpFingerprint.setText(EntityCertificate.getKeyFingerprint(smtp_certificate)); + tvSmtpDnsNames.setText(TextUtils.join(", ", smtpNames)); + + grpCertificate.setVisibility( + imap_certificate == null && smtp_certificate == null + ? View.GONE : View.VISIBLE); + } + private void setManual(boolean manual) { FragmentActivity activity = getActivity(); if (activity == null)