X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fdialogs%2FPinnedSslCertificateMismatchDialog.java;h=7404708b55fe04a7230b4ec39d1bc4d5d0d45415;hp=6796b50e6735b8a6eb3f625dfc6d8989e9e743ce;hb=c712e2ddec063fb29676a2df99786b262d8c4bfe;hpb=0a5d2eabceeafb49a957598538aa74d4f11dfce0 diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedSslCertificateMismatchDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedSslCertificateMismatchDialog.java index 6796b50e..7404708b 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedSslCertificateMismatchDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedSslCertificateMismatchDialog.java @@ -49,10 +49,9 @@ import java.text.DateFormat; import java.util.Date; public class PinnedSslCertificateMismatchDialog extends AppCompatDialogFragment { - // `layoutInflater` is used in `onCreateDialog()` and `pagerAdapter`. + // Instantiate the class variables. + private PinnedSslCertificateMismatchListener pinnedSslCertificateMismatchListener; private LayoutInflater layoutInflater; - - // The current website SSL certificate variables are used in `onCreateDialog()` and `pagerAdapter()`. private String currentSslIssuedToCNameString; private String currentSslIssuedToONameString; private String currentSslIssuedToUNameString; @@ -69,18 +68,13 @@ public class PinnedSslCertificateMismatchDialog extends AppCompatDialogFragment void onSslMismatchProceed(); } - // `sslCertificateErrorListener` is used in `onAttach` and `onCreateDialog`. - private PinnedSslCertificateMismatchDialog.PinnedSslCertificateMismatchListener pinnedSslCertificateMismatchListener; - // Check to make sure that the parent activity implements the listener. public void onAttach(Context context) { + // Run the default commands. super.onAttach(context); - try { - pinnedSslCertificateMismatchListener = (PinnedSslCertificateMismatchDialog.PinnedSslCertificateMismatchListener) context; - } catch(ClassCastException exception) { - throw new ClassCastException(context.toString() + " must implement PinnedSslCertificateMismatchListener"); - } + // Get a handle for `PinnedSslCertificateMismatchListener` from the launching context. + pinnedSslCertificateMismatchListener = (PinnedSslCertificateMismatchListener) context; } // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`.