+ // Get a handle for the current nested scroll WebView.
+ nestedScrollWebView = fragmentView.findViewById(R.id.nestedscroll_webview)
+
+ // Get the SSL certificate.
+ val sslCertificate = nestedScrollWebView.certificate
+
+ // Store the status of the SSL certificate.
+ hasSslCertificate = sslCertificate != null
+
+ // Populate the certificate class variables if the webpage has an SSL certificate.
+ if (hasSslCertificate) {
+ // Convert the URL to a URI.
+ val uri = Uri.parse(nestedScrollWebView.url)
+
+ // Extract the domain name from the URI.
+ domainString = uri.host!!
+
+ // Get the ip addresses from the nested scroll WebView.
+ ipAddresses = nestedScrollWebView.currentIpAddresses
+
+ // Get the strings from the SSL certificate.
+ issuedToCName = sslCertificate!!.issuedTo.cName
+ issuedToOName = sslCertificate.issuedTo.oName
+ issuedToUName = sslCertificate.issuedTo.uName
+ issuedByCName = sslCertificate.issuedBy.cName
+ issuedByOName = sslCertificate.issuedBy.oName
+ issuedByUName = sslCertificate.issuedBy.uName
+ startDate = sslCertificate.validNotBeforeDate
+ endDate = sslCertificate.validNotAfterDate
+ }
+ } else { // The dialog has been restarted.
+ // Get the data from the saved instance state.
+ hasSslCertificate = savedInstanceState.getBoolean(HAS_SSL_CERTIFICATE)
+
+ // Populate the certificate class variables if the webpage has an SSL certificate.
+ if (hasSslCertificate) {
+ // Populate the certificate class variables from the saved instance state.
+ domainString = savedInstanceState.getString(DOMAIN)!!
+ ipAddresses = savedInstanceState.getString(IP_ADDRESSES)!!
+ issuedToCName = savedInstanceState.getString(ISSUED_TO_CNAME)!!
+ issuedToOName = savedInstanceState.getString(ISSUED_TO_ONAME)!!
+ issuedToUName = savedInstanceState.getString(ISSUED_TO_UNAME)!!
+ issuedByCName = savedInstanceState.getString(ISSUED_BY_CNAME)!!
+ issuedByOName = savedInstanceState.getString(ISSUED_BY_ONAME)!!
+ issuedByUName = savedInstanceState.getString(ISSUED_BY_UNAME)!!
+ startDate = Date(savedInstanceState.getLong(START_DATE))
+ endDate = Date(savedInstanceState.getLong(END_DATE))
+ }
+ }
+
+ // Get the favorite icon byte array from the arguments.
+ val favoriteIconByteArray = requireArguments().getByteArray(FAVORITE_ICON_BYTE_ARRAY)!!
+
+ // Convert the favorite icon byte array to a bitmap.
+ val favoriteIconBitmap = BitmapFactory.decodeByteArray(favoriteIconByteArray, 0, favoriteIconByteArray.size)