]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java
Combine drawable files. https://redmine.stoutner.com/issues/794
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / fragments / DomainSettingsFragment.java
index ad6653c5387644b7d4fec5f39d3d9d70a9700bf0..1ce0e3cccd5a7668b52f85738652ec8692f344a7 100644 (file)
@@ -1,20 +1,20 @@
 /*
- * Copyright © 2017-2018 Soren Stoutner <soren@stoutner.com>.
+ * Copyright © 2017-2022 Soren Stoutner <soren@stoutner.com>.
  *
- * This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
+ * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
  *
- * Privacy Browser is free software: you can redistribute it and/or modify
+ * Privacy Browser Android is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
- * Privacy Browser is distributed in the hope that it will be useful,
+ * Privacy Browser Android is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>.
+ * along with Privacy Browser Android.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 package com.stoutner.privacybrowser.fragments;
@@ -22,15 +22,12 @@ package com.stoutner.privacybrowser.fragments;
 import android.annotation.SuppressLint;
 import android.content.Context;
 import android.content.SharedPreferences;
+import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.database.Cursor;
-import android.net.http.SslCertificate;
 import android.os.Build;
 import android.os.Bundle;
-// `android.support.v4.app.Fragment` must be used until minimum API >= 23.  Otherwise `getContext()` does not work.
 import android.preference.PreferenceManager;
-import android.support.annotation.NonNull;
-import android.support.v4.app.Fragment;
 import android.text.Editable;
 import android.text.SpannableStringBuilder;
 import android.text.Spanned;
@@ -47,11 +44,18 @@ import android.widget.EditText;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.RadioButton;
+import android.widget.ScrollView;
 import android.widget.Spinner;
-import android.widget.Switch;
 import android.widget.TextView;
 
+import androidx.annotation.NonNull;
+import androidx.appcompat.widget.SwitchCompat;
+import androidx.cardview.widget.CardView;
+import androidx.core.content.res.ResourcesCompat;
+import androidx.fragment.app.Fragment;  // The AndroidX fragment must be used until minimum API >= 23.  Otherwise `getContext()` does not work.
+
 import com.stoutner.privacybrowser.R;
+import com.stoutner.privacybrowser.activities.DomainsActivity;
 import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 import com.stoutner.privacybrowser.helpers.DomainsDatabaseHelper;
 
@@ -60,14 +64,19 @@ import java.util.Calendar;
 import java.util.Date;
 
 public class DomainSettingsFragment extends Fragment {
-    // `DATABASE_ID` is used by activities calling this fragment.
+    // Initialize the public class constants.  These are used by activities calling this fragment.
     public static final String DATABASE_ID = "database_id";
+    public static final String SCROLL_Y = "scroll_y";
 
-    // `databaseId` is public static so it can be accessed from `DomainsActivity`. It is also used in `onCreate()` and `onCreateView()`.
+    // Define the public variables.  `databaseId` is public static so it can be accessed from `DomainsActivity`. It is also used in `onCreate()` and `onCreateView()`.
     public static int databaseId;
 
+    // Define the class variables.
+    private int scrollY;
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
+        // Run the default commands.
         super.onCreate(savedInstanceState);
 
         // Remove the lint warning that `getArguments` might be null.
@@ -75,210 +84,224 @@ public class DomainSettingsFragment extends Fragment {
 
         // Store the database id in `databaseId`.
         databaseId = getArguments().getInt(DATABASE_ID);
+        scrollY = getArguments().getInt(SCROLL_Y);
     }
 
     // The deprecated `getDrawable()` must be used until the minimum API >= 21.
-    @SuppressWarnings("deprecation")
     @Override
     public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         // Inflate `domain_settings_fragment`.  `false` does not attach it to the root `container`.
         View domainSettingsView = inflater.inflate(R.layout.domain_settings_fragment, container, false);
 
-        // Get a handle for the `Context` and the `Resources`.
+        // Get handles for the context and the resources.
         Context context = getContext();
-        final Resources resources = getResources();
+        Resources resources = getResources();
+
+        // Remove the error below that the context might be null.
+        assert context != null;
+
+        // Get the current theme status.
+        int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
 
         // Get a handle for the shared preference.
         SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
 
         // Store the default settings.
-        final String defaultUserAgentName = sharedPreferences.getString("user_agent", "Privacy Browser");
-        final String defaultCustomUserAgentString = sharedPreferences.getString("custom_user_agent", "PrivacyBrowser/1.0");
-        String defaultFontSizeString = sharedPreferences.getString("default_font_size", "100");
+        String defaultUserAgentName = sharedPreferences.getString("user_agent", getString(R.string.user_agent_default_value));
+        String defaultCustomUserAgentString = sharedPreferences.getString("custom_user_agent", getString(R.string.custom_user_agent_default_value));
+        String defaultFontSizeString = sharedPreferences.getString("font_size", getString(R.string.font_size_default_value));
         boolean defaultSwipeToRefresh = sharedPreferences.getBoolean("swipe_to_refresh", true);
-        final boolean defaultNightMode = sharedPreferences.getBoolean("night_mode", false);
-        final boolean defaultDisplayWebpageImages = sharedPreferences.getBoolean("display_webpage_images", true);
-
-        // Get handles for the views in the fragment.
-        final EditText domainNameEditText = domainSettingsView.findViewById(R.id.domain_settings_name_edittext);
-        final Switch javaScriptEnabledSwitch = domainSettingsView.findViewById(R.id.domain_settings_javascript_switch);
-        final ImageView javaScriptImageView = domainSettingsView.findViewById(R.id.domain_settings_javascript_imageview);
-        Switch firstPartyCookiesEnabledSwitch = domainSettingsView.findViewById(R.id.domain_settings_first_party_cookies_switch);
-        final ImageView firstPartyCookiesImageView = domainSettingsView.findViewById(R.id.domain_settings_first_party_cookies_imageview);
-        LinearLayout thirdPartyCookiesLinearLayout = domainSettingsView.findViewById(R.id.domain_settings_third_party_cookies_linearlayout);
-        final Switch thirdPartyCookiesEnabledSwitch = domainSettingsView.findViewById(R.id.domain_settings_third_party_cookies_switch);
-        final ImageView thirdPartyCookiesImageView = domainSettingsView.findViewById(R.id.domain_settings_third_party_cookies_imageview);
-        final Switch domStorageEnabledSwitch = domainSettingsView.findViewById(R.id.domain_settings_dom_storage_switch);
-        final ImageView domStorageImageView = domainSettingsView.findViewById(R.id.domain_settings_dom_storage_imageview);
-        Switch formDataEnabledSwitch = domainSettingsView.findViewById(R.id.domain_settings_form_data_switch);  // The form data views can be remove once the minimum API >= 26.
-        final ImageView formDataImageView = domainSettingsView.findViewById(R.id.domain_settings_form_data_imageview);  // The form data views can be remove once the minimum API >= 26.
-        Switch easyListSwitch = domainSettingsView.findViewById(R.id.domain_settings_easylist_switch);
-        ImageView easyListImageView = domainSettingsView.findViewById(R.id.domain_settings_easylist_imageview);
-        Switch easyPrivacySwitch = domainSettingsView.findViewById(R.id.domain_settings_easyprivacy_switch);
-        ImageView easyPrivacyImageView = domainSettingsView.findViewById(R.id.domain_settings_easyprivacy_imageview);
-        Switch fanboysAnnoyanceListSwitch = domainSettingsView.findViewById(R.id.domain_settings_fanboys_annoyance_list_switch);
-        ImageView fanboysAnnoyanceListImageView = domainSettingsView.findViewById(R.id.domain_settings_fanboys_annoyance_list_imageview);
-        Switch fanboysSocialBlockingListSwitch = domainSettingsView.findViewById(R.id.domain_settings_fanboys_social_blocking_list_switch);
-        ImageView fanboysSocialBlockingListImageView = domainSettingsView.findViewById(R.id.domain_settings_fanboys_social_blocking_list_imageview);
-        Switch ultraPrivacySwitch = domainSettingsView.findViewById(R.id.domain_settings_ultraprivacy_switch);
-        ImageView ultraPrivacyImageView = domainSettingsView.findViewById(R.id.domain_settings_ultraprivacy_imageview);
-        Switch blockAllThirdPartyRequestsSwitch = domainSettingsView.findViewById(R.id.domain_settings_block_all_third_party_requests_switch);
-        ImageView blockAllThirdPartyRequestsImageView = domainSettingsView.findViewById(R.id.domain_settings_block_all_third_party_requests_imageview);
-        final Spinner userAgentSpinner = domainSettingsView.findViewById(R.id.domain_settings_user_agent_spinner);
-        final TextView userAgentTextView = domainSettingsView.findViewById(R.id.domain_settings_user_agent_textview);
-        final EditText customUserAgentEditText = domainSettingsView.findViewById(R.id.domain_settings_custom_user_agent_edittext);
-        final Spinner fontSizeSpinner = domainSettingsView.findViewById(R.id.domain_settings_font_size_spinner);
-        final TextView fontSizeTextView = domainSettingsView.findViewById(R.id.domain_settings_font_size_textview);
-        final ImageView swipeToRefreshImageView = domainSettingsView.findViewById(R.id.domain_settings_swipe_to_refresh_imageview);
-        final Spinner swipeToRefreshSpinner = domainSettingsView.findViewById(R.id.domain_settings_swipe_to_refresh_spinner);
-        final TextView swipeToRefreshTextView = domainSettingsView.findViewById(R.id.domain_settings_swipe_to_refresh_textview);
-        final ImageView nightModeImageView = domainSettingsView.findViewById(R.id.domain_settings_night_mode_imageview);
-        final Spinner nightModeSpinner = domainSettingsView.findViewById(R.id.domain_settings_night_mode_spinner);
-        final TextView nightModeTextView = domainSettingsView.findViewById(R.id.domain_settings_night_mode_textview);
-        final ImageView displayWebpageImagesImageView = domainSettingsView.findViewById(R.id.domain_settings_display_webpage_images_imageview);
-        final Spinner displayWebpageImagesSpinner = domainSettingsView.findViewById(R.id.domain_settings_display_webpage_images_spinner);
-        final TextView displayImagesTextView = domainSettingsView.findViewById(R.id.domain_settings_display_webpage_images_textview);
-        final ImageView pinnedSslCertificateImageView = domainSettingsView.findViewById(R.id.domain_settings_pinned_ssl_certificate_imageview);
-        Switch pinnedSslCertificateSwitch = domainSettingsView.findViewById(R.id.domain_settings_pinned_ssl_certificate_switch);
-        final LinearLayout savedSslCertificateLinearLayout = domainSettingsView.findViewById(R.id.saved_ssl_certificate_linearlayout);
-        final RadioButton savedSslCertificateRadioButton = domainSettingsView.findViewById(R.id.saved_ssl_certificate_radiobutton);
-        final TextView savedSslCertificateIssuedToCNameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_to_cname);
-        TextView savedSslCertificateIssuedToONameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_to_oname);
-        TextView savedSslCertificateIssuedToUNameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_to_uname);
-        TextView savedSslCertificateIssuedByCNameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_by_cname);
-        TextView savedSslCertificateIssuedByONameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_by_oname);
-        TextView savedSslCertificateIssuedByUNameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_by_uname);
-        TextView savedSslCertificateStartDateTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_start_date);
-        TextView savedSslCertificateEndDateTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_end_date);
-        final LinearLayout currentWebsiteCertificateLinearLayout = domainSettingsView.findViewById(R.id.current_website_certificate_linearlayout);
-        final RadioButton currentWebsiteCertificateRadioButton = domainSettingsView.findViewById(R.id.current_website_certificate_radiobutton);
-        final TextView currentWebsiteCertificateIssuedToCNameTextView = domainSettingsView.findViewById(R.id.current_website_certificate_issued_to_cname);
-        TextView currentWebsiteCertificateIssuedToONameTextView = domainSettingsView.findViewById(R.id.current_website_certificate_issued_to_oname);
-        TextView currentWebsiteCertificateIssuedToUNameTextView = domainSettingsView.findViewById(R.id.current_website_certificate_issued_to_uname);
-        TextView currentWebsiteCertificateIssuedByCNameTextView = domainSettingsView.findViewById(R.id.current_website_certificate_issued_by_cname);
-        TextView currentWebsiteCertificateIssuedByONameTextView = domainSettingsView.findViewById(R.id.current_website_certificate_issued_by_oname);
-        TextView currentWebsiteCertificateIssuedByUNameTextView = domainSettingsView.findViewById(R.id.current_website_certificate_issued_by_uname);
-        TextView currentWebsiteCertificateStartDateTextView = domainSettingsView.findViewById(R.id.current_website_certificate_start_date);
-        TextView currentWebsiteCertificateEndDateTextView = domainSettingsView.findViewById(R.id.current_website_certificate_end_date);
-        final TextView noCurrentWebsiteCertificateTextView = domainSettingsView.findViewById(R.id.no_current_website_certificate);
-
-        // Setup the SSL certificate labels.
-        final String cNameLabel = getString(R.string.common_name) + "  ";
+        String defaultWebViewTheme = sharedPreferences.getString("webview_theme", getString(R.string.webview_theme_default_value));
+        boolean defaultWideViewport = sharedPreferences.getBoolean("wide_viewport", true);
+        boolean defaultDisplayWebpageImages = sharedPreferences.getBoolean("display_webpage_images", true);
+
+        // Get handles for the views.
+        ScrollView domainSettingsScrollView = domainSettingsView.findViewById(R.id.domain_settings_scrollview);
+        EditText domainNameEditText = domainSettingsView.findViewById(R.id.domain_settings_name_edittext);
+        ImageView javaScriptImageView = domainSettingsView.findViewById(R.id.javascript_imageview);
+        SwitchCompat javaScriptSwitch = domainSettingsView.findViewById(R.id.javascript_switch);
+        ImageView cookiesImageView = domainSettingsView.findViewById(R.id.cookies_imageview);
+        SwitchCompat cookiesSwitch = domainSettingsView.findViewById(R.id.cookies_switch);
+        ImageView domStorageImageView = domainSettingsView.findViewById(R.id.dom_storage_imageview);
+        SwitchCompat domStorageSwitch = domainSettingsView.findViewById(R.id.dom_storage_switch);
+        ImageView formDataImageView = domainSettingsView.findViewById(R.id.form_data_imageview);  // The form data views can be remove once the minimum API >= 26.
+        SwitchCompat formDataSwitch = domainSettingsView.findViewById(R.id.form_data_switch);  // The form data views can be remove once the minimum API >= 26.
+        ImageView easyListImageView = domainSettingsView.findViewById(R.id.easylist_imageview);
+        SwitchCompat easyListSwitch = domainSettingsView.findViewById(R.id.easylist_switch);
+        ImageView easyPrivacyImageView = domainSettingsView.findViewById(R.id.easyprivacy_imageview);
+        SwitchCompat easyPrivacySwitch = domainSettingsView.findViewById(R.id.easyprivacy_switch);
+        ImageView fanboysAnnoyanceListImageView = domainSettingsView.findViewById(R.id.fanboys_annoyance_list_imageview);
+        SwitchCompat fanboysAnnoyanceListSwitch = domainSettingsView.findViewById(R.id.fanboys_annoyance_list_switch);
+        ImageView fanboysSocialBlockingListImageView = domainSettingsView.findViewById(R.id.fanboys_social_blocking_list_imageview);
+        SwitchCompat fanboysSocialBlockingListSwitch = domainSettingsView.findViewById(R.id.fanboys_social_blocking_list_switch);
+        ImageView ultraListImageView = domainSettingsView.findViewById(R.id.ultralist_imageview);
+        SwitchCompat ultraListSwitch = domainSettingsView.findViewById(R.id.ultralist_switch);
+        ImageView ultraPrivacyImageView = domainSettingsView.findViewById(R.id.ultraprivacy_imageview);
+        SwitchCompat ultraPrivacySwitch = domainSettingsView.findViewById(R.id.ultraprivacy_switch);
+        ImageView blockAllThirdPartyRequestsImageView = domainSettingsView.findViewById(R.id.block_all_third_party_requests_imageview);
+        SwitchCompat blockAllThirdPartyRequestsSwitch = domainSettingsView.findViewById(R.id.block_all_third_party_requests_switch);
+        Spinner userAgentSpinner = domainSettingsView.findViewById(R.id.user_agent_spinner);
+        TextView userAgentTextView = domainSettingsView.findViewById(R.id.user_agent_textview);
+        EditText customUserAgentEditText = domainSettingsView.findViewById(R.id.custom_user_agent_edittext);
+        Spinner fontSizeSpinner = domainSettingsView.findViewById(R.id.font_size_spinner);
+        TextView defaultFontSizeTextView = domainSettingsView.findViewById(R.id.default_font_size_textview);
+        EditText customFontSizeEditText = domainSettingsView.findViewById(R.id.custom_font_size_edittext);
+        ImageView swipeToRefreshImageView = domainSettingsView.findViewById(R.id.swipe_to_refresh_imageview);
+        Spinner swipeToRefreshSpinner = domainSettingsView.findViewById(R.id.swipe_to_refresh_spinner);
+        TextView swipeToRefreshTextView = domainSettingsView.findViewById(R.id.swipe_to_refresh_textview);
+        ImageView webViewThemeImageView = domainSettingsView.findViewById(R.id.webview_theme_imageview);
+        Spinner webViewThemeSpinner = domainSettingsView.findViewById(R.id.webview_theme_spinner);
+        TextView webViewThemeTextView = domainSettingsView.findViewById(R.id.webview_theme_textview);
+        ImageView wideViewportImageView = domainSettingsView.findViewById(R.id.wide_viewport_imageview);
+        Spinner wideViewportSpinner = domainSettingsView.findViewById(R.id.wide_viewport_spinner);
+        TextView wideViewportTextView = domainSettingsView.findViewById(R.id.wide_viewport_textview);
+        ImageView displayWebpageImagesImageView = domainSettingsView.findViewById(R.id.display_webpage_images_imageview);
+        Spinner displayWebpageImagesSpinner = domainSettingsView.findViewById(R.id.display_webpage_images_spinner);
+        TextView displayImagesTextView = domainSettingsView.findViewById(R.id.display_webpage_images_textview);
+        ImageView pinnedSslCertificateImageView = domainSettingsView.findViewById(R.id.pinned_ssl_certificate_imageview);
+        SwitchCompat pinnedSslCertificateSwitch = domainSettingsView.findViewById(R.id.pinned_ssl_certificate_switch);
+        CardView savedSslCardView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_cardview);
+        LinearLayout savedSslCertificateLinearLayout = domainSettingsView.findViewById(R.id.saved_ssl_certificate_linearlayout);
+        RadioButton savedSslCertificateRadioButton = domainSettingsView.findViewById(R.id.saved_ssl_certificate_radiobutton);
+        TextView savedSslIssuedToCNameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_to_cname);
+        TextView savedSslIssuedToONameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_to_oname);
+        TextView savedSslIssuedToUNameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_to_uname);
+        TextView savedSslIssuedByCNameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_by_cname);
+        TextView savedSslIssuedByONameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_by_oname);
+        TextView savedSslIssuedByUNameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_by_uname);
+        TextView savedSslStartDateTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_start_date);
+        TextView savedSslEndDateTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_end_date);
+        CardView currentSslCardView = domainSettingsView.findViewById(R.id.current_website_certificate_cardview);
+        LinearLayout currentWebsiteCertificateLinearLayout = domainSettingsView.findViewById(R.id.current_website_certificate_linearlayout);
+        RadioButton currentWebsiteCertificateRadioButton = domainSettingsView.findViewById(R.id.current_website_certificate_radiobutton);
+        TextView currentSslIssuedToCNameTextView = domainSettingsView.findViewById(R.id.current_website_certificate_issued_to_cname);
+        TextView currentSslIssuedToONameTextView = domainSettingsView.findViewById(R.id.current_website_certificate_issued_to_oname);
+        TextView currentSslIssuedToUNameTextView = domainSettingsView.findViewById(R.id.current_website_certificate_issued_to_uname);
+        TextView currentSslIssuedByCNameTextView = domainSettingsView.findViewById(R.id.current_website_certificate_issued_by_cname);
+        TextView currentSslIssuedByONameTextView = domainSettingsView.findViewById(R.id.current_website_certificate_issued_by_oname);
+        TextView currentSslIssuedByUNameTextView = domainSettingsView.findViewById(R.id.current_website_certificate_issued_by_uname);
+        TextView currentSslStartDateTextView = domainSettingsView.findViewById(R.id.current_website_certificate_start_date);
+        TextView currentSslEndDateTextView = domainSettingsView.findViewById(R.id.current_website_certificate_end_date);
+        TextView noCurrentWebsiteCertificateTextView = domainSettingsView.findViewById(R.id.no_current_website_certificate);
+        ImageView pinnedIpAddressesImageView = domainSettingsView.findViewById(R.id.pinned_ip_addresses_imageview);
+        SwitchCompat pinnedIpAddressesSwitch = domainSettingsView.findViewById(R.id.pinned_ip_addresses_switch);
+        CardView savedIpAddressesCardView = domainSettingsView.findViewById(R.id.saved_ip_addresses_cardview);
+        LinearLayout savedIpAddressesLinearLayout = domainSettingsView.findViewById(R.id.saved_ip_addresses_linearlayout);
+        RadioButton savedIpAddressesRadioButton = domainSettingsView.findViewById(R.id.saved_ip_addresses_radiobutton);
+        TextView savedIpAddressesTextView = domainSettingsView.findViewById(R.id.saved_ip_addresses_textview);
+        CardView currentIpAddressesCardView = domainSettingsView.findViewById(R.id.current_ip_addresses_cardview);
+        LinearLayout currentIpAddressesLinearLayout = domainSettingsView.findViewById(R.id.current_ip_addresses_linearlayout);
+        RadioButton currentIpAddressesRadioButton = domainSettingsView.findViewById(R.id.current_ip_addresses_radiobutton);
+        TextView currentIpAddressesTextView = domainSettingsView.findViewById(R.id.current_ip_addresses_textview);
+
+        // Setup the pinned labels.
+        String cNameLabel = getString(R.string.common_name) + "  ";
         String oNameLabel = getString(R.string.organization) + "  ";
         String uNameLabel = getString(R.string.organizational_unit) + "  ";
         String startDateLabel = getString(R.string.start_date) + "  ";
         String endDateLabel = getString(R.string.end_date) + "  ";
 
-        // Get the current website SSL certificate
-        final SslCertificate currentWebsiteSslCertificate = MainWebViewActivity.sslCertificate;
-
         // Initialize the database handler.  The `0` specifies the database version, but that is ignored and set instead using a constant in `DomainsDatabaseHelper`.
         DomainsDatabaseHelper domainsDatabaseHelper = new DomainsDatabaseHelper(context, null, null, 0);
 
-        // Get the database `Cursor` for this ID and move it to the first row.
+        // Get the database cursor for this ID and move it to the first row.
         Cursor domainCursor = domainsDatabaseHelper.getCursorForId(databaseId);
         domainCursor.moveToFirst();
 
-        // Save the `Cursor` entries as variables.
-        String domainNameString = domainCursor.getString(domainCursor.getColumnIndex(DomainsDatabaseHelper.DOMAIN_NAME));
-        final int javaScriptEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_JAVASCRIPT));
-        int firstPartyCookiesEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_FIRST_PARTY_COOKIES));
-        int thirdPartyCookiesEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_THIRD_PARTY_COOKIES));
-        final int domStorageEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_DOM_STORAGE));
-        int formDataEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_FORM_DATA));  // Form data can be remove once the minimum API >= 26.
-        int easyListEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_EASYLIST));
-        int easyPrivacyEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_EASYPRIVACY));
-        int fanboysAnnoyanceListInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_FANBOYS_ANNOYANCE_LIST));
-        int fanboysSocialBlockingListInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_FANBOYS_SOCIAL_BLOCKING_LIST));
-        int ultraPrivacyEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_ULTRAPRIVACY));
-        int blockAllThirdPartyRequestsInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.BLOCK_ALL_THIRD_PARTY_REQUESTS));
-        final String currentUserAgentName = domainCursor.getString(domainCursor.getColumnIndex(DomainsDatabaseHelper.USER_AGENT));
-        int fontSizeInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.FONT_SIZE));
-        int swipeToRefreshInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.SWIPE_TO_REFRESH));
-        int nightModeInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.NIGHT_MODE));
-        int displayImagesInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.DISPLAY_IMAGES));
-        int pinnedSslCertificateInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.PINNED_SSL_CERTIFICATE));
-        final String savedSslCertificateIssuedToCNameString = domainCursor.getString(domainCursor.getColumnIndex(DomainsDatabaseHelper.SSL_ISSUED_TO_COMMON_NAME));
-        String savedSslCertificateIssuedToONameString = domainCursor.getString(domainCursor.getColumnIndex(DomainsDatabaseHelper.SSL_ISSUED_TO_ORGANIZATION));
-        String savedSslCertificateIssuedToUNameString = domainCursor.getString(domainCursor.getColumnIndex(DomainsDatabaseHelper.SSL_ISSUED_TO_ORGANIZATIONAL_UNIT));
-        String savedSslCertificateIssuedByCNameString = domainCursor.getString(domainCursor.getColumnIndex(DomainsDatabaseHelper.SSL_ISSUED_BY_COMMON_NAME));
-        String savedSslCertificateIssuedByONameString = domainCursor.getString(domainCursor.getColumnIndex(DomainsDatabaseHelper.SSL_ISSUED_BY_ORGANIZATION));
-        String savedSslCertificateIssuedByUNameString = domainCursor.getString(domainCursor.getColumnIndex(DomainsDatabaseHelper.SSL_ISSUED_BY_ORGANIZATIONAL_UNIT));
+        // Save the cursor entries as variables.
+        String domainNameString = domainCursor.getString(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.DOMAIN_NAME));
+        int javaScriptInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.ENABLE_JAVASCRIPT));
+        int cookiesInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.COOKIES));
+        int domStorageInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.ENABLE_DOM_STORAGE));
+        int formDataInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.ENABLE_FORM_DATA));  // Form data can be remove once the minimum API >= 26.
+        int easyListInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.ENABLE_EASYLIST));
+        int easyPrivacyInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.ENABLE_EASYPRIVACY));
+        int fanboysAnnoyanceListInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.ENABLE_FANBOYS_ANNOYANCE_LIST));
+        int fanboysSocialBlockingListInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.ENABLE_FANBOYS_SOCIAL_BLOCKING_LIST));
+        int ultraListInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.ULTRALIST));
+        int ultraPrivacyInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.ENABLE_ULTRAPRIVACY));
+        int blockAllThirdPartyRequestsInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.BLOCK_ALL_THIRD_PARTY_REQUESTS));
+        String currentUserAgentName = domainCursor.getString(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.USER_AGENT));
+        int fontSizeInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.FONT_SIZE));
+        int swipeToRefreshInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.SWIPE_TO_REFRESH));
+        int webViewThemeInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.WEBVIEW_THEME));
+        int wideViewportInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.WIDE_VIEWPORT));
+        int displayImagesInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.DISPLAY_IMAGES));
+        int pinnedSslCertificateInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.PINNED_SSL_CERTIFICATE));
+        String savedSslIssuedToCNameString = domainCursor.getString(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.SSL_ISSUED_TO_COMMON_NAME));
+        String savedSslIssuedToONameString = domainCursor.getString(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.SSL_ISSUED_TO_ORGANIZATION));
+        String savedSslIssuedToUNameString = domainCursor.getString(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.SSL_ISSUED_TO_ORGANIZATIONAL_UNIT));
+        String savedSslIssuedByCNameString = domainCursor.getString(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.SSL_ISSUED_BY_COMMON_NAME));
+        String savedSslIssuedByONameString = domainCursor.getString(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.SSL_ISSUED_BY_ORGANIZATION));
+        String savedSslIssuedByUNameString = domainCursor.getString(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.SSL_ISSUED_BY_ORGANIZATIONAL_UNIT));
+        int pinnedIpAddressesInt = domainCursor.getInt(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.PINNED_IP_ADDRESSES));
+        String savedIpAddresses = domainCursor.getString(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.IP_ADDRESSES));
 
         // Initialize the saved SSL certificate date variables.
-        Date savedSslCertificateStartDate = null;
-        Date savedSslCertificateEndDate = null;
+        Date savedSslStartDate = null;
+        Date savedSslEndDate = null;
 
         // Only get the saved SSL certificate dates from the cursor if they are not set to `0`.
-        if (domainCursor.getLong(domainCursor.getColumnIndex(DomainsDatabaseHelper.SSL_START_DATE)) != 0) {
-            savedSslCertificateStartDate = new Date(domainCursor.getLong(domainCursor.getColumnIndex(DomainsDatabaseHelper.SSL_START_DATE)));
+        if (domainCursor.getLong(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.SSL_START_DATE)) != 0) {
+            savedSslStartDate = new Date(domainCursor.getLong(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.SSL_START_DATE)));
         }
 
-        if (domainCursor.getLong(domainCursor.getColumnIndex(DomainsDatabaseHelper.SSL_END_DATE)) != 0) {
-            savedSslCertificateEndDate = new Date(domainCursor.getLong(domainCursor.getColumnIndex(DomainsDatabaseHelper.SSL_END_DATE)));
+        if (domainCursor.getLong(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.SSL_END_DATE)) != 0) {
+            savedSslEndDate = new Date(domainCursor.getLong(domainCursor.getColumnIndexOrThrow(DomainsDatabaseHelper.SSL_END_DATE)));
         }
 
         // Create array adapters for the spinners.
         ArrayAdapter<CharSequence> translatedUserAgentArrayAdapter = ArrayAdapter.createFromResource(context, R.array.translated_domain_settings_user_agent_names, R.layout.spinner_item);
-        ArrayAdapter<CharSequence> fontSizeArrayAdapter = ArrayAdapter.createFromResource(context, R.array.domain_settings_font_size_entries, R.layout.spinner_item);
-        ArrayAdapter<CharSequence> fontSizeEntryValuesArrayAdapter = ArrayAdapter.createFromResource(context, R.array.domain_settings_font_size_entry_values, R.layout.spinner_item);
+        ArrayAdapter<CharSequence> fontSizeArrayAdapter = ArrayAdapter.createFromResource(context, R.array.font_size_array, R.layout.spinner_item);
         ArrayAdapter<CharSequence> swipeToRefreshArrayAdapter = ArrayAdapter.createFromResource(context, R.array.swipe_to_refresh_array, R.layout.spinner_item);
-        ArrayAdapter<CharSequence> nightModeArrayAdapter = ArrayAdapter.createFromResource(context, R.array.night_mode_array, R.layout.spinner_item);
+        ArrayAdapter<CharSequence> webViewThemeArrayAdapter = ArrayAdapter.createFromResource(context, R.array.webview_theme_array, R.layout.spinner_item);
+        ArrayAdapter<CharSequence> wideViewportArrayAdapter = ArrayAdapter.createFromResource(context, R.array.wide_viewport_array, R.layout.spinner_item);
         ArrayAdapter<CharSequence> displayImagesArrayAdapter = ArrayAdapter.createFromResource(context, R.array.display_webpage_images_array, R.layout.spinner_item);
 
         // Set the drop down view resource on the spinners.
         translatedUserAgentArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_items);
         fontSizeArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_items);
         swipeToRefreshArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_items);
-        nightModeArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_items);
+        webViewThemeArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_items);
+        wideViewportArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_items);
         displayImagesArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_items);
 
         // Set the array adapters for the spinners.
         userAgentSpinner.setAdapter(translatedUserAgentArrayAdapter);
         fontSizeSpinner.setAdapter(fontSizeArrayAdapter);
         swipeToRefreshSpinner.setAdapter(swipeToRefreshArrayAdapter);
-        nightModeSpinner.setAdapter(nightModeArrayAdapter);
+        webViewThemeSpinner.setAdapter(webViewThemeArrayAdapter);
+        wideViewportSpinner.setAdapter(wideViewportArrayAdapter);
         displayWebpageImagesSpinner.setAdapter(displayImagesArrayAdapter);
 
         // Create a spannable string builder for each TextView that needs multiple colors of text.
-        SpannableStringBuilder savedSslCertificateIssuedToCNameStringBuilder = new SpannableStringBuilder(cNameLabel + savedSslCertificateIssuedToCNameString);
-        SpannableStringBuilder savedSslCertificateIssuedToONameStringBuilder = new SpannableStringBuilder(oNameLabel + savedSslCertificateIssuedToONameString);
-        SpannableStringBuilder savedSslCertificateIssuedToUNameStringBuilder = new SpannableStringBuilder(uNameLabel + savedSslCertificateIssuedToUNameString);
-        SpannableStringBuilder savedSslCertificateIssuedByCNameStringBuilder = new SpannableStringBuilder(cNameLabel + savedSslCertificateIssuedByCNameString);
-        SpannableStringBuilder savedSslCertificateIssuedByONameStringBuilder = new SpannableStringBuilder(oNameLabel + savedSslCertificateIssuedByONameString);
-        SpannableStringBuilder savedSslCertificateIssuedByUNameStringBuilder = new SpannableStringBuilder(uNameLabel + savedSslCertificateIssuedByUNameString);
+        SpannableStringBuilder savedSslIssuedToCNameStringBuilder = new SpannableStringBuilder(cNameLabel + savedSslIssuedToCNameString);
+        SpannableStringBuilder savedSslIssuedToONameStringBuilder = new SpannableStringBuilder(oNameLabel + savedSslIssuedToONameString);
+        SpannableStringBuilder savedSslIssuedToUNameStringBuilder = new SpannableStringBuilder(uNameLabel + savedSslIssuedToUNameString);
+        SpannableStringBuilder savedSslIssuedByCNameStringBuilder = new SpannableStringBuilder(cNameLabel + savedSslIssuedByCNameString);
+        SpannableStringBuilder savedSslIssuedByONameStringBuilder = new SpannableStringBuilder(oNameLabel + savedSslIssuedByONameString);
+        SpannableStringBuilder savedSslIssuedByUNameStringBuilder = new SpannableStringBuilder(uNameLabel + savedSslIssuedByUNameString);
 
-        // Initialize the `SpannableStringBuilders` for the SSL certificate dates.
-        SpannableStringBuilder savedSslCertificateStartDateStringBuilder;
-        SpannableStringBuilder savedSslCertificateEndDateStringBuilder;
+        // Initialize the spannable string builders for the saved SSL certificate dates.
+        SpannableStringBuilder savedSslStartDateStringBuilder;
+        SpannableStringBuilder savedSslEndDateStringBuilder;
 
         // Leave the SSL certificate dates empty if they are `null`.
-        if (savedSslCertificateStartDate == null) {
-            savedSslCertificateStartDateStringBuilder = new SpannableStringBuilder(startDateLabel);
+        if (savedSslStartDate == null) {
+            savedSslStartDateStringBuilder = new SpannableStringBuilder(startDateLabel);
         } else {
-            savedSslCertificateStartDateStringBuilder = new SpannableStringBuilder(startDateLabel + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(savedSslCertificateStartDate));
+            savedSslStartDateStringBuilder = new SpannableStringBuilder(startDateLabel + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(savedSslStartDate));
         }
 
-        if (savedSslCertificateEndDate == null) {
-            savedSslCertificateEndDateStringBuilder = new SpannableStringBuilder(endDateLabel);
+        if (savedSslEndDate == null) {
+            savedSslEndDateStringBuilder = new SpannableStringBuilder(endDateLabel);
         } else {
-            savedSslCertificateEndDateStringBuilder = new SpannableStringBuilder(endDateLabel + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(savedSslCertificateEndDate));
+            savedSslEndDateStringBuilder = new SpannableStringBuilder(endDateLabel + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(savedSslEndDate));
         }
 
-        // Create a red `ForegroundColorSpan`.  We have to use the deprecated `getColor` until API >= 23.
-        final ForegroundColorSpan redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_a700));
-
-        // Create a blue `ForegroundColorSpan`.
-        final ForegroundColorSpan blueColorSpan;
-
-        // Set `blueColorSpan` according to the theme.  We have to use the deprecated `getColor()` until API >= 23.
-        if (MainWebViewActivity.darkTheme) {
-            //noinspection deprecation
-            blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_400));
-        } else {
-            //noinspection deprecation
-            blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_700));
-        }
+        // Create the color spans.
+        final ForegroundColorSpan blueColorSpan = new ForegroundColorSpan(context.getColor(R.color.blue_text));
+        final ForegroundColorSpan redColorSpan = new ForegroundColorSpan(context.getColor(R.color.red_text));
 
         // Set the domain name from the the database cursor.
         domainNameEditText.setText(domainNameString);
@@ -301,344 +324,242 @@ public class DomainSettingsFragment extends Fragment {
                 String newDomainName = domainNameEditText.getText().toString();
 
                 // Check the saved SSL certificate against the new domain name.
-                boolean savedSslCertificateMatchesNewDomainName = checkDomainNameAgainstCertificate(newDomainName, savedSslCertificateIssuedToCNameString);
+                boolean savedSslMatchesNewDomainName = checkDomainNameAgainstCertificate(newDomainName, savedSslIssuedToCNameString);
 
                 // Create a `SpannableStringBuilder` for the saved certificate `Common Name`.
-                SpannableStringBuilder savedSslCertificateCommonNameStringBuilder = new SpannableStringBuilder(cNameLabel + savedSslCertificateIssuedToCNameString);
+                SpannableStringBuilder savedSslCNameStringBuilder = new SpannableStringBuilder(cNameLabel + savedSslIssuedToCNameString);
 
                 // Format the saved certificate `Common Name` color.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
-                if (savedSslCertificateMatchesNewDomainName) {
-                    savedSslCertificateCommonNameStringBuilder.setSpan(blueColorSpan, cNameLabel.length(), savedSslCertificateCommonNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+                if (savedSslMatchesNewDomainName) {
+                    savedSslCNameStringBuilder.setSpan(blueColorSpan, cNameLabel.length(), savedSslCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
                 } else {
-                    savedSslCertificateCommonNameStringBuilder.setSpan(redColorSpan, cNameLabel.length(), savedSslCertificateCommonNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+                    savedSslCNameStringBuilder.setSpan(redColorSpan, cNameLabel.length(), savedSslCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
                 }
 
-                // Update `savedSslCertificateIssuedToCNameTextView`.
-                savedSslCertificateIssuedToCNameTextView.setText(savedSslCertificateCommonNameStringBuilder);
+                // Update the saved SSL issued to CName text view.
+                savedSslIssuedToCNameTextView.setText(savedSslCNameStringBuilder);
 
                 // Update the current website certificate if it exists.
-                if (currentWebsiteSslCertificate != null) {
-                    // Get the current website certificate `Common Name`.
-                    String currentWebsiteCertificateCommonName = currentWebsiteSslCertificate.getIssuedTo().getCName();
-
+                if (DomainsActivity.sslIssuedToCName != null) {
                     // Check the current website certificate against the new domain name.
-                    boolean currentWebsiteCertificateMatchesNewDomainName = checkDomainNameAgainstCertificate(newDomainName, currentWebsiteCertificateCommonName);
+                    boolean currentSslMatchesNewDomainName = checkDomainNameAgainstCertificate(newDomainName, DomainsActivity.sslIssuedToCName);
 
                     // Create a `SpannableStringBuilder` for the current website certificate `Common Name`.
-                    SpannableStringBuilder currentWebsiteCertificateCommonNameStringBuilder = new SpannableStringBuilder(cNameLabel + currentWebsiteCertificateCommonName);
+                    SpannableStringBuilder currentSslCNameStringBuilder = new SpannableStringBuilder(cNameLabel + DomainsActivity.sslIssuedToCName);
 
                     // Format the current certificate `Common Name` color.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
-                    if (currentWebsiteCertificateMatchesNewDomainName) {
-                        currentWebsiteCertificateCommonNameStringBuilder.setSpan(blueColorSpan, cNameLabel.length(), currentWebsiteCertificateCommonNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+                    if (currentSslMatchesNewDomainName) {
+                        currentSslCNameStringBuilder.setSpan(blueColorSpan, cNameLabel.length(), currentSslCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
                     } else {
-                        currentWebsiteCertificateCommonNameStringBuilder.setSpan(redColorSpan, cNameLabel.length(), currentWebsiteCertificateCommonNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+                        currentSslCNameStringBuilder.setSpan(redColorSpan, cNameLabel.length(), currentSslCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
                     }
 
-                    // Update `currentWebsiteCertificateIssuedToCNameTextView`.
-                    currentWebsiteCertificateIssuedToCNameTextView.setText(currentWebsiteCertificateCommonNameStringBuilder);
+                    // Update the current SSL issued to CName text view.
+                    currentSslIssuedToCNameTextView.setText(currentSslCNameStringBuilder);
                 }
             }
         });
 
-        // Create a `boolean` to track if night mode is enabled.
-        boolean nightModeEnabled = (nightModeInt == DomainsDatabaseHelper.NIGHT_MODE_ENABLED) || ((nightModeInt == DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT) && defaultNightMode);
-
-        // Disable the JavaScript switch if night mode is enabled.
-        if (nightModeEnabled) {
-            javaScriptEnabledSwitch.setEnabled(false);
-        } else {
-            javaScriptEnabledSwitch.setEnabled(true);
-        }
-
-        // Set the JavaScript icon.
-        if ((javaScriptEnabledInt == 1) || nightModeEnabled) {
-            javaScriptImageView.setImageDrawable(resources.getDrawable(R.drawable.javascript_enabled));
-        } else {
-            javaScriptImageView.setImageDrawable(resources.getDrawable(R.drawable.privacy_mode));
-        }
-
         // Set the JavaScript switch status.
-        if (javaScriptEnabledInt == 1) {  // JavaScript is enabled.
-            javaScriptEnabledSwitch.setChecked(true);
+        if (javaScriptInt == 1) {  // JavaScript is enabled.
+            javaScriptSwitch.setChecked(true);
+            javaScriptImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.javascript_enabled, null));
         } else {  // JavaScript is disabled.
-            javaScriptEnabledSwitch.setChecked(false);
+            javaScriptSwitch.setChecked(false);
+            javaScriptImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.privacy_mode, null));
         }
 
-        // Set the first-party cookies status.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
-        if (firstPartyCookiesEnabledInt == 1) {  // First-party cookies are enabled.
-            firstPartyCookiesEnabledSwitch.setChecked(true);
-            firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_enabled));
-        } else {  // First-party cookies are disabled.
-            firstPartyCookiesEnabledSwitch.setChecked(false);
-
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark));
-            } else {
-                firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light));
-            }
-        }
-
-        // Only display third-party cookies if SDK_INT >= 21.
-        if (Build.VERSION.SDK_INT >= 21) {  // Third-party cookies can be configured for API >= 21.
-            // Only enable third-party-cookies if first-party cookies are enabled.
-            if (firstPartyCookiesEnabledInt == 1) {  // First-party cookies are enabled.
-                // Set the third-party cookies status.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
-                if (thirdPartyCookiesEnabledInt == 1) {  // Both first-party and third-party cookies are enabled.
-                    thirdPartyCookiesEnabledSwitch.setChecked(true);
-                    thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_warning));
-                } else {  // First party cookies are enabled but third-party cookies are disabled.
-                    thirdPartyCookiesEnabledSwitch.setChecked(false);
-
-                    // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
-                        thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark));
-                    } else {
-                        thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light));
-                    }
-                }
-            } else {  // First-party cookies are disabled.
-                // Set the status of third-party cookies.
-                if (thirdPartyCookiesEnabledInt == 1) {
-                    thirdPartyCookiesEnabledSwitch.setChecked(true);
-                } else {
-                    thirdPartyCookiesEnabledSwitch.setChecked(false);
-                }
+        // Set the cookies switch status.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+        // Doing this makes no sense until it can also be done with the preferences.
+        if (cookiesInt == 1) {  // Cookies are enabled.
+            // Turn the switch on.
+            cookiesSwitch.setChecked(true);
 
-                // Disable the third-party cookies switch.
-                thirdPartyCookiesEnabledSwitch.setEnabled(false);
+            // Set the icon.
+            cookiesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.cookies_enabled, null));
+        } else {  // Cookies are disabled.
+            // Turn the switch off
+            cookiesSwitch.setChecked(false);
 
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_dark));
-                } else {
-                    thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_light));
-                }
-            }
-        } else {  // Third-party cookies cannot be configured for API <= 21.
-            // Hide the LinearLayout for third-party cookies.
-            thirdPartyCookiesLinearLayout.setVisibility(View.GONE);
+            // Set the icon.
+            cookiesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.cookies_disabled, null));
         }
 
         // Only enable DOM storage if JavaScript is enabled.
-        if ((javaScriptEnabledInt == 1) || nightModeEnabled) {  // JavaScript is enabled.
-            // Enable the DOM storage `Switch`.
-            domStorageEnabledSwitch.setEnabled(true);
+        if (javaScriptInt == 1) {  // JavaScript is enabled.
+            // Enable the DOM storage switch.
+            domStorageSwitch.setEnabled(true);
 
             // Set the DOM storage status.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
-            if (domStorageEnabledInt == 1) {  // Both JavaScript and DOM storage are enabled.
-                domStorageEnabledSwitch.setChecked(true);
-                domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_enabled));
+            // Doing this makes no sense until it can also be done with the preferences.
+            if (domStorageInt == 1) {  // Both JavaScript and DOM storage are enabled.
+                domStorageSwitch.setChecked(true);
+                domStorageImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.dom_storage_enabled, null));
             } else {  // JavaScript is enabled but DOM storage is disabled.
                 // Set the DOM storage switch to off.
-                domStorageEnabledSwitch.setChecked(false);
+                domStorageSwitch.setChecked(false);
 
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_dark));
-                } else {
-                    domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_light));
-                }
+                // Set the icon.
+                domStorageImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.dom_storage_disabled, null));
             }
         } else {  // JavaScript is disabled.
-            // Disable the DOM storage `Switch`.
-            domStorageEnabledSwitch.setEnabled(false);
+            // Disable the DOM storage switch.
+            domStorageSwitch.setEnabled(false);
 
             // Set the checked status of DOM storage.
-            if (domStorageEnabledInt == 1) {  // DOM storage is enabled but JavaScript is disabled.
-                domStorageEnabledSwitch.setChecked(true);
-            } else {  // Both JavaScript and DOM storage are disabled.
-                domStorageEnabledSwitch.setChecked(false);
-            }
+            domStorageSwitch.setChecked(domStorageInt == 1);
 
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_dark));
-            } else {
-                domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_light));
-            }
+            // Set the icon.
+            domStorageImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.dom_storage_ghosted, null));
         }
 
-        // Set the form data status.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.  Form data can be removed once the minimum API >= 26.
+        // Set the form data visibility.  Form data can be removed once the minimum API >= 26.
         if (Build.VERSION.SDK_INT >= 26) {  // Form data no longer applies to newer versions of Android.
-            // Hide the form data switch.
-            formDataEnabledSwitch.setVisibility(View.GONE);
+            // Hide the form data image view and switch.
+            formDataImageView.setVisibility(View.GONE);
+            formDataSwitch.setVisibility(View.GONE);
         } else {  // Form data should be displayed because this is an older version of Android.
-            if (formDataEnabledInt == 1) {  // Form data is on.
-                formDataEnabledSwitch.setChecked(true);
-                formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_enabled));
+            if (formDataInt == 1) {  // Form data is on.
+                // Turn the form data switch on.
+                formDataSwitch.setChecked(true);
+
+                // Set the form data icon.
+                formDataImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.form_data_enabled, null));
             } else {  // Form data is off.
                 // Turn the form data switch to off.
-                formDataEnabledSwitch.setChecked(false);
+                formDataSwitch.setChecked(false);
 
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_dark));
-                } else {
-                    formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_light));
-                }
+                // Set the icon.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+                // Doing this makes no sense until it can also be done with the preferences.
+                formDataImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.form_data_disabled, null));
             }
         }
 
         // Set the EasyList status.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
-        if (easyListEnabledInt == 1) {  // EasyList is on.
+        // Doing this makes no sense until it can also be done with the preferences.
+        if (easyListInt == 1) {  // EasyList is on.
             // Turn the switch on.
             easyListSwitch.setChecked(true);
 
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_dark));
-            } else {
-                easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_light));
-            }
+            // Set the icon.
+            easyListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_ads_enabled, null));
         } else {  // EasyList is off.
             // Turn the switch off.
             easyListSwitch.setChecked(false);
 
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_dark));
-            } else {
-                easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_light));
-            }
+            // Set the icon.
+            easyListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_ads_disabled, null));
         }
 
         // Set the EasyPrivacy status.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
-        if (easyPrivacyEnabledInt == 1) {  // EasyPrivacy is on.
+        // Doing this makes no sense until it can also be done with the preferences.
+        if (easyPrivacyInt == 1) {  // EasyPrivacy is on.
             // Turn the switch on.
             easyPrivacySwitch.setChecked(true);
 
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_dark));
-            } else {
-                easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_light));
-            }
+            // Set the icon.
+            easyPrivacyImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_tracking_enabled, null));
         } else {  // EasyPrivacy is off.
             // Turn the switch off.
             easyPrivacySwitch.setChecked(false);
 
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_dark));
-            } else {
-                easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_light));
-            }
+            // Set the icon.
+            easyPrivacyImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_tracking_disabled, null));
         }
 
         // Set the Fanboy's Annoyance List status.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+        // Doing this makes no sense until it can also be done with the preferences.
         if (fanboysAnnoyanceListInt == 1) {  // Fanboy's Annoyance List is on.
             // Turn the switch on.
             fanboysAnnoyanceListSwitch.setChecked(true);
 
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark));
-            } else {
-                fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light));
-            }
+            // Set the icon.
+            fanboysAnnoyanceListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.social_media_enabled, null));
         } else {  // Fanboy's Annoyance List is off.
             // Turn the switch off.
             fanboysAnnoyanceListSwitch.setChecked(false);
 
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark));
-            } else {
-                fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light));
-            }
+            // Set the icon.
+            fanboysAnnoyanceListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.social_media_disabled, null));
         }
 
         // Only enable Fanboy's Social Blocking List if Fanboy's Annoyance List is off.
         if (fanboysAnnoyanceListInt == 0) {  // Fanboy's Annoyance List is on.
+            // Enable Fanboy's Social Blocking List switch.
+            fanboysSocialBlockingListSwitch.setEnabled(true);
+
             // Enable Fanboy's Social Blocking List.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+            // Doing this makes no sense until it can also be done with the preferences.
             if (fanboysSocialBlockingListInt == 1) {  // Fanboy's Social Blocking List is on.
-                // Enable the switch and turn it on.
-                fanboysSocialBlockingListSwitch.setEnabled(true);
+                // Turn on Fanboy's Social Blocking List switch.
                 fanboysSocialBlockingListSwitch.setChecked(true);
 
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark));
-                } else {
-                    fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light));
-                }
+                // Set the icon.
+                fanboysSocialBlockingListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.social_media_enabled, null));
             } else {  // Fanboy's Social Blocking List is off.
-                // Enable the switch but turn it off.
-                fanboysSocialBlockingListSwitch.setEnabled(true);
+                // Turn off Fanboy's Social Blocking List switch.
                 fanboysSocialBlockingListSwitch.setChecked(false);
 
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark));
-                } else {
-                    fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light));
-                }
+                // Set the icon.
+                fanboysSocialBlockingListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.social_media_disabled, null));
             }
         } else {  // Fanboy's Annoyance List is on.
-            // Disable Fanboy's Social Blocking List.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
-            if (fanboysSocialBlockingListInt == 1) {  // Fanboy's Social Blocking List is on.
-                // Disable the switch but turn it on.
-                fanboysSocialBlockingListSwitch.setEnabled(false);
-                fanboysSocialBlockingListSwitch.setChecked(true);
-            } else {  // Fanboy's Social Blocking List is off.
-                // Disable the switch and turn it off.
-                fanboysSocialBlockingListSwitch.setEnabled(false);
-                fanboysSocialBlockingListSwitch.setChecked(false);
-            }
+            // Disable Fanboy's Social Blocking List switch.
+            fanboysSocialBlockingListSwitch.setEnabled(false);
 
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_dark));
-            } else {
-                fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_light));
-            }
+            // Set the status of Fanboy's Social Blocking List.
+            fanboysSocialBlockingListSwitch.setChecked(fanboysSocialBlockingListInt == 1);
+
+            // Set the icon.
+            fanboysSocialBlockingListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.social_media_ghosted, null));
+        }
+
+        // Set the UltraList status.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+        // Doing this makes no sense until it can also be done with the preferences.
+        if (ultraListInt == 1) {  // UltraList is on.
+            // Turn the switch on.
+            ultraListSwitch.setChecked(true);
+
+            // Set the icon.
+            ultraListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_ads_enabled, null));
+        } else {  // UltraList is off.
+            // Turn the switch off.
+            ultraListSwitch.setChecked(false);
+
+            // Set the icon.
+            ultraListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_ads_disabled, null));
         }
 
         // Set the UltraPrivacy status.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
-        if (ultraPrivacyEnabledInt == 1) {  // UltraPrivacy is on.
+        // Doing this makes no sense until it can also be done with the preferences.
+        if (ultraPrivacyInt == 1) {  // UltraPrivacy is on.
             // Turn the switch on.
             ultraPrivacySwitch.setChecked(true);
 
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_dark));
-            } else {
-                ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_light));
-            }
+            // Set the icon.
+            ultraPrivacyImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_tracking_enabled, null));
         } else {  // EasyPrivacy is off.
             // Turn the switch off.
             ultraPrivacySwitch.setChecked(false);
 
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_dark));
-            } else {
-                ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_light));
-            }
+            // Set the icon.
+            ultraPrivacyImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_tracking_disabled, null));
         }
 
         // Set the third-party resource blocking status.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+        // Doing this makes no sense until it can also be done with the preferences.
         if (blockAllThirdPartyRequestsInt == 1) {  // Blocking all third-party requests is on.
             // Turn the switch on.
             blockAllThirdPartyRequestsSwitch.setChecked(true);
 
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_dark));
-            } else {
-                blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_light));
-            }
+            // Set the icon.
+            blockAllThirdPartyRequestsImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_all_third_party_requests_enabled, null));
         } else {  // Blocking all third-party requests is off.
             // Turn the switch off.
             blockAllThirdPartyRequestsSwitch.setChecked(false);
 
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_dark));
-            } else {
-                blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_light));
-            }
+            // Set the icon.
+            blockAllThirdPartyRequestsImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_all_third_party_requests_disabled, null));
         }
 
         // Inflated a WebView to get the default user agent.
@@ -701,170 +622,245 @@ public class DomainSettingsFragment extends Fragment {
             customUserAgentEditText.setVisibility(View.GONE);
 
             // Set the user agent text.
-            switch (userAgentArrayPosition) {
-                case MainWebViewActivity.DOMAINS_WEBVIEW_DEFAULT_USER_AGENT:
-                    // Display the WebView default user agent.
-                    userAgentTextView.setText(webViewDefaultUserAgentString);
-                    break;
-
-                default:
-                    // Get the user agent string from the user agent data array.  The spinner has one more entry at the beginning than the user agent data array, so the position must be incremented.
-                    userAgentTextView.setText(userAgentDataArray[userAgentArrayPosition + 1]);
+            if (userAgentArrayPosition == MainWebViewActivity.DOMAINS_WEBVIEW_DEFAULT_USER_AGENT) {  // The WebView default user agent is selected.
+                // Display the WebView default user agent.
+                userAgentTextView.setText(webViewDefaultUserAgentString);
+            } else {  // A user agent besides the default is selected.
+                // Get the user agent string from the user agent data array.  The spinner has one more entry at the beginning than the user agent data array, so the position must be incremented.
+                userAgentTextView.setText(userAgentDataArray[userAgentArrayPosition + 1]);
             }
         }
 
-        // Open the user agent spinner when the TextView is clicked.
+        // Open the user agent spinner when the text view is clicked.
         userAgentTextView.setOnClickListener((View v) -> {
             // Open the user agent spinner.
             userAgentSpinner.performClick();
         });
 
-        // Set the selected font size.
-        int fontSizeArrayPosition = fontSizeEntryValuesArrayAdapter.getPosition(String.valueOf(fontSizeInt));
-        fontSizeSpinner.setSelection(fontSizeArrayPosition);
+        // Display the font size settings.
+        if (fontSizeInt == 0) {  // `0` is the code for system default font size.
+            // Set the font size to the system default
+            fontSizeSpinner.setSelection(0);
 
-        // Set the default font size text.
-        int defaultFontSizeArrayPosition = fontSizeEntryValuesArrayAdapter.getPosition(defaultFontSizeString);
-        fontSizeTextView.setText(fontSizeArrayAdapter.getItem(defaultFontSizeArrayPosition));
+            // Show the default font size text view.
+            defaultFontSizeTextView.setVisibility(View.VISIBLE);
 
-        // Set the display options for the font size TextView.
-        if (fontSizeArrayPosition == 0) {  // System default font size is selected.  Display `fontSizeTextView`.
-            fontSizeTextView.setVisibility(View.VISIBLE);
-        } else {  // A custom font size is specified.  Hide `fontSizeTextView`.
-            fontSizeTextView.setVisibility(View.GONE);
+            // Hide the custom font size edit text.
+            customFontSizeEditText.setVisibility(View.GONE);
+
+            // Set the default font size as the text of the custom font size edit text.  This way, if the user switches to custom it will already be populated.
+            customFontSizeEditText.setText(defaultFontSizeString);
+        } else {  // A custom font size is selected.
+            // Set the spinner to the custom font size.
+            fontSizeSpinner.setSelection(1);
+
+            // Hide the default font size text view.
+            defaultFontSizeTextView.setVisibility(View.GONE);
+
+            // Show the custom font size edit text.
+            customFontSizeEditText.setVisibility(View.GONE);
+
+            // Set the custom font size.
+            customFontSizeEditText.setText(String.valueOf(fontSizeInt));
         }
 
-        // Open the font size spinner when the TextView is clicked.
-        fontSizeTextView.setOnClickListener((View v) -> {
+        // Initialize the default font size percentage string.
+        String defaultFontSizePercentageString = defaultFontSizeString + "%";
+
+        // Set the default font size text in the text view.
+        defaultFontSizeTextView.setText(defaultFontSizePercentageString);
+
+        // Open the font size spinner when the text view is clicked.
+        defaultFontSizeTextView.setOnClickListener((View v) -> {
             // Open the user agent spinner.
             fontSizeSpinner.performClick();
         });
 
-        // Display the swipe to refresh selection in the spinner.
+        // Select the swipe to refresh selection in the spinner.
         swipeToRefreshSpinner.setSelection(swipeToRefreshInt);
 
         // Set the swipe to refresh text.
         if (defaultSwipeToRefresh) {
-            swipeToRefreshTextView.setText(swipeToRefreshArrayAdapter.getItem(DomainsDatabaseHelper.SWIPE_TO_REFRESH_ENABLED));
+            swipeToRefreshTextView.setText(swipeToRefreshArrayAdapter.getItem(DomainsDatabaseHelper.ENABLED));
         } else {
-            swipeToRefreshTextView.setText(swipeToRefreshArrayAdapter.getItem(DomainsDatabaseHelper.SWIPE_TO_REFRESH_DISABLED));
+            swipeToRefreshTextView.setText(swipeToRefreshArrayAdapter.getItem(DomainsDatabaseHelper.DISABLED));
         }
 
-        // Set the swipe to refresh icon and TextView settings.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+        // Set the swipe to refresh icon and text view settings.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+        // Doing this makes no sense until it can also be done with the preferences.
         switch (swipeToRefreshInt) {
-            case DomainsDatabaseHelper.SWIPE_TO_REFRESH_SYSTEM_DEFAULT:
+            case DomainsDatabaseHelper.SYSTEM_DEFAULT:
                 if (defaultSwipeToRefresh) {  // Swipe to refresh is enabled by default.
-                    // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
-                        swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark));
-                    } else {
-                        swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light));
-                    }
-                } else {  // Swipe to refresh is disabled by default
-                    // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
-                        swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark));
-                    } else {
-                        swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light));
-                    }
+                    // Set the icon.
+                    swipeToRefreshImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.refresh_enabled, null));
+                } else {
+                    // Set the icon.
+                    swipeToRefreshImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.refresh_disabled, null));
                 }
 
-                // Show the swipe to refresh TextView.
+                // Show the swipe to refresh text view.
                 swipeToRefreshTextView.setVisibility(View.VISIBLE);
                 break;
 
-            case DomainsDatabaseHelper.SWIPE_TO_REFRESH_ENABLED:
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark));
-                } else {
-                    swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light));
-                }
+            case DomainsDatabaseHelper.ENABLED:
+                // Set the icon.
+                swipeToRefreshImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.refresh_enabled, null));
 
-                // Hide the swipe to refresh TextView.`
+                // Hide the swipe to refresh text view.
                 swipeToRefreshTextView.setVisibility(View.GONE);
                 break;
 
-            case DomainsDatabaseHelper.SWIPE_TO_REFRESH_DISABLED:
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark));
-                } else {
-                    swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light));
-                }
+            case DomainsDatabaseHelper.DISABLED:
+                // Set the icon.
+                swipeToRefreshImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.refresh_disabled, null));
 
-                // Hide the swipe to refresh TextView.
+                // Hide the swipe to refresh text view.
                 swipeToRefreshTextView.setVisibility(View.GONE);
+                break;
         }
 
-        // Open the swipe to refresh spinner when the TextView is clicked.
+        // Open the swipe to refresh spinner when the text view is clicked.
         swipeToRefreshTextView.setOnClickListener((View v) -> {
             // Open the swipe to refresh spinner.
             swipeToRefreshSpinner.performClick();
         });
 
-        // Display the night mode in the spinner.
-        nightModeSpinner.setSelection(nightModeInt);
+        // Get the WebView theme string arrays.
+        String[] webViewThemeStringArray = resources.getStringArray(R.array.webview_theme_array);
+        String[] webViewThemeEntryValuesStringArray = resources.getStringArray(R.array.webview_theme_entry_values);
+
+        // Define an app WebView theme entry number.
+        int appWebViewThemeEntryNumber;
+
+        // Get the WebView theme entry number that matches the current WebView theme.  A switch statement cannot be used because the WebView theme entry values string array is not a compile time constant.
+        if (defaultWebViewTheme.equals(webViewThemeEntryValuesStringArray[1])) {  // The light theme is selected.
+            // Store the default WebView theme entry number.
+            appWebViewThemeEntryNumber = 1;
+        } else if (defaultWebViewTheme.equals(webViewThemeEntryValuesStringArray[2])) {  // The dark theme is selected.
+            // Store the default WebView theme entry number.
+            appWebViewThemeEntryNumber = 2;
+        } else {  // The system default theme is selected.
+            // Store the default WebView theme entry number.
+            appWebViewThemeEntryNumber = 0;
+        }
 
-        // Set the default night mode text.
-        if (defaultNightMode) {
-            nightModeTextView.setText(nightModeArrayAdapter.getItem(DomainsDatabaseHelper.NIGHT_MODE_ENABLED));
-        } else {
-            nightModeTextView.setText(nightModeArrayAdapter.getItem(DomainsDatabaseHelper.NIGHT_MODE_DISABLED));
+        // Select the WebView theme in the spinner.
+        webViewThemeSpinner.setSelection(webViewThemeInt);
+
+        // Set the WebView theme text.
+        if (appWebViewThemeEntryNumber == DomainsDatabaseHelper.SYSTEM_DEFAULT) {  // The app WebView theme is system default.
+            // Set the text according to the current UI theme.
+            if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+                webViewThemeTextView.setText(webViewThemeStringArray[DomainsDatabaseHelper.LIGHT_THEME]);
+            } else {
+                webViewThemeTextView.setText(webViewThemeStringArray[DomainsDatabaseHelper.DARK_THEME]);
+            }
+        } else {  // The app WebView theme is not system default.
+            // Set the text according to the app WebView theme.
+            webViewThemeTextView.setText(webViewThemeStringArray[appWebViewThemeEntryNumber]);
         }
 
-        // Set the night mode icon and TextView settings.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
-        switch (nightModeInt) {
-            case DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT:
-                if (defaultNightMode) {  // Night mode enabled by default.
-                    // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
-                        nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_dark));
-                    } else {
-                        nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_light));
-                    }
-                } else {  // Night mode disabled by default.
-                    // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
-                        nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_dark));
-                    } else {
-                        nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_light));
-                    }
+        // Set the WebView theme icon and text visibility.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+        // Doing this makes no sense until it can also be done with the preferences.
+        switch (webViewThemeInt) {
+            case DomainsDatabaseHelper.SYSTEM_DEFAULT:  // The domain WebView theme is system default.
+                // Set the icon according to the app WebView theme.
+                switch (appWebViewThemeEntryNumber) {
+                    case DomainsDatabaseHelper.SYSTEM_DEFAULT:  // The default WebView theme is system default.
+                        // Set the icon according to the app theme.
+                        if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+                            // Set the light theme icon.
+                            webViewThemeImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.webview_light_theme, null));
+                        } else {
+                            // Set the dark theme icon.
+                            webViewThemeImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.webview_dark_theme, null));
+                        }
+                        break;
+
+                    case DomainsDatabaseHelper.LIGHT_THEME:  // the default WebView theme is light.
+                        // Set the icon.
+                        webViewThemeImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.webview_light_theme, null));
+                        break;
+
+                    case DomainsDatabaseHelper.DARK_THEME:  // the default WebView theme is dark.
+                        // Set the icon.
+                        webViewThemeImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.webview_dark_theme, null));
+                        break;
                 }
 
-                // Show night mode TextView.
-                nightModeTextView.setVisibility(View.VISIBLE);
+                // Show the WebView theme text view.
+                webViewThemeTextView.setVisibility(View.VISIBLE);
                 break;
 
-            case DomainsDatabaseHelper.NIGHT_MODE_ENABLED:
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_dark));
-                } else {
-                    nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_light));
+            case DomainsDatabaseHelper.LIGHT_THEME:  // The domain WebView theme is light.
+                // Set the icon.
+                webViewThemeImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.webview_light_theme, null));
+
+                // Hide the WebView theme text view.
+                webViewThemeTextView.setVisibility(View.GONE);
+                break;
+
+            case DomainsDatabaseHelper.DARK_THEME:  // The domain WebView theme is dark.
+                // Set the icon.
+                webViewThemeImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.webview_dark_theme, null));
+
+                // Hide the WebView theme text view.
+                webViewThemeTextView.setVisibility(View.GONE);
+                break;
+        }
+
+        // Open the WebView theme spinner when the text view is clicked.
+        webViewThemeTextView.setOnClickListener((View v) -> {
+            // Open the WebView theme spinner.
+            webViewThemeSpinner.performClick();
+        });
+
+        // Select the wide viewport in the spinner.
+        wideViewportSpinner.setSelection(wideViewportInt);
+
+        // Set the default wide viewport text.
+        if (defaultWideViewport) {
+            wideViewportTextView.setText(wideViewportArrayAdapter.getItem(DomainsDatabaseHelper.ENABLED));
+        } else {
+            wideViewportTextView.setText(wideViewportArrayAdapter.getItem(DomainsDatabaseHelper.DISABLED));
+        }
+
+        // Set the wide viewport icon and text view settings.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+        // Doing this makes no sense until it can also be done with the preferences.
+        switch (wideViewportInt) {
+            case DomainsDatabaseHelper.SYSTEM_DEFAULT:
+                // Set the icon.
+                if (defaultWideViewport) {  // Wide viewport enabled by default.
+                    wideViewportImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.wide_viewport_enabled, null));
+                } else {  // Wide viewport disabled by default.
+                    wideViewportImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.wide_viewport_disabled, null));
                 }
 
-                // Hide the night mode TextView.
-                nightModeTextView.setVisibility(View.GONE);
+                // Show the wide viewport text view.
+                wideViewportTextView.setVisibility(View.VISIBLE);
                 break;
 
-            case DomainsDatabaseHelper.NIGHT_MODE_DISABLED:
+            case DomainsDatabaseHelper.ENABLED:
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_dark));
-                } else {
-                    nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_light));
-                }
+                wideViewportImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.wide_viewport_enabled, null));
 
-                // Hide the night mode TextView.
-                nightModeTextView.setVisibility(View.GONE);
+                // Hide the wide viewport text view.
+                wideViewportTextView.setVisibility(View.GONE);
+                break;
+
+            case DomainsDatabaseHelper.DISABLED:
+                // Set the icon.
+                wideViewportImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.wide_viewport_disabled, null));
+
+                // Hide the wide viewport text view.
+                wideViewportTextView.setVisibility(View.GONE);
                 break;
         }
 
-        // Open the night mode spinner when the TextView is clicked.
-        nightModeTextView.setOnClickListener((View v) -> {
-            // Open the night mode spinner.
-            nightModeSpinner.performClick();
+        // Open the wide viewport spinner when the text view is clicked.
+        wideViewportTextView.setOnClickListener((View view) -> {
+            // Open the wide viewport spinner.
+            wideViewportSpinner.performClick();
         });
 
         // Display the website images mode in the spinner.
@@ -872,237 +868,223 @@ public class DomainSettingsFragment extends Fragment {
 
         // Set the default display images text.
         if (defaultDisplayWebpageImages) {
-            displayImagesTextView.setText(displayImagesArrayAdapter.getItem(DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_ENABLED));
+            displayImagesTextView.setText(displayImagesArrayAdapter.getItem(DomainsDatabaseHelper.ENABLED));
         } else {
-            displayImagesTextView.setText(displayImagesArrayAdapter.getItem(DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_DISABLED));
+            displayImagesTextView.setText(displayImagesArrayAdapter.getItem(DomainsDatabaseHelper.DISABLED));
         }
 
-        // Set the display website images icon and TextView settings.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+        // Set the display website images icon and text view settings.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+        // Doing this makes no sense until it can also be done with the preferences.
         switch (displayImagesInt) {
-            case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_SYSTEM_DEFAULT:
+            case DomainsDatabaseHelper.SYSTEM_DEFAULT:
                 if (defaultDisplayWebpageImages) {  // Display webpage images enabled by default.
-                    // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
-                        displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark));
-                    } else {
-                        displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light));
-                    }
+                    // Set the icon.
+                    displayWebpageImagesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.images_enabled, null));
                 } else {  // Display webpage images disabled by default.
-                    // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
-                        displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark));
-                    } else {
-                        displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light));
-                    }
+                    // Set the icon.
+                    displayWebpageImagesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.images_disabled, null));
                 }
 
-                // Show the display images TextView.
+                // Show the display images text view.
                 displayImagesTextView.setVisibility(View.VISIBLE);
                 break;
 
-            case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_ENABLED:
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark));
-                } else {
-                    displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light));
-                }
+            case DomainsDatabaseHelper.ENABLED:
+                // Set the icon.
+                displayWebpageImagesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.images_enabled, null));
 
-                // Hide the display images TextView.
+                // Hide the display images text view.
                 displayImagesTextView.setVisibility(View.GONE);
                 break;
 
-            case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_DISABLED:
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark));
-                } else {
-                    displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light));
-                }
+            case DomainsDatabaseHelper.DISABLED:
+                // Set the icon.
+                displayWebpageImagesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.images_disabled, null));
 
-                // Hide the display images TextView.
+                // Hide the display images text view.
                 displayImagesTextView.setVisibility(View.GONE);
                 break;
         }
 
-        // Open the display images spinner when the TextView is clicked.
-        displayImagesTextView.setOnClickListener((View v) -> {
+        // Open the display images spinner when the text view is clicked.
+        displayImagesTextView.setOnClickListener((View view) -> {
             // Open the user agent spinner.
             displayWebpageImagesSpinner.performClick();
         });
         
         // Set the pinned SSL certificate icon.
         if (pinnedSslCertificateInt == 1) {  // Pinned SSL certificate is enabled.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+            // Doing this makes no sense until it can also be done with the preferences.
             // Check the switch.
             pinnedSslCertificateSwitch.setChecked(true);
 
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_dark));
-            } else {
-                pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_light));
-            }
+            // Set the icon.
+            pinnedSslCertificateImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ssl_certificate_enabled, null));
         } else {  // Pinned SSL certificate is disabled.
             // Uncheck the switch.
             pinnedSslCertificateSwitch.setChecked(false);
 
-            // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
-                pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_dark));
-            } else {
-                pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_light));
-            }
+            // Set the icon.
+            pinnedSslCertificateImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ssl_certificate_disabled, null));
         }
 
         // Store the current date.
         Date currentDate = Calendar.getInstance().getTime();
 
-        // Setup the `StringBuilders` to display the general certificate information in blue.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
-        savedSslCertificateIssuedToONameStringBuilder.setSpan(blueColorSpan, oNameLabel.length(), savedSslCertificateIssuedToONameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
-        savedSslCertificateIssuedToUNameStringBuilder.setSpan(blueColorSpan, uNameLabel.length(), savedSslCertificateIssuedToUNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
-        savedSslCertificateIssuedByCNameStringBuilder.setSpan(blueColorSpan, cNameLabel.length(), savedSslCertificateIssuedByCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
-        savedSslCertificateIssuedByONameStringBuilder.setSpan(blueColorSpan, oNameLabel.length(), savedSslCertificateIssuedByONameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
-        savedSslCertificateIssuedByUNameStringBuilder.setSpan(blueColorSpan, uNameLabel.length(), savedSslCertificateIssuedByUNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+        // Setup the string builders to display the general certificate information in blue.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
+        savedSslIssuedToONameStringBuilder.setSpan(blueColorSpan, oNameLabel.length(), savedSslIssuedToONameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+        savedSslIssuedToUNameStringBuilder.setSpan(blueColorSpan, uNameLabel.length(), savedSslIssuedToUNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+        savedSslIssuedByCNameStringBuilder.setSpan(blueColorSpan, cNameLabel.length(), savedSslIssuedByCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+        savedSslIssuedByONameStringBuilder.setSpan(blueColorSpan, oNameLabel.length(), savedSslIssuedByONameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+        savedSslIssuedByUNameStringBuilder.setSpan(blueColorSpan, uNameLabel.length(), savedSslIssuedByUNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
 
-        // Check the certificate `Common Name` against the domain name.
-        boolean savedSSlCertificateCommonNameMatchesDomainName = checkDomainNameAgainstCertificate(domainNameString, savedSslCertificateIssuedToCNameString);
+        // Check the certificate Common Name against the domain name.
+        boolean savedSslCommonNameMatchesDomainName = checkDomainNameAgainstCertificate(domainNameString, savedSslIssuedToCNameString);
 
-        // Format the `issuedToCommonName` color.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
-        if (savedSSlCertificateCommonNameMatchesDomainName) {
-            savedSslCertificateIssuedToCNameStringBuilder.setSpan(blueColorSpan, cNameLabel.length(), savedSslCertificateIssuedToCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+        // Format the issued to Common Name color.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
+        if (savedSslCommonNameMatchesDomainName) {
+            savedSslIssuedToCNameStringBuilder.setSpan(blueColorSpan, cNameLabel.length(), savedSslIssuedToCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
         } else {
-            savedSslCertificateIssuedToCNameStringBuilder.setSpan(redColorSpan, cNameLabel.length(), savedSslCertificateIssuedToCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+            savedSslIssuedToCNameStringBuilder.setSpan(redColorSpan, cNameLabel.length(), savedSslIssuedToCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
         }
 
         //  Format the start date color.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
-        if ((savedSslCertificateStartDate != null) && savedSslCertificateStartDate.after(currentDate)) {  // The certificate start date is in the future.
-            savedSslCertificateStartDateStringBuilder.setSpan(redColorSpan, startDateLabel.length(), savedSslCertificateStartDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+        if ((savedSslStartDate != null) && savedSslStartDate.after(currentDate)) {  // The certificate start date is in the future.
+            savedSslStartDateStringBuilder.setSpan(redColorSpan, startDateLabel.length(), savedSslStartDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
         } else {  // The certificate start date is in the past.
-            savedSslCertificateStartDateStringBuilder.setSpan(blueColorSpan, startDateLabel.length(), savedSslCertificateStartDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+            savedSslStartDateStringBuilder.setSpan(blueColorSpan, startDateLabel.length(), savedSslStartDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
         }
 
         // Format the end date color.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
-        if ((savedSslCertificateEndDate != null) && savedSslCertificateEndDate.before(currentDate)) {  // The certificate end date is in the past.
-            savedSslCertificateEndDateStringBuilder.setSpan(redColorSpan, endDateLabel.length(), savedSslCertificateEndDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+        if ((savedSslEndDate != null) && savedSslEndDate.before(currentDate)) {  // The certificate end date is in the past.
+            savedSslEndDateStringBuilder.setSpan(redColorSpan, endDateLabel.length(), savedSslEndDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
         } else {  // The certificate end date is in the future.
-            savedSslCertificateEndDateStringBuilder.setSpan(blueColorSpan, endDateLabel.length(), savedSslCertificateEndDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+            savedSslEndDateStringBuilder.setSpan(blueColorSpan, endDateLabel.length(), savedSslEndDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
         }
 
-        // Display the current website SSL certificate strings.
-        savedSslCertificateIssuedToCNameTextView.setText(savedSslCertificateIssuedToCNameStringBuilder);
-        savedSslCertificateIssuedToONameTextView.setText(savedSslCertificateIssuedToONameStringBuilder);
-        savedSslCertificateIssuedToUNameTextView.setText(savedSslCertificateIssuedToUNameStringBuilder);
-        savedSslCertificateIssuedByCNameTextView.setText(savedSslCertificateIssuedByCNameStringBuilder);
-        savedSslCertificateIssuedByONameTextView.setText(savedSslCertificateIssuedByONameStringBuilder);
-        savedSslCertificateIssuedByUNameTextView.setText(savedSslCertificateIssuedByUNameStringBuilder);
-        savedSslCertificateStartDateTextView.setText(savedSslCertificateStartDateStringBuilder);
-        savedSslCertificateEndDateTextView.setText(savedSslCertificateEndDateStringBuilder);
+        // Display the saved website SSL certificate strings.
+        savedSslIssuedToCNameTextView.setText(savedSslIssuedToCNameStringBuilder);
+        savedSslIssuedToONameTextView.setText(savedSslIssuedToONameStringBuilder);
+        savedSslIssuedToUNameTextView.setText(savedSslIssuedToUNameStringBuilder);
+        savedSslIssuedByCNameTextView.setText(savedSslIssuedByCNameStringBuilder);
+        savedSslIssuedByONameTextView.setText(savedSslIssuedByONameStringBuilder);
+        savedSslIssuedByUNameTextView.setText(savedSslIssuedByUNameStringBuilder);
+        savedSslStartDateTextView.setText(savedSslStartDateStringBuilder);
+        savedSslEndDateTextView.setText(savedSslEndDateStringBuilder);
 
         // Populate the current website SSL certificate if there is one.
-        if (currentWebsiteSslCertificate != null) {
-            // Get the strings from the SSL certificate.
-            String currentWebsiteCertificateIssuedToCNameString = currentWebsiteSslCertificate.getIssuedTo().getCName();
-            String currentWebsiteCertificateIssuedToONameString = currentWebsiteSslCertificate.getIssuedTo().getOName();
-            String currentWebsiteCertificateIssuedToUNameString = currentWebsiteSslCertificate.getIssuedTo().getUName();
-            String currentWebsiteCertificateIssuedByCNameString = currentWebsiteSslCertificate.getIssuedBy().getCName();
-            String currentWebsiteCertificateIssuedByONameString = currentWebsiteSslCertificate.getIssuedBy().getOName();
-            String currentWebsiteCertificateIssuedByUNameString = currentWebsiteSslCertificate.getIssuedBy().getUName();
-            Date currentWebsiteCertificateStartDate = currentWebsiteSslCertificate.getValidNotBeforeDate();
-            Date currentWebsiteCertificateEndDate = currentWebsiteSslCertificate.getValidNotAfterDate();
-
-            // Create a `SpannableStringBuilder` for each `TextView` that needs multiple colors of text.
-            SpannableStringBuilder currentWebsiteCertificateIssuedToCNameStringBuilder = new SpannableStringBuilder(cNameLabel + currentWebsiteCertificateIssuedToCNameString);
-            SpannableStringBuilder currentWebsiteCertificateIssuedToONameStringBuilder = new SpannableStringBuilder(oNameLabel + currentWebsiteCertificateIssuedToONameString);
-            SpannableStringBuilder currentWebsiteCertificateIssuedToUNameStringBuilder = new SpannableStringBuilder(uNameLabel + currentWebsiteCertificateIssuedToUNameString);
-            SpannableStringBuilder currentWebsiteCertificateIssuedByCNameStringBuilder = new SpannableStringBuilder(cNameLabel + currentWebsiteCertificateIssuedByCNameString);
-            SpannableStringBuilder currentWebsiteCertificateIssuedByONameStringBuilder = new SpannableStringBuilder(oNameLabel + currentWebsiteCertificateIssuedByONameString);
-            SpannableStringBuilder currentWebsiteCertificateIssuedByUNameStringBuilder = new SpannableStringBuilder(uNameLabel + currentWebsiteCertificateIssuedByUNameString);
-            SpannableStringBuilder currentWebsiteCertificateStartDateStringBuilder = new SpannableStringBuilder(startDateLabel + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG)
-                    .format(currentWebsiteCertificateStartDate));
-            SpannableStringBuilder currentWebsiteCertificateEndDateStringBuilder = new SpannableStringBuilder(endDateLabel + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG)
-                    .format(currentWebsiteCertificateEndDate));
-
-            // Setup the `StringBuilders` to display the general certificate information in blue.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
-            currentWebsiteCertificateIssuedToONameStringBuilder.setSpan(blueColorSpan, oNameLabel.length(), currentWebsiteCertificateIssuedToONameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
-            currentWebsiteCertificateIssuedToUNameStringBuilder.setSpan(blueColorSpan, uNameLabel.length(), currentWebsiteCertificateIssuedToUNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
-            currentWebsiteCertificateIssuedByCNameStringBuilder.setSpan(blueColorSpan, cNameLabel.length(), currentWebsiteCertificateIssuedByCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
-            currentWebsiteCertificateIssuedByONameStringBuilder.setSpan(blueColorSpan, oNameLabel.length(), currentWebsiteCertificateIssuedByONameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
-            currentWebsiteCertificateIssuedByUNameStringBuilder.setSpan(blueColorSpan, uNameLabel.length(), currentWebsiteCertificateIssuedByUNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
-
-            // Check the certificate `Common Name` against the domain name.
-            boolean currentWebsiteCertificateCommonNameMatchesDomainName = checkDomainNameAgainstCertificate(domainNameString, currentWebsiteCertificateIssuedToCNameString);
-
-            // Format the `issuedToCommonName` color.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
-            if (currentWebsiteCertificateCommonNameMatchesDomainName) {
-                currentWebsiteCertificateIssuedToCNameStringBuilder.setSpan(blueColorSpan, cNameLabel.length(), currentWebsiteCertificateIssuedToCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+        if (DomainsActivity.sslIssuedToCName != null) {
+            // Get dates from the raw long values.
+            Date currentSslStartDate = new Date(DomainsActivity.sslStartDateLong);
+            Date currentSslEndDate = new Date(DomainsActivity.sslEndDateLong);
+
+            // Create a spannable string builder for each text view that needs multiple colors of text.
+            SpannableStringBuilder currentSslIssuedToCNameStringBuilder = new SpannableStringBuilder(cNameLabel + DomainsActivity.sslIssuedToCName);
+            SpannableStringBuilder currentSslIssuedToONameStringBuilder = new SpannableStringBuilder(oNameLabel + DomainsActivity.sslIssuedToOName);
+            SpannableStringBuilder currentSslIssuedToUNameStringBuilder = new SpannableStringBuilder(uNameLabel + DomainsActivity.sslIssuedToUName);
+            SpannableStringBuilder currentSslIssuedByCNameStringBuilder = new SpannableStringBuilder(cNameLabel + DomainsActivity.sslIssuedByCName);
+            SpannableStringBuilder currentSslIssuedByONameStringBuilder = new SpannableStringBuilder(oNameLabel + DomainsActivity.sslIssuedByOName);
+            SpannableStringBuilder currentSslIssuedByUNameStringBuilder = new SpannableStringBuilder(uNameLabel + DomainsActivity.sslIssuedByUName);
+            SpannableStringBuilder currentSslStartDateStringBuilder = new SpannableStringBuilder(startDateLabel + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG)
+                    .format(currentSslStartDate));
+            SpannableStringBuilder currentSslEndDateStringBuilder = new SpannableStringBuilder(endDateLabel + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG)
+                    .format(currentSslEndDate));
+
+            // Setup the string builders to display the general certificate information in blue.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
+            currentSslIssuedToONameStringBuilder.setSpan(blueColorSpan, oNameLabel.length(), currentSslIssuedToONameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+            currentSslIssuedToUNameStringBuilder.setSpan(blueColorSpan, uNameLabel.length(), currentSslIssuedToUNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+            currentSslIssuedByCNameStringBuilder.setSpan(blueColorSpan, cNameLabel.length(), currentSslIssuedByCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+            currentSslIssuedByONameStringBuilder.setSpan(blueColorSpan, oNameLabel.length(), currentSslIssuedByONameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+            currentSslIssuedByUNameStringBuilder.setSpan(blueColorSpan, uNameLabel.length(), currentSslIssuedByUNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+
+            // Check the certificate Common Name against the domain name.
+            boolean currentSslCommonNameMatchesDomainName = checkDomainNameAgainstCertificate(domainNameString, DomainsActivity.sslIssuedToCName);
+
+            // Format the issued to Common Name color.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
+            if (currentSslCommonNameMatchesDomainName) {
+                currentSslIssuedToCNameStringBuilder.setSpan(blueColorSpan, cNameLabel.length(), currentSslIssuedToCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
             } else {
-                currentWebsiteCertificateIssuedToCNameStringBuilder.setSpan(redColorSpan, cNameLabel.length(), currentWebsiteCertificateIssuedToCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+                currentSslIssuedToCNameStringBuilder.setSpan(redColorSpan, cNameLabel.length(), currentSslIssuedToCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
             }
 
             //  Format the start date color.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
-            if (currentWebsiteCertificateStartDate.after(currentDate)) {  // The certificate start date is in the future.
-                currentWebsiteCertificateStartDateStringBuilder.setSpan(redColorSpan, startDateLabel.length(), currentWebsiteCertificateStartDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+            if (currentSslStartDate.after(currentDate)) {  // The certificate start date is in the future.
+                currentSslStartDateStringBuilder.setSpan(redColorSpan, startDateLabel.length(), currentSslStartDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
             } else {  // The certificate start date is in the past.
-                currentWebsiteCertificateStartDateStringBuilder.setSpan(blueColorSpan, startDateLabel.length(), currentWebsiteCertificateStartDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+                currentSslStartDateStringBuilder.setSpan(blueColorSpan, startDateLabel.length(), currentSslStartDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
             }
 
             // Format the end date color.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
-            if (currentWebsiteCertificateEndDate.before(currentDate)) {  // The certificate end date is in the past.
-                currentWebsiteCertificateEndDateStringBuilder.setSpan(redColorSpan, endDateLabel.length(), currentWebsiteCertificateEndDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+            if (currentSslEndDate.before(currentDate)) {  // The certificate end date is in the past.
+                currentSslEndDateStringBuilder.setSpan(redColorSpan, endDateLabel.length(), currentSslEndDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
             } else {  // The certificate end date is in the future.
-                currentWebsiteCertificateEndDateStringBuilder.setSpan(blueColorSpan, endDateLabel.length(), currentWebsiteCertificateEndDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+                currentSslEndDateStringBuilder.setSpan(blueColorSpan, endDateLabel.length(), currentSslEndDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
             }
 
             // Display the current website SSL certificate strings.
-            currentWebsiteCertificateIssuedToCNameTextView.setText(currentWebsiteCertificateIssuedToCNameStringBuilder);
-            currentWebsiteCertificateIssuedToONameTextView.setText(currentWebsiteCertificateIssuedToONameStringBuilder);
-            currentWebsiteCertificateIssuedToUNameTextView.setText(currentWebsiteCertificateIssuedToUNameStringBuilder);
-            currentWebsiteCertificateIssuedByCNameTextView.setText(currentWebsiteCertificateIssuedByCNameStringBuilder);
-            currentWebsiteCertificateIssuedByONameTextView.setText(currentWebsiteCertificateIssuedByONameStringBuilder);
-            currentWebsiteCertificateIssuedByUNameTextView.setText(currentWebsiteCertificateIssuedByUNameStringBuilder);
-            currentWebsiteCertificateStartDateTextView.setText(currentWebsiteCertificateStartDateStringBuilder);
-            currentWebsiteCertificateEndDateTextView.setText(currentWebsiteCertificateEndDateStringBuilder);
+            currentSslIssuedToCNameTextView.setText(currentSslIssuedToCNameStringBuilder);
+            currentSslIssuedToONameTextView.setText(currentSslIssuedToONameStringBuilder);
+            currentSslIssuedToUNameTextView.setText(currentSslIssuedToUNameStringBuilder);
+            currentSslIssuedByCNameTextView.setText(currentSslIssuedByCNameStringBuilder);
+            currentSslIssuedByONameTextView.setText(currentSslIssuedByONameStringBuilder);
+            currentSslIssuedByUNameTextView.setText(currentSslIssuedByUNameStringBuilder);
+            currentSslStartDateTextView.setText(currentSslStartDateStringBuilder);
+            currentSslEndDateTextView.setText(currentSslEndDateStringBuilder);
         }
 
-        // Set the initial display status for the SSL certificates.
-        if (pinnedSslCertificateSwitch.isChecked()) {
+        // Set the initial display status of the SSL certificates card views.
+        if (pinnedSslCertificateSwitch.isChecked()) {  // An SSL certificate is pinned.
             // Set the visibility of the saved SSL certificate.
-            if (savedSslCertificateIssuedToCNameString == null) {
-                savedSslCertificateLinearLayout.setVisibility(View.GONE);
+            if (savedSslIssuedToCNameString == null) {
+                savedSslCardView.setVisibility(View.GONE);
             } else {
-                savedSslCertificateLinearLayout.setVisibility(View.VISIBLE);
+                savedSslCardView.setVisibility(View.VISIBLE);
             }
 
             // Set the visibility of the current website SSL certificate.
-            if (currentWebsiteSslCertificate == null) {
+            if (DomainsActivity.sslIssuedToCName == null) {  // There is no current SSL certificate.
                 // Hide the SSL certificate.
-                currentWebsiteCertificateLinearLayout.setVisibility(View.GONE);
+                currentSslCardView.setVisibility(View.GONE);
 
                 // Show the instruction.
                 noCurrentWebsiteCertificateTextView.setVisibility(View.VISIBLE);
-            } else {
+            } else {  // There is a current SSL certificate.
                 // Show the SSL certificate.
-                currentWebsiteCertificateLinearLayout.setVisibility(View.VISIBLE);
+                currentSslCardView.setVisibility(View.VISIBLE);
 
                 // Hide the instruction.
                 noCurrentWebsiteCertificateTextView.setVisibility(View.GONE);
             }
 
-            // Set the status of the radio buttons.
-            if (savedSslCertificateLinearLayout.getVisibility() == View.VISIBLE) {  // The saved SSL certificate is displayed.
+            // Set the status of the radio buttons and the card view backgrounds.
+            if (savedSslCardView.getVisibility() == View.VISIBLE) {  // The saved SSL certificate is displayed.
+                // Check the saved SSL certificate radio button.
                 savedSslCertificateRadioButton.setChecked(true);
+
+                // Uncheck the current website SSL certificate radio button.
                 currentWebsiteCertificateRadioButton.setChecked(false);
-            } else if (currentWebsiteCertificateLinearLayout.getVisibility() == View.VISIBLE) {  // The saved SSL certificate is hidden but the current website SSL certificate is visible.
+
+                // Darken the background of the current website SSL certificate linear layout according to the theme.
+                if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+                    currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33);
+                } else {
+                    currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11);
+                }
+            } else if (currentSslCardView.getVisibility() == View.VISIBLE) {  // The saved SSL certificate is hidden but the current website SSL certificate is visible.
+                // Check the current website SSL certificate radio button.
                 currentWebsiteCertificateRadioButton.setChecked(true);
+
+                // Uncheck the saved SSL certificate radio button.
                 savedSslCertificateRadioButton.setChecked(false);
             } else {  // Neither SSL certificate is visible.
+                // Uncheck both radio buttons.
                 savedSslCertificateRadioButton.setChecked(false);
                 currentWebsiteCertificateRadioButton.setChecked(false);
             }
-        } else {  // `pinnedSslCertificateSwitch` is not checked.
+        } else {  // An SSL certificate is not pinned.
             // Hide the SSl certificates and instructions.
-            savedSslCertificateLinearLayout.setVisibility(View.GONE);
-            currentWebsiteCertificateLinearLayout.setVisibility(View.GONE);
+            savedSslCardView.setVisibility(View.GONE);
+            currentSslCardView.setVisibility(View.GONE);
             noCurrentWebsiteCertificateTextView.setVisibility(View.GONE);
 
             // Uncheck the radio buttons.
@@ -1110,126 +1092,128 @@ public class DomainSettingsFragment extends Fragment {
             currentWebsiteCertificateRadioButton.setChecked(false);
         }
 
+        // Set the pinned IP addresses icon.
+        if (pinnedIpAddressesInt == 1) {  // Pinned IP addresses is enabled.  Once the minimum API >= 21 a selector can be sued as the tint mode instead of specifying different icons.
+            // Doing this makes no sense until it can also be done with the preferences.
+            // Check the switch.
+            pinnedIpAddressesSwitch.setChecked(true);
+
+            // Set the icon.
+            pinnedIpAddressesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ssl_certificate_enabled, null));
+        } else {  // Pinned IP Addresses is disabled.
+            // Uncheck the switch.
+            pinnedIpAddressesSwitch.setChecked(false);
+
+            // Set the icon.
+            pinnedIpAddressesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ssl_certificate_disabled, null));
+        }
+
+        // Populate the saved and current IP addresses.
+        savedIpAddressesTextView.setText(savedIpAddresses);
+        currentIpAddressesTextView.setText(DomainsActivity.currentIpAddresses);
+
+        // Set the initial display status of the IP addresses card views.
+        if (pinnedIpAddressesSwitch.isChecked()) {  // IP addresses are pinned.
+            // Set the visibility of the saved IP addresses.
+            if (savedIpAddresses == null) {  // There are no saved IP addresses.
+                savedIpAddressesCardView.setVisibility(View.GONE);
+            } else {  // There are saved IP addresses.
+                savedIpAddressesCardView.setVisibility(View.VISIBLE);
+            }
+
+            // Set the visibility of the current IP addresses.
+            currentIpAddressesCardView.setVisibility(View.VISIBLE);
+
+            // Set the status of the radio buttons and the card view backgrounds.
+            if (savedIpAddressesCardView.getVisibility() == View.VISIBLE) {  // The saved IP addresses are displayed.
+                // Check the saved IP addresses radio button.
+                savedIpAddressesRadioButton.setChecked(true);
+
+                // Uncheck the current IP addresses radio button.
+                currentIpAddressesRadioButton.setChecked(false);
+
+                // Darken the background of the current IP addresses linear layout according to the theme.
+                if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+                    currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33);
+                } else {
+                    currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11);
+                }
+            } else {  // The saved IP addresses are hidden.
+                // Check the current IP addresses radio button.
+                currentIpAddressesRadioButton.setChecked(true);
+
+                // Uncheck the saved IP addresses radio button.
+                savedIpAddressesRadioButton.setChecked(false);
+            }
+        } else {  // IP addresses are not pinned.
+            // Hide the IP addresses card views.
+            savedIpAddressesCardView.setVisibility(View.GONE);
+            currentIpAddressesCardView.setVisibility(View.GONE);
+
+            // Uncheck the radio buttons.
+            savedIpAddressesRadioButton.setChecked(false);
+            currentIpAddressesRadioButton.setChecked(false);
+        }
+
 
         // Set the JavaScript switch listener.
-        javaScriptEnabledSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
+        javaScriptSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
             if (isChecked) {  // JavaScript is enabled.
                 // Update the JavaScript icon.
-                javaScriptImageView.setImageDrawable(resources.getDrawable(R.drawable.javascript_enabled));
+                javaScriptImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.javascript_enabled, null));
 
                 // Enable the DOM storage `Switch`.
-                domStorageEnabledSwitch.setEnabled(true);
+                domStorageSwitch.setEnabled(true);
 
                 // Update the DOM storage icon.
-                if (domStorageEnabledSwitch.isChecked()) {  // DOM storage is enabled.
-                    domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_enabled));
+                if (domStorageSwitch.isChecked()) {  // DOM storage is enabled.
+                    domStorageImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.dom_storage_enabled, null));
                 } else {  // DOM storage is disabled.
-                    // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
-                        domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_dark));
-                    } else {
-                        domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_light));
-                    }
+                    // Set the icon.
+                    domStorageImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.dom_storage_disabled, null));
                 }
             } else {  // JavaScript is disabled.
                 // Update the JavaScript icon.
-                javaScriptImageView.setImageDrawable(resources.getDrawable(R.drawable.privacy_mode));
+                javaScriptImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.privacy_mode, null));
 
-                // Disable the DOM storage `Switch`.
-                domStorageEnabledSwitch.setEnabled(false);
+                // Disable the DOM storage switch.
+                domStorageSwitch.setEnabled(false);
 
-                // Set the DOM storage icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_dark));
-                } else {
-                    domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_light));
-                }
+                // Set the DOM storage icon.
+                domStorageImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.dom_storage_ghosted, null));
             }
         });
 
-        // Set the first-party cookies switch listener.
-        firstPartyCookiesEnabledSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
-            if (isChecked) {  // First-party cookies are enabled.
-                // Update the first-party cookies icon.
-                firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_enabled));
-
-                // Enable the third-party cookies switch.
-                thirdPartyCookiesEnabledSwitch.setEnabled(true);
-
-                // Update the third-party cookies icon.
-                if (thirdPartyCookiesEnabledSwitch.isChecked()) {  // Third-party cookies are enabled.
-                    thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_warning));
-                } else {  // Third-party cookies are disabled.
-                    // Set the third-party cookies icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
-                        thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark));
-                    } else {
-                        thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light));
-                    }
-                }
-            } else {  // First-party cookies are disabled.
-                // Update the first-party cookies icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark));
-                } else {
-                    firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light));
-                }
-
-                // Disable the third-party cookies switch.
-                thirdPartyCookiesEnabledSwitch.setEnabled(false);
-
-                // Set the third-party cookies icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_dark));
-                } else {
-                    thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_light));
-                }
-            }
-        });
-
-        // Set the third-party cookies switch listener.
-        thirdPartyCookiesEnabledSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
-            // Update the icon.
+        // Set the cookies switch listener.
+        cookiesSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
+            // Update the cookies icon.
             if (isChecked) {
-                thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_warning));
+                cookiesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.cookies_enabled, null));
             } else {
-                // Update the third-party cookies icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark));
-                } else {
-                    thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light));
-                }
+                cookiesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.cookies_disabled, null));
             }
         });
 
         // Set the DOM Storage switch listener.
-        domStorageEnabledSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
+        domStorageSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
             // Update the icon.
             if (isChecked) {
-                domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_enabled));
+                domStorageImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.dom_storage_enabled, null));
             } else {
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_dark));
-                } else {
-                    domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_light));
-                }
+                // Set the icon.
+                domStorageImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.dom_storage_disabled, null));
             }
         });
 
         // Set the form data switch listener.  It can be removed once the minimum API >= 26.
         if (Build.VERSION.SDK_INT < 26) {
-            formDataEnabledSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
+            formDataSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
                 // Update the icon.
                 if (isChecked) {
-                    formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_enabled));
+                    formDataImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.form_data_enabled, null));
                 } else {
-                    // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
-                        formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_dark));
-                    } else {
-                        formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_light));
-                    }
+                    // Set the icon.
+                    formDataImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.form_data_disabled, null));
                 }
             });
         }
@@ -1237,20 +1221,10 @@ public class DomainSettingsFragment extends Fragment {
         // Set the EasyList switch listener.
         easyListSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
             // Update the icon.
-            if (isChecked) {  // EasyList is on.
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_dark));
-                } else {
-                    easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_light));
-                }
-            } else {  // EasyList is off.
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_dark));
-                } else {
-                    easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_light));
-                }
+            if (isChecked) {
+                easyListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_ads_enabled, null));
+            } else {
+                easyListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_ads_disabled, null));
             }
         });
 
@@ -1258,19 +1232,10 @@ public class DomainSettingsFragment extends Fragment {
         easyPrivacySwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
             // Update the icon.
             if (isChecked) {  // EasyPrivacy is on.
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_dark));
-                } else {
-                    easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_light));
-                }
-            } else {  // EasyPrivacy is off.
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_dark));
-                } else {
-                    easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_light));
-                }
+                // Set the icon.
+                easyPrivacyImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_tracking_enabled, null));
+            } else {
+                easyPrivacyImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_tracking_disabled, null));
             }
         });
 
@@ -1278,110 +1243,67 @@ public class DomainSettingsFragment extends Fragment {
         fanboysAnnoyanceListSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
             // Update the icon and Fanboy's Social Blocking List.
             if (isChecked) {  // Fanboy's Annoyance List is on.
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark));
-                } else {
-                    fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light));
-                }
+                // Set the icon.
+                fanboysAnnoyanceListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.social_media_enabled, null));
 
                 // Disable the Fanboy's Social Blocking List switch.
                 fanboysSocialBlockingListSwitch.setEnabled(false);
 
-                // Update the Fanboy's Social Blocking List icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_dark));
-                } else {
-                    fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_light));
-                }
+                // Update the Fanboy's Social Blocking List icon.
+                fanboysSocialBlockingListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.social_media_ghosted, null));
             } else {  // Fanboy's Annoyance List is off.
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark));
-                } else {
-                    fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light));
-                }
+                // Set the icon.
+                fanboysAnnoyanceListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.social_media_disabled, null));
 
                 // Enable the Fanboy's Social Blocking List switch.
                 fanboysSocialBlockingListSwitch.setEnabled(true);
 
                 // Update the Fanboy's Social Blocking List icon.
-                if (fanboysSocialBlockingListSwitch.isChecked()) {  // Fanboy's Social Blocking List is on.
-                    // Update the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
-                        fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark));
-                    } else {
-                        fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light));
-                    }
-                } else {  // Fanboy's Social Blocking List is off.
-                    // Update the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
-                        fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark));
-                    } else {
-                        fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light));
-                    }
+                if (fanboysSocialBlockingListSwitch.isChecked()) {
+                    fanboysSocialBlockingListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.social_media_enabled, null));
+                } else {
+                    fanboysSocialBlockingListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.social_media_disabled, null));
                 }
             }
-
         });
 
         // Set the Fanboy's Social Blocking List switch listener.
         fanboysSocialBlockingListSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
             // Update the icon.
-            if (isChecked) {  // Fanboy's Social Blocking List is on.
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark));
-                } else {
-                    fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light));
-                }
-            } else {  // Fanboy's Social Blocking List is off.
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark));
-                } else {
-                    fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light));
-                }
+            if (isChecked) {
+                fanboysSocialBlockingListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.social_media_enabled, null));
+            } else {
+                fanboysSocialBlockingListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.social_media_disabled, null));
+            }
+        });
+
+        // Set the UltraList switch listener.
+        ultraListSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
+            // Update the icon.
+            if (isChecked) {
+                ultraListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_ads_enabled, null));
+            } else {
+                ultraListImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_ads_disabled, null));
             }
         });
 
         // Set the UltraPrivacy switch listener.
         ultraPrivacySwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
             // Update the icon.
-            if (isChecked) {  // UltraPrivacy is on.
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_dark));
-                } else {
-                    ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_light));
-                }
-            } else {  // UltraPrivacy is off.
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_dark));
-                } else {
-                    ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_light));
-                }
+            if (isChecked) {
+                ultraPrivacyImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_tracking_enabled, null));
+            } else {
+                ultraPrivacyImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_tracking_disabled, null));
             }
         });
 
         // Set the block all third-party requests switch listener.
         blockAllThirdPartyRequestsSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
             // Update the icon.
-            if (isChecked) {  // Blocking all third-party requests is on.
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_dark));
-                } else {
-                    blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_light));
-                }
-            } else {  // Blocking all third-party requests is off.
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_dark));
-                } else {
-                    blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_light));
-                }
+            if (isChecked) {
+                blockAllThirdPartyRequestsImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_all_third_party_requests_enabled, null));
+            } else {
+                blockAllThirdPartyRequestsImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.block_all_third_party_requests_disabled, null));
             }
         });
 
@@ -1459,11 +1381,19 @@ public class DomainSettingsFragment extends Fragment {
         fontSizeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
             @Override
             public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
-                // Update the display options for `fontSizeTextView`.
-                if (position == 0) {  // System default font size has been selected.  Display `fontSizeTextView`.
-                    fontSizeTextView.setVisibility(View.VISIBLE);
-                } else {  // A custom font size has been selected.  Hide `fontSizeTextView`.
-                    fontSizeTextView.setVisibility(View.GONE);
+                // Update the font size display options.
+                if (position == 0) {  // The system default font size has been selected.
+                    // Show the default font size text view.
+                    defaultFontSizeTextView.setVisibility(View.VISIBLE);
+
+                    // Hide the custom font size edit text.
+                    customFontSizeEditText.setVisibility(View.GONE);
+                } else {  // A custom font size has been selected.
+                    // Hide the default font size text view.
+                    defaultFontSizeTextView.setVisibility(View.GONE);
+
+                    // Show the custom font size edit text.
+                    customFontSizeEditText.setVisibility(View.VISIBLE);
                 }
             }
 
@@ -1477,50 +1407,35 @@ public class DomainSettingsFragment extends Fragment {
         swipeToRefreshSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
             @Override
             public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
-                // Update the icon and the visibility of `nightModeTextView`.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+                // Update the icon and the visibility of the night mode text view.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+                // Doing this makes no sense until it can also be done with the preferences.
                 switch (position) {
-                    case DomainsDatabaseHelper.SWIPE_TO_REFRESH_SYSTEM_DEFAULT:
-                        if (defaultSwipeToRefresh) {  // Swipe to refresh enabled by default.
-                            // Set the icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
-                                swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark));
-                            } else {
-                                swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light));
-                            }
-                        } else {  // Swipe to refresh disabled by default.
-                            // Set the icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
-                                swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark));
-                            } else {
-                                swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light));
-                            }
+                    case DomainsDatabaseHelper.SYSTEM_DEFAULT:
+                        if (defaultSwipeToRefresh) {
+                            // Set the icon.
+                            swipeToRefreshImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.refresh_enabled, null));
+                        } else {
+                            // Set the icon.
+                            swipeToRefreshImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.refresh_disabled, null));
                         }
 
-                        // Show the swipe to refresh TextView.
+                        // Show the swipe to refresh text view.
                         swipeToRefreshTextView.setVisibility(View.VISIBLE);
                         break;
 
-                    case DomainsDatabaseHelper.SWIPE_TO_REFRESH_ENABLED:
-                        // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
-                            swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark));
-                        } else {
-                            swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light));
-                        }
+                    case DomainsDatabaseHelper.ENABLED:
+                        // Set the icon.
+                        swipeToRefreshImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.refresh_enabled, null));
 
-                        // Hide the swipe to refresh TextView.
+                        // Hide the swipe to refresh text view.
                         swipeToRefreshTextView.setVisibility(View.GONE);
                         break;
 
-                    case DomainsDatabaseHelper.SWIPE_TO_REFRESH_DISABLED:
-                        // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
-                            swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark));
-                        } else {
-                            swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light));
-                        }
+                    case DomainsDatabaseHelper.DISABLED:
+                        // Set the icon.
+                        swipeToRefreshImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.refresh_disabled, null));
 
-                        // Hide the swipe to refresh TextView.
+                        // Hide the swipe to refresh text view.
                         swipeToRefreshTextView.setVisibility(View.GONE);
                 }
             }
@@ -1531,112 +1446,99 @@ public class DomainSettingsFragment extends Fragment {
             }
         });
 
-        // Set the night mode spinner listener.
-        nightModeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+        // Set the WebView theme spinner listener.
+        webViewThemeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
             @Override
             public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
-                // Update the icon and the visibility of `nightModeTextView`.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+                // Update the icon and the visibility of the WebView theme text view.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+                // Doing this makes no sense until it can also be done with the preferences.
                 switch (position) {
-                    case DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT:
-                        if (defaultNightMode) {  // Night mode enabled by default.
-                            // Set the icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
-                                nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_dark));
-                            } else {
-                                nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_light));
-                            }
-                        } else {  // Night mode disabled by default.
-                            // Set the icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
-                                nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_dark));
-                            } else {
-                                nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_light));
-                            }
-                        }
+                    case DomainsDatabaseHelper.SYSTEM_DEFAULT:  // the domain WebView theme is system default.
+                        // Set the icon according to the app WebView theme.
+                        switch (appWebViewThemeEntryNumber) {
+                            case DomainsDatabaseHelper.SYSTEM_DEFAULT:  // The default WebView theme is system default.
+                                // Set the icon according to the app theme.
+                                if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+                                    // Set the light theme icon.
+                                    webViewThemeImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.webview_light_theme, null));
+                                } else {
+                                    // Set the dark theme icon.
+                                    webViewThemeImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.webview_dark_theme, null));
+                                }
+                                break;
 
-                        // Show the night mode TextView.
-                        nightModeTextView.setVisibility(View.VISIBLE);
-                        break;
+                            case DomainsDatabaseHelper.LIGHT_THEME:  // The default WebView theme is light.
+                                // Set the icon.
+                                webViewThemeImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.webview_light_theme, null));
+                                break;
 
-                    case DomainsDatabaseHelper.NIGHT_MODE_ENABLED:
-                        // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
-                            nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_dark));
-                        } else {
-                            nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_light));
+                            case DomainsDatabaseHelper.DARK_THEME:  // The default WebView theme is dark.
+                                // Set the icon.
+                                webViewThemeImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.webview_dark_theme, null));
+                                break;
                         }
 
-                        // Hide `nightModeTextView`.
-                        nightModeTextView.setVisibility(View.GONE);
+                        // Show the WebView theme text view.
+                        webViewThemeTextView.setVisibility(View.VISIBLE);
                         break;
 
-                    case DomainsDatabaseHelper.NIGHT_MODE_DISABLED:
-                        // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
-                            nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_dark));
-                        } else {
-                            nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_light));
-                        }
+                    case DomainsDatabaseHelper.LIGHT_THEME:  // The domain WebView theme is light.
+                        // Set the icon.
+                        webViewThemeImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.webview_light_theme, null));
 
-                        // Hide `nightModeTextView`.
-                        nightModeTextView.setVisibility(View.GONE);
+                        // Hide the WebView theme text view.
+                        webViewThemeTextView.setVisibility(View.GONE);
                         break;
-                }
 
-                // Create a `boolean` to store the current night mode setting.
-                boolean currentNightModeEnabled = (position == DomainsDatabaseHelper.NIGHT_MODE_ENABLED) || ((position == DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT) && defaultNightMode);
+                    case DomainsDatabaseHelper.DARK_THEME:  // The domain WebView theme is dark.
+                        // Set the icon.
+                        webViewThemeImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.webview_dark_theme, null));
 
-                // Disable the JavaScript `Switch` if night mode is enabled.
-                if (currentNightModeEnabled) {
-                    javaScriptEnabledSwitch.setEnabled(false);
-                } else {
-                    javaScriptEnabledSwitch.setEnabled(true);
+                        // Hide the WebView theme text view.
+                        webViewThemeTextView.setVisibility(View.GONE);
+                        break;
                 }
+            }
 
-                // Update the JavaScript icon.
-                if ((javaScriptEnabledInt == 1) || currentNightModeEnabled) {
-                    javaScriptImageView.setImageDrawable(resources.getDrawable(R.drawable.javascript_enabled));
-                } else {
-                    javaScriptImageView.setImageDrawable(resources.getDrawable(R.drawable.privacy_mode));
-                }
+            @Override
+            public void onNothingSelected(AdapterView<?> parent) {
+                // Do nothing.
+            }
+        });
 
-                // Update the DOM storage status.
-                if ((javaScriptEnabledInt == 1) || currentNightModeEnabled) {  // JavaScript is enabled.
-                    // Enable the DOM storage `Switch`.
-                    domStorageEnabledSwitch.setEnabled(true);
+        // Set the wide viewport spinner listener.
+        wideViewportSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+            @Override
+            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+                // Update the icon and the visibility of the wide viewport text view.
+                switch (position) {
+                    case DomainsDatabaseHelper.SYSTEM_DEFAULT:
+                        // Set the icon.
+                        if (defaultWideViewport) {  // Wide viewport is enabled by default.
+                            wideViewportImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.wide_viewport_enabled, null));
+                        } else {  // Wide viewport is disabled by default.
+                            wideViewportImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.wide_viewport_disabled, null));
+                        }
 
-                    // Set the DOM storage status.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
-                    if (domStorageEnabledInt == 1) {  // Both JavaScript and DOM storage are enabled.
-                        domStorageEnabledSwitch.setChecked(true);
-                        domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_enabled));
-                    } else {  // JavaScript is enabled but DOM storage is disabled.
-                        // Set the DOM storage switch to off.
-                        domStorageEnabledSwitch.setChecked(false);
+                        // Show the wide viewport text view.
+                        wideViewportTextView.setVisibility(View.VISIBLE);
+                        break;
 
+                    case DomainsDatabaseHelper.ENABLED:
                         // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
-                            domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_dark));
-                        } else {
-                            domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_light));
-                        }
-                    }
-                } else {  // JavaScript is disabled.
-                    // Disable the DOM storage `Switch`.
-                    domStorageEnabledSwitch.setEnabled(false);
-
-                    // Set the checked status of DOM storage.
-                    if (domStorageEnabledInt == 1) {  // DOM storage is enabled but JavaScript is disabled.
-                        domStorageEnabledSwitch.setChecked(true);
-                    } else {  // Both JavaScript and DOM storage are disabled.
-                        domStorageEnabledSwitch.setChecked(false);
-                    }
+                        wideViewportImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.wide_viewport_enabled, null));
 
-                    // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
-                        domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_dark));
-                    } else {
-                        domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_light));
-                    }
+                        // Hide the wide viewport text view.
+                        wideViewportTextView.setVisibility(View.GONE);
+                        break;
+
+                    case DomainsDatabaseHelper.DISABLED:
+                        // Set the icon.
+                        wideViewportImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.wide_viewport_disabled, null));
+
+                        // Hid ethe wide viewport text view.
+                        wideViewportTextView.setVisibility(View.GONE);
+                        break;
                 }
             }
 
@@ -1650,50 +1552,34 @@ public class DomainSettingsFragment extends Fragment {
         displayWebpageImagesSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
             @Override
             public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
-                // Update the icon and the visibility of `displayImagesTextView`.
+                // Update the icon and the visibility of the display images text view.
                 switch (position) {
-                    case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_SYSTEM_DEFAULT:
-                        if (defaultDisplayWebpageImages) {
-                            // Set the icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
-                                displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark));
-                            } else {
-                                displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light));
-                            }
-                        } else {
-                            // Set the icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
-                                displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark));
-                            } else {
-                                displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light));
-                            }
+                    case DomainsDatabaseHelper.SYSTEM_DEFAULT:
+                        if (defaultDisplayWebpageImages) {  // Display webpage images is enabled by default.
+                            // Set the icon.
+                            displayWebpageImagesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.images_enabled, null));
+                        } else {  // Display webpage images is disabled by default.
+                            // Set the icon.
+                            displayWebpageImagesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.images_disabled, null));
                         }
 
-                        // Show `displayImagesTextView`.
+                        // Show the display images text view.
                         displayImagesTextView.setVisibility(View.VISIBLE);
                         break;
 
-                    case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_ENABLED:
-                        // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
-                            displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark));
-                        } else {
-                            displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light));
-                        }
+                    case DomainsDatabaseHelper.ENABLED:
+                        // Set the icon.
+                        displayWebpageImagesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.images_enabled, null));
 
-                        // Hide `displayImagesTextView`.
+                        // Hide the display images text view.
                         displayImagesTextView.setVisibility(View.GONE);
                         break;
 
-                    case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_DISABLED:
-                        // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
-                            displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark));
-                        } else {
-                            displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light));
-                        }
+                    case DomainsDatabaseHelper.DISABLED:
+                        // Set the icon.
+                        displayWebpageImagesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.images_disabled, null));
 
-                        // Hide `displayImagesTextView`.
+                        // Hide the display images text view.
                         displayImagesTextView.setVisibility(View.GONE);
                         break;
                 }
@@ -1707,59 +1593,87 @@ public class DomainSettingsFragment extends Fragment {
         
         // Set the pinned SSL certificate switch listener.
         pinnedSslCertificateSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
-            // Update the icon
-            if (isChecked) {  // Pinned SSL certificate is enabled.
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_dark));
-                } else {
-                    pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_light));
-                }
+            // Update the icon.
+            if (isChecked) {  // SSL certificate pinning is enabled.
+                // Set the icon.
+                pinnedSslCertificateImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ssl_certificate_enabled, null));
 
                 // Update the visibility of the saved SSL certificate.
-                if (savedSslCertificateIssuedToCNameString == null) {
-                    savedSslCertificateLinearLayout.setVisibility(View.GONE);
+                if (savedSslIssuedToCNameString == null) {
+                    savedSslCardView.setVisibility(View.GONE);
                 } else {
-                    savedSslCertificateLinearLayout.setVisibility(View.VISIBLE);
+                    savedSslCardView.setVisibility(View.VISIBLE);
                 }
 
                 // Update the visibility of the current website SSL certificate.
-                if (currentWebsiteSslCertificate == null) {
+                if (DomainsActivity.sslIssuedToCName == null) {
                     // Hide the SSL certificate.
-                    currentWebsiteCertificateLinearLayout.setVisibility(View.GONE);
+                    currentSslCardView.setVisibility(View.GONE);
 
                     // Show the instruction.
                     noCurrentWebsiteCertificateTextView.setVisibility(View.VISIBLE);
                 } else {
                     // Show the SSL certificate.
-                    currentWebsiteCertificateLinearLayout.setVisibility(View.VISIBLE);
+                    currentSslCardView.setVisibility(View.VISIBLE);
 
                     // Hide the instruction.
                     noCurrentWebsiteCertificateTextView.setVisibility(View.GONE);
                 }
 
                 // Set the status of the radio buttons.
-                if (savedSslCertificateLinearLayout.getVisibility() == View.VISIBLE) {  // The saved SSL certificate is displayed.
+                if (savedSslCardView.getVisibility() == View.VISIBLE) {  // The saved SSL certificate is displayed.
+                    // Check the saved SSL certificate radio button.
                     savedSslCertificateRadioButton.setChecked(true);
+
+                    // Uncheck the current website SSL certificate radio button.
                     currentWebsiteCertificateRadioButton.setChecked(false);
-                } else if (currentWebsiteCertificateLinearLayout.getVisibility() == View.VISIBLE) {  // The saved SSL certificate is hidden but the current website SSL certificate is visible.
+
+                    // Set the background of the saved SSL certificate linear layout to be transparent.
+                    savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent);
+
+                    // Darken the background of the current website SSL certificate linear layout according to the theme.
+                    if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+                        currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33);
+                    } else {
+                        currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11);
+                    }
+
+                    // Scroll to the current website SSL certificate card.
+                    savedSslCardView.getParent().requestChildFocus(savedSslCardView, savedSslCardView);
+                } else if (currentSslCardView.getVisibility() == View.VISIBLE) {  // The saved SSL certificate is hidden but the current website SSL certificate is visible.
+                    // Check the current website SSL certificate radio button.
                     currentWebsiteCertificateRadioButton.setChecked(true);
+
+                    // Uncheck the saved SSL certificate radio button.
                     savedSslCertificateRadioButton.setChecked(false);
+
+                    // Set the background of the current website SSL certificate linear layout to be transparent.
+                    currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.transparent);
+
+                    // Darken the background of the saved SSL certificate linear layout according to the theme.
+                    if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+                        savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33);
+                    } else {
+                        savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11);
+                    }
+
+                    // Scroll to the current website SSL certificate card.
+                    currentSslCardView.getParent().requestChildFocus(currentSslCardView, currentSslCardView);
                 } else {  // Neither SSL certificate is visible.
+                    // Uncheck both radio buttons.
                     savedSslCertificateRadioButton.setChecked(false);
                     currentWebsiteCertificateRadioButton.setChecked(false);
+
+                    // Scroll to the current website SSL certificate card.
+                    noCurrentWebsiteCertificateTextView.getParent().requestChildFocus(noCurrentWebsiteCertificateTextView, noCurrentWebsiteCertificateTextView);
                 }
-            } else {  // Pinned SSL certificate is disabled.
-                // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
-                    pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_dark));
-                } else {
-                    pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_light));
-                }
+            } else {  // SSL certificate pinning is disabled.
+                // Set the icon.
+                pinnedSslCertificateImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ssl_certificate_disabled, null));
 
                 // Hide the SSl certificates and instructions.
-                savedSslCertificateLinearLayout.setVisibility(View.GONE);
-                currentWebsiteCertificateLinearLayout.setVisibility(View.GONE);
+                savedSslCardView.setVisibility(View.GONE);
+                currentSslCardView.setVisibility(View.GONE);
                 noCurrentWebsiteCertificateTextView.setVisibility(View.GONE);
 
                 // Uncheck the radio buttons.
@@ -1768,26 +1682,222 @@ public class DomainSettingsFragment extends Fragment {
             }
         });
 
-        savedSslCertificateLinearLayout.setOnClickListener((View v) -> {
+        savedSslCardView.setOnClickListener((View view) -> {
+            // Check the saved SSL certificate radio button.
             savedSslCertificateRadioButton.setChecked(true);
+
+            // Uncheck the current website SSL certificate radio button.
             currentWebsiteCertificateRadioButton.setChecked(false);
+
+            // Set the background of the saved SSL certificate linear layout to be transparent.
+            savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent);
+
+            // Darken the background of the current website SSL certificate linear layout according to the theme.
+            if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+                currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33);
+            } else {
+                currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11);
+            }
         });
 
-        savedSslCertificateRadioButton.setOnClickListener((View v) -> {
+        savedSslCertificateRadioButton.setOnClickListener((View view) -> {
+            // Check the saved SSL certificate radio button.
             savedSslCertificateRadioButton.setChecked(true);
+
+            // Uncheck the current website SSL certificate radio button.
             currentWebsiteCertificateRadioButton.setChecked(false);
+
+            // Set the background of the saved SSL certificate linear layout to be transparent.
+            savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent);
+
+            // Darken the background of the current website SSL certificate linear layout according to the theme.
+            if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+                currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33);
+            } else {
+                currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11);
+            }
         });
 
-        currentWebsiteCertificateLinearLayout.setOnClickListener((View v) -> {
+        currentSslCardView.setOnClickListener((View view) -> {
+            // Check the current website SSL certificate radio button.
             currentWebsiteCertificateRadioButton.setChecked(true);
+
+            // Uncheck the saved SSL certificate radio button.
             savedSslCertificateRadioButton.setChecked(false);
+
+            // Set the background of the current website SSL certificate linear layout to be transparent.
+            currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.transparent);
+
+            // Darken the background of the saved SSL certificate linear layout according to the theme.
+            if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+                savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33);
+            } else {
+                savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11);
+            }
         });
 
-        currentWebsiteCertificateRadioButton.setOnClickListener((View v) -> {
+        currentWebsiteCertificateRadioButton.setOnClickListener((View view) -> {
+            // Check the current website SSL certificate radio button.
             currentWebsiteCertificateRadioButton.setChecked(true);
+
+            // Uncheck the saved SSL certificate radio button.
             savedSslCertificateRadioButton.setChecked(false);
+
+            // Set the background of the current website SSL certificate linear layout to be transparent.
+            currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.transparent);
+
+            // Darken the background of the saved SSL certificate linear layout according to the theme.
+            if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+                savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33);
+            } else {
+                savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11);
+            }
         });
 
+        // Set the pinned IP addresses switch listener.
+        pinnedIpAddressesSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
+            // Update the icon.
+            if (isChecked) {  // IP addresses pinning is enabled.
+                // Set the icon.
+                pinnedIpAddressesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ssl_certificate_enabled, null));
+
+                // Update the visibility of the saved IP addresses card view.
+                if (savedIpAddresses == null) {  // There are no saved IP addresses.
+                    savedIpAddressesCardView.setVisibility(View.GONE);
+                } else {  // There are saved IP addresses.
+                    savedIpAddressesCardView.setVisibility(View.VISIBLE);
+                }
+
+                // Show the current IP addresses card view.
+                currentIpAddressesCardView.setVisibility(View.VISIBLE);
+
+                // Set the status of the radio buttons.
+                if (savedIpAddressesCardView.getVisibility() == View.VISIBLE) {  // The saved IP addresses are visible.
+                    // Check the saved IP addresses radio button.
+                    savedIpAddressesRadioButton.setChecked(true);
+
+                    // Uncheck the current IP addresses radio button.
+                    currentIpAddressesRadioButton.setChecked(false);
+
+                    // Set the background of the saved IP addresses linear layout to be transparent.
+                    savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent);
+
+                    // Darken the background of the current IP addresses linear layout according to the theme.
+                    if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+                        currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33);
+                    } else {
+                        currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11);
+                    }
+                } else {  // The saved IP addresses are not visible.
+                    // Check the current IP addresses radio button.
+                    currentIpAddressesRadioButton.setChecked(true);
+
+                    // Uncheck the saved IP addresses radio button.
+                    savedIpAddressesRadioButton.setChecked(false);
+
+                    // Set the background of the current IP addresses linear layout to be transparent.
+                    currentIpAddressesLinearLayout.setBackgroundResource(R.color.transparent);
+
+                    // Darken the background of the saved IP addresses linear layout according to the theme.
+                    if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+                        savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33);
+                    } else {
+                        savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11);
+                    }
+                }
+
+                // Scroll to the bottom of the card views.
+                currentIpAddressesCardView.getParent().requestChildFocus(currentIpAddressesCardView, currentIpAddressesCardView);
+            } else {  // IP addresses pinning is disabled.
+                // Set the icon.
+                pinnedIpAddressesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ssl_certificate_disabled, null));
+
+                // Hide the IP addresses card views.
+                savedIpAddressesCardView.setVisibility(View.GONE);
+                currentIpAddressesCardView.setVisibility(View.GONE);
+
+                // Uncheck the radio buttons.
+                savedIpAddressesRadioButton.setChecked(false);
+                currentIpAddressesRadioButton.setChecked(false);
+            }
+        });
+
+        savedIpAddressesCardView.setOnClickListener((View view) -> {
+            // Check the saved IP addresses radio button.
+            savedIpAddressesRadioButton.setChecked(true);
+
+            // Uncheck the current website IP addresses radio button.
+            currentIpAddressesRadioButton.setChecked(false);
+
+            // Set the background of the saved IP addresses linear layout to be transparent.
+            savedIpAddressesLinearLayout.setBackgroundResource(R.color.transparent);
+
+            // Darken the background of the current IP addresses linear layout according to the theme.
+            if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+                currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33);
+            } else {
+                currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11);
+            }
+        });
+
+        savedIpAddressesRadioButton.setOnClickListener((View view) -> {
+            // Check the saved IP addresses radio button.
+            savedIpAddressesRadioButton.setChecked(true);
+
+            // Uncheck the current website IP addresses radio button.
+            currentIpAddressesRadioButton.setChecked(false);
+
+            // Set the background of the saved IP addresses linear layout to be transparent.
+            savedIpAddressesLinearLayout.setBackgroundResource(R.color.transparent);
+
+            // Darken the background of the current IP addresses linear layout according to the theme.
+            if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+                currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33);
+            } else {
+                currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11);
+            }
+        });
+
+        currentIpAddressesCardView.setOnClickListener((View view) -> {
+            // Check the current IP addresses radio button.
+            currentIpAddressesRadioButton.setChecked(true);
+
+            // Uncheck the saved IP addresses radio button.
+            savedIpAddressesRadioButton.setChecked(false);
+
+            // Set the background of the current IP addresses linear layout to be transparent.
+            currentIpAddressesLinearLayout.setBackgroundResource(R.color.transparent);
+
+            // Darken the background of the saved IP addresses linear layout according to the theme.
+            if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+                savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33);
+            } else {
+                savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11);
+            }
+        });
+
+        currentIpAddressesRadioButton.setOnClickListener((View view) -> {
+            // Check the current IP addresses radio button.
+            currentIpAddressesRadioButton.setChecked(true);
+
+            // Uncheck the saved IP addresses radio button.
+            savedIpAddressesRadioButton.setChecked(false);
+
+            // Set the background of the current IP addresses linear layout to be transparent.
+            currentIpAddressesLinearLayout.setBackgroundResource(R.color.transparent);
+
+            // Darken the background of the saved IP addresses linear layout according to the theme.
+            if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+                savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33);
+            } else {
+                savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11);
+            }
+        });
+
+        // Set the scroll Y.
+        domainSettingsScrollView.post(() -> domainSettingsScrollView.setScrollY(scrollY));
+
+        // Return the domain settings view.
         return domainSettingsView;
     }
 
@@ -1797,7 +1907,6 @@ public class DomainSettingsFragment extends Fragment {
 
         // Check various wildcard permutations if `domainName` and `certificateCommonName` are not empty.
         // `noinspection ConstantCondition` removes Android Studio's incorrect lint warning that `domainName` can never be `null`.
-        //noinspection ConstantConditions
         if ((domainName != null) && (certificateCommonName != null)) {
             // Check if the domains match.
             if (domainName.equals(certificateCommonName)) {
@@ -1867,4 +1976,4 @@ public class DomainSettingsFragment extends Fragment {
 
         return domainNamesMatch;
     }
-}
+}
\ No newline at end of file