]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java
Add option to download with external program. https://redmine.stoutner.com/issues/333
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / fragments / DomainSettingsFragment.java
index d003a99a59ceddb8277a0997718cb9af55580fce..ad6653c5387644b7d4fec5f39d3d9d70a9700bf0 100644 (file)
@@ -27,7 +27,7 @@ import android.database.Cursor;
 import android.net.http.SslCertificate;
 import android.os.Build;
 import android.os.Bundle;
-// We have to use `android.support.v4.app.Fragment` until minimum API >= 23.  Otherwise we cannot call `getContext()`.
+// `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;
@@ -77,7 +77,7 @@ public class DomainSettingsFragment extends Fragment {
         databaseId = getArguments().getInt(DATABASE_ID);
     }
 
-    // We have to use the deprecated `getDrawable()` until the minimum API >= 21.
+    // The deprecated `getDrawable()` must be used until the minimum API >= 21.
     @SuppressWarnings("deprecation")
     @Override
     public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -92,11 +92,12 @@ public class DomainSettingsFragment extends Fragment {
         SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
 
         // Store the default settings.
-        final String defaultUserAgentString = sharedPreferences.getString("user_agent", "PrivacyBrowser/1.0");
+        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");
-        final boolean defaultDisplayWebpageImagesBoolean = sharedPreferences.getBoolean("display_website_images", true);
-        final boolean defaultNightModeBoolean = sharedPreferences.getBoolean("night_mode", false);
+        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);
@@ -109,19 +110,34 @@ public class DomainSettingsFragment extends Fragment {
         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);
-        final ImageView formDataImageView = domainSettingsView.findViewById(R.id.domain_settings_form_data_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 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 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);
@@ -156,7 +172,7 @@ public class DomainSettingsFragment extends Fragment {
         // Get the current website SSL certificate
         final SslCertificate currentWebsiteSslCertificate = MainWebViewActivity.sslCertificate;
 
-        // Initialize the database handler.  The two `nulls` do not specify the database name or a `CursorFactory`.  The `0` specifies the database version, but that is ignored and set instead using a constant in `DomainsDatabaseHelper`.
+        // 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.
@@ -169,11 +185,18 @@ public class DomainSettingsFragment extends Fragment {
         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));
-        final String currentUserAgentString = domainCursor.getString(domainCursor.getColumnIndex(DomainsDatabaseHelper.USER_AGENT));
+        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 displayImagesInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.DISPLAY_IMAGES));
+        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));
@@ -195,27 +218,29 @@ public class DomainSettingsFragment extends Fragment {
             savedSslCertificateEndDate = new Date(domainCursor.getLong(domainCursor.getColumnIndex(DomainsDatabaseHelper.SSL_END_DATE)));
         }
 
-        // Create `ArrayAdapters` for the `Spinners`and their `entry values`.
-        ArrayAdapter<CharSequence> userAgentArrayAdapter = ArrayAdapter.createFromResource(context, R.array.domain_settings_user_agent_entries, R.layout.domain_settings_spinner_item);
-        final ArrayAdapter<CharSequence> userAgentEntryValuesArrayAdapter = ArrayAdapter.createFromResource(context, R.array.domain_settings_user_agent_entry_values, R.layout.domain_settings_spinner_item);
-        ArrayAdapter<CharSequence> fontSizeArrayAdapter = ArrayAdapter.createFromResource(context, R.array.domain_settings_font_size_entries, R.layout.domain_settings_spinner_item);
-        ArrayAdapter<CharSequence> fontSizeEntryValuesArrayAdapter = ArrayAdapter.createFromResource(context, R.array.domain_settings_font_size_entry_values, R.layout.domain_settings_spinner_item);
-        final ArrayAdapter<CharSequence> displayImagesArrayAdapter = ArrayAdapter.createFromResource(context, R.array.display_webpage_images_array, R.layout.domain_settings_spinner_item);
-        ArrayAdapter<CharSequence> nightModeArrayAdapter = ArrayAdapter.createFromResource(context, R.array.night_mode_array, R.layout.domain_settings_spinner_item);
-
-        // Set the `DropDownViewResource` on the `Spinners`.
-        userAgentArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_item);
-        fontSizeArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_item);
-        displayImagesArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_item);
-        nightModeArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_item);
-
-        // Set the `ArrayAdapters` for the `Spinners`.
-        userAgentSpinner.setAdapter(userAgentArrayAdapter);
+        // 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> 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> 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);
+        displayImagesArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_items);
+
+        // Set the array adapters for the spinners.
+        userAgentSpinner.setAdapter(translatedUserAgentArrayAdapter);
         fontSizeSpinner.setAdapter(fontSizeArrayAdapter);
-        displayWebpageImagesSpinner.setAdapter(displayImagesArrayAdapter);
+        swipeToRefreshSpinner.setAdapter(swipeToRefreshArrayAdapter);
         nightModeSpinner.setAdapter(nightModeArrayAdapter);
+        displayWebpageImagesSpinner.setAdapter(displayImagesArrayAdapter);
 
-        // Create a `SpannableStringBuilder` for each `TextView` that needs multiple colors of text.
+        // 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);
@@ -316,9 +341,9 @@ public class DomainSettingsFragment extends Fragment {
         });
 
         // Create a `boolean` to track if night mode is enabled.
-        boolean nightModeEnabled = (nightModeInt == DomainsDatabaseHelper.NIGHT_MODE_ENABLED) || ((nightModeInt == DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT) && defaultNightModeBoolean);
+        boolean nightModeEnabled = (nightModeInt == DomainsDatabaseHelper.NIGHT_MODE_ENABLED) || ((nightModeInt == DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT) && defaultNightMode);
 
-        // Disable the JavaScript `Switch` if night mode is enabled.
+        // Disable the JavaScript switch if night mode is enabled.
         if (nightModeEnabled) {
             javaScriptEnabledSwitch.setEnabled(false);
         } else {
@@ -332,14 +357,14 @@ public class DomainSettingsFragment extends Fragment {
             javaScriptImageView.setImageDrawable(resources.getDrawable(R.drawable.privacy_mode));
         }
 
-        // Set the JavaScript `Switch` status.
+        // Set the JavaScript switch status.
         if (javaScriptEnabledInt == 1) {  // JavaScript is enabled.
             javaScriptEnabledSwitch.setChecked(true);
         } else {  // JavaScript is disabled.
             javaScriptEnabledSwitch.setChecked(false);
         }
 
-        // Set the first-party cookies status.  Once minimum API >= 21 we can use a selector as the tint mode instead of specifying different icons.
+        // 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));
@@ -358,7 +383,7 @@ public class DomainSettingsFragment extends Fragment {
         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 minimum API >= 21 we can use a selector as the tint mode instead of specifying different icons.
+                // 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));
@@ -391,7 +416,7 @@ public class DomainSettingsFragment extends Fragment {
                 }
             }
         } else {  // Third-party cookies cannot be configured for API <= 21.
-            // Hide the `LinearLayout` for third-party cookies.
+            // Hide the LinearLayout for third-party cookies.
             thirdPartyCookiesLinearLayout.setVisibility(View.GONE);
         }
 
@@ -400,7 +425,7 @@ public class DomainSettingsFragment extends Fragment {
             // Enable the DOM storage `Switch`.
             domStorageEnabledSwitch.setEnabled(true);
 
-            // Set the DOM storage status.  Once minimum API >= 21 we can use a selector as the tint mode instead of specifying different icons.
+            // 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));
@@ -434,85 +459,261 @@ public class DomainSettingsFragment extends Fragment {
             }
         }
 
-        // Set the form data status.  Once minimum API >= 21 we can use a selector as the tint mode instead of specifying different icons.
-        if (formDataEnabledInt == 1) {  // Form data is enabled.
-            formDataEnabledSwitch.setChecked(true);
-            formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_enabled));
-        } else {  // Form data is disabled.
-            // Set the form data switch to off.
-            formDataEnabledSwitch.setChecked(false);
+        // 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.
+        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);
+        } 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));
+            } else {  // Form data is off.
+                // Turn the form data switch to off.
+                formDataEnabledSwitch.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 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.
+            // 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));
+            }
+        } 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 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.
+            // 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));
+            }
+        } 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 Fanboy's Annoyance List status.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+        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));
+            }
+        } 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));
+            }
+        }
+
+        // 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.  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.
+                // Enable the switch and turn it on.
+                fanboysSocialBlockingListSwitch.setEnabled(true);
+                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));
+                }
+            } else {  // Fanboy's Social Blocking List is off.
+                // Enable the switch but turn it off.
+                fanboysSocialBlockingListSwitch.setEnabled(true);
+                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));
+                }
+            }
+        } 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);
+            }
 
             // Set the icon according to the theme.
             if (MainWebViewActivity.darkTheme) {
-                formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_dark));
+                fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_dark));
             } else {
-                formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_light));
+                fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_light));
             }
         }
 
-        // We need to inflated a `WebView` to get the default user agent.
-        // `@SuppressLint("InflateParams")` removes the warning about using `null` as the `ViewGroup`, which in this case makes sense because we don't want to display `bare_webview` on the screen.  `false` does not attach the view to the root.
+        // 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.
+            // 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));
+            }
+        } 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 third-party resource blocking status.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+        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));
+            }
+        } 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));
+            }
+        }
+
+        // Inflated a WebView to get the default user agent.
+        // `@SuppressLint("InflateParams")` removes the warning about using `null` as the `ViewGroup`, which in this case makes sense because the bare WebView should not be displayed on the screen.
         @SuppressLint("InflateParams") View bareWebViewLayout = inflater.inflate(R.layout.bare_webview, null, false);
         WebView bareWebView = bareWebViewLayout.findViewById(R.id.bare_webview);
         final String webViewDefaultUserAgentString = bareWebView.getSettings().getUserAgentString();
 
-        // Get the position of the user agent in `userAgentEntryValuesArrayAdapter`.
-        int userAgentArrayPosition = userAgentEntryValuesArrayAdapter.getPosition(currentUserAgentString);
+        // Get a handle for the user agent array adapter.  This array does not contain the `System default` entry.
+        ArrayAdapter<CharSequence> userAgentNamesArray = ArrayAdapter.createFromResource(context, R.array.user_agent_names, R.layout.spinner_item);
+
+        // Get the positions of the user agent and the default user agent.
+        int userAgentArrayPosition = userAgentNamesArray.getPosition(currentUserAgentName);
+        int defaultUserAgentArrayPosition = userAgentNamesArray.getPosition(defaultUserAgentName);
 
-        // Set the user agent.
-        if (userAgentArrayPosition == -1) {  // We are using a custom `userAgentString`.
-            // Set `userAgentSpinner` to `Custom`.
-            userAgentSpinner.setSelection(userAgentEntryValuesArrayAdapter.getPosition("Custom user agent"));
+        // Get a handle for the user agent data array.  This array does not contain the `System default` entry.
+        String[] userAgentDataArray = resources.getStringArray(R.array.user_agent_data);
 
-            // Hide `userAgentTextView`.
+        // Set the user agent text.
+        if (currentUserAgentName.equals(getString(R.string.system_default_user_agent))) {  // Use the system default user agent.
+            // Set the user agent according to the system default.
+            switch (defaultUserAgentArrayPosition) {
+                case MainWebViewActivity.UNRECOGNIZED_USER_AGENT:  // The default user agent name is not on the canonical list.
+                    // This is probably because it was set in an older version of Privacy Browser before the switch to persistent user agent names.
+                    userAgentTextView.setText(defaultUserAgentName);
+                    break;
+
+                case MainWebViewActivity.SETTINGS_WEBVIEW_DEFAULT_USER_AGENT:
+                    // Display the `WebView` default user agent.
+                    userAgentTextView.setText(webViewDefaultUserAgentString);
+                    break;
+
+                case MainWebViewActivity.SETTINGS_CUSTOM_USER_AGENT:
+                    // Display the custom user agent.
+                    userAgentTextView.setText(defaultCustomUserAgentString);
+                    break;
+
+                default:
+                    // Get the user agent string from the user agent data array.
+                    userAgentTextView.setText(userAgentDataArray[defaultUserAgentArrayPosition]);
+            }
+        } else if (userAgentArrayPosition == MainWebViewActivity.UNRECOGNIZED_USER_AGENT) {  // A custom user agent is stored in the current user agent name.
+            // Set the user agent spinner to `Custom user agent`.
+            userAgentSpinner.setSelection(MainWebViewActivity.DOMAINS_CUSTOM_USER_AGENT);
+
+            // Hide the user agent TextView.
             userAgentTextView.setVisibility(View.GONE);
 
-            // Show `customUserAgentEditText` and set `userAgentString` as the text.
+            // Show the custom user agent EditText and set the current user agent name as the text.
             customUserAgentEditText.setVisibility(View.VISIBLE);
-            customUserAgentEditText.setText(currentUserAgentString);
-        } else{  // We are using one of the preset user agents.
-            // Set the `userAgentSpinner` selection.
-            userAgentSpinner.setSelection(userAgentArrayPosition);
+            customUserAgentEditText.setText(currentUserAgentName);
+        } else {  // The user agent name contains one of the canonical user agents.
+            // Set the user agent spinner selection.  The spinner has one more entry at the beginning than the user agent data array, so the position must be incremented.
+            userAgentSpinner.setSelection(userAgentArrayPosition + 1);
 
-            // Show `userAgentTextView`.
+            // Show the user agent TextView.
             userAgentTextView.setVisibility(View.VISIBLE);
 
-            // Hide `customUserAgentEditText`.
+            // Hide the custom user agent EditText.
             customUserAgentEditText.setVisibility(View.GONE);
 
             // Set the user agent text.
-            switch (currentUserAgentString) {
-                case "System default user agent":
-                    // Display the user agent text string.
-                    switch (defaultUserAgentString) {
-                        case "WebView default user agent":
-                            // Display the `WebView` default user agent.
-                            userAgentTextView.setText(webViewDefaultUserAgentString);
-                            break;
-
-                        case "Custom user agent":
-                            // Display the custom user agent.
-                            userAgentTextView.setText(defaultCustomUserAgentString);
-                            break;
-
-                        default:
-                            // Display the text from `defaultUserAgentString`.
-                            userAgentTextView.setText(defaultUserAgentString);
-                    }
-                    break;
-
-                case "WebView default user agent":
-                    // Display the `WebView` default user agent.
+            switch (userAgentArrayPosition) {
+                case MainWebViewActivity.DOMAINS_WEBVIEW_DEFAULT_USER_AGENT:
+                    // Display the WebView default user agent.
                     userAgentTextView.setText(webViewDefaultUserAgentString);
                     break;
 
                 default:
-                    // Display the text from `currentUserAgentString`.
-                    userAgentTextView.setText(currentUserAgentString);
+                    // 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 TextView is clicked.
         userAgentTextView.setOnClickListener((View v) -> {
             // Open the user agent spinner.
             userAgentSpinner.performClick();
@@ -526,97 +727,96 @@ public class DomainSettingsFragment extends Fragment {
         int defaultFontSizeArrayPosition = fontSizeEntryValuesArrayAdapter.getPosition(defaultFontSizeString);
         fontSizeTextView.setText(fontSizeArrayAdapter.getItem(defaultFontSizeArrayPosition));
 
-        // Set the display options for `fontSizeTextView`.
+        // 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);
         }
 
-        // Open the font size spinner when the `TextView` is clicked.
+        // Open the font size spinner when the TextView is clicked.
         fontSizeTextView.setOnClickListener((View v) -> {
             // Open the user agent spinner.
             fontSizeSpinner.performClick();
         });
 
-        // Display the website images mode in the spinner.
-        displayWebpageImagesSpinner.setSelection(displayImagesInt);
+        // Display the swipe to refresh selection in the spinner.
+        swipeToRefreshSpinner.setSelection(swipeToRefreshInt);
 
-        // Set the default display images text.
-        if (defaultDisplayWebpageImagesBoolean) {
-            displayImagesTextView.setText(displayImagesArrayAdapter.getItem(DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_ENABLED));
+        // Set the swipe to refresh text.
+        if (defaultSwipeToRefresh) {
+            swipeToRefreshTextView.setText(swipeToRefreshArrayAdapter.getItem(DomainsDatabaseHelper.SWIPE_TO_REFRESH_ENABLED));
         } else {
-            displayImagesTextView.setText(displayImagesArrayAdapter.getItem(DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_DISABLED));
+            swipeToRefreshTextView.setText(swipeToRefreshArrayAdapter.getItem(DomainsDatabaseHelper.SWIPE_TO_REFRESH_DISABLED));
         }
 
-        // Set the display website images icon and `TextView` settings.  Once minimum API >= 21 we can use a selector as the tint mode instead of specifying different icons.
-        switch (displayImagesInt) {
-            case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_SYSTEM_DEFAULT:
-                if (defaultDisplayWebpageImagesBoolean) {  // Display webpage images enabled by default.
+        // 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.
+        switch (swipeToRefreshInt) {
+            case DomainsDatabaseHelper.SWIPE_TO_REFRESH_SYSTEM_DEFAULT:
+                if (defaultSwipeToRefresh) {  // Swipe to refresh is enabled by default.
                     // Set the icon according to the theme.
                     if (MainWebViewActivity.darkTheme) {
-                        displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark));
+                        swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark));
                     } else {
-                        displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light));
+                        swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light));
                     }
-                } else {  // Display webpage images disabled by default.
+                } else {  // Swipe to refresh is disabled by default
                     // Set the icon according to the theme.
                     if (MainWebViewActivity.darkTheme) {
-                        displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark));
+                        swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark));
                     } else {
-                        displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light));
+                        swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light));
                     }
                 }
 
-                // Show `displayImagesTextView`.
-                displayImagesTextView.setVisibility(View.VISIBLE);
+                // Show the swipe to refresh TextView.
+                swipeToRefreshTextView.setVisibility(View.VISIBLE);
                 break;
 
-            case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_ENABLED:
+            case DomainsDatabaseHelper.SWIPE_TO_REFRESH_ENABLED:
                 // Set the icon according to the theme.
                 if (MainWebViewActivity.darkTheme) {
-                    displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark));
+                    swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark));
                 } else {
-                    displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light));
+                    swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light));
                 }
 
-                // Hide `displayImagesTextView`.
-                displayImagesTextView.setVisibility(View.GONE);
+                // Hide the swipe to refresh TextView.`
+                swipeToRefreshTextView.setVisibility(View.GONE);
                 break;
 
-            case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_DISABLED:
+            case DomainsDatabaseHelper.SWIPE_TO_REFRESH_DISABLED:
                 // Set the icon according to the theme.
                 if (MainWebViewActivity.darkTheme) {
-                    displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark));
+                    swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark));
                 } else {
-                    displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light));
+                    swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light));
                 }
 
-                // Hide `displayImagesTextView`.
-                displayImagesTextView.setVisibility(View.GONE);
-                break;
+                // Hide the swipe to refresh TextView.
+                swipeToRefreshTextView.setVisibility(View.GONE);
         }
 
-        // Open the display images spinner when the `TextView` is clicked.
-        displayImagesTextView.setOnClickListener((View v) -> {
-            // Open the user agent spinner.
-            displayWebpageImagesSpinner.performClick();
+        // Open the swipe to refresh spinner when the TextView is clicked.
+        swipeToRefreshTextView.setOnClickListener((View v) -> {
+            // Open the swipe to refresh spinner.
+            swipeToRefreshSpinner.performClick();
         });
 
         // Display the night mode in the spinner.
         nightModeSpinner.setSelection(nightModeInt);
 
         // Set the default night mode text.
-        if (defaultNightModeBoolean) {
+        if (defaultNightMode) {
             nightModeTextView.setText(nightModeArrayAdapter.getItem(DomainsDatabaseHelper.NIGHT_MODE_ENABLED));
         } else {
             nightModeTextView.setText(nightModeArrayAdapter.getItem(DomainsDatabaseHelper.NIGHT_MODE_DISABLED));
         }
 
-        // Set the night mode icon and `TextView` settings.  Once minimum API >= 21 we can use a selector as the tint mode instead of specifying different icons.
-        switch (displayImagesInt) {
+        // 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 (defaultNightModeBoolean) {  // Night mode enabled by 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));
@@ -632,7 +832,7 @@ public class DomainSettingsFragment extends Fragment {
                     }
                 }
 
-                // Show `nightModeTextView`.
+                // Show night mode TextView.
                 nightModeTextView.setVisibility(View.VISIBLE);
                 break;
 
@@ -644,7 +844,7 @@ public class DomainSettingsFragment extends Fragment {
                     nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_light));
                 }
 
-                // Hide `nightModeTextView`.
+                // Hide the night mode TextView.
                 nightModeTextView.setVisibility(View.GONE);
                 break;
 
@@ -656,19 +856,83 @@ public class DomainSettingsFragment extends Fragment {
                     nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_light));
                 }
 
-                // Hide `nightModeTextView`.
+                // Hide the night mode TextView.
                 nightModeTextView.setVisibility(View.GONE);
                 break;
         }
 
-        // Open the night mode spinner when the `TextView` is clicked.
+        // Open the night mode spinner when the TextView is clicked.
         nightModeTextView.setOnClickListener((View v) -> {
-            // Open the user agent spinner.
+            // Open the night mode spinner.
             nightModeSpinner.performClick();
         });
+
+        // Display the website images mode in the spinner.
+        displayWebpageImagesSpinner.setSelection(displayImagesInt);
+
+        // Set the default display images text.
+        if (defaultDisplayWebpageImages) {
+            displayImagesTextView.setText(displayImagesArrayAdapter.getItem(DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_ENABLED));
+        } else {
+            displayImagesTextView.setText(displayImagesArrayAdapter.getItem(DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_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.
+        switch (displayImagesInt) {
+            case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_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));
+                    }
+                } 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));
+                    }
+                }
+
+                // Show the display images TextView.
+                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));
+                }
+
+                // Hide the display images TextView.
+                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));
+                }
+
+                // Hide the display images TextView.
+                displayImagesTextView.setVisibility(View.GONE);
+                break;
+        }
+
+        // Open the display images spinner when the TextView is clicked.
+        displayImagesTextView.setOnClickListener((View v) -> {
+            // Open the user agent spinner.
+            displayWebpageImagesSpinner.performClick();
+        });
         
         // Set the pinned SSL certificate icon.
-        if (pinnedSslCertificateInt == 1) {  // Pinned SSL certificate is enabled.  Once minimum API >= 21 we can use a selector as the tint mode instead of specifying different icons.
+        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.
             // Check the switch.
             pinnedSslCertificateSwitch.setChecked(true);
 
@@ -753,8 +1017,10 @@ public class DomainSettingsFragment extends Fragment {
             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));
+            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);
@@ -845,7 +1111,7 @@ public class DomainSettingsFragment extends Fragment {
         }
 
 
-        // Set the `javaScriptEnabledSwitch` `OnCheckedChangeListener()`.
+        // Set the JavaScript switch listener.
         javaScriptEnabledSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
             if (isChecked) {  // JavaScript is enabled.
                 // Update the JavaScript icon.
@@ -881,13 +1147,13 @@ public class DomainSettingsFragment extends Fragment {
             }
         });
 
-        // Set the `firstPartyCookiesEnabledSwitch` `OnCheckedChangeListener()`.
+        // 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`.
+                // Enable the third-party cookies switch.
                 thirdPartyCookiesEnabledSwitch.setEnabled(true);
 
                 // Update the third-party cookies icon.
@@ -909,7 +1175,7 @@ public class DomainSettingsFragment extends Fragment {
                     firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light));
                 }
 
-                // Disable the third-party cookies `Switch`.
+                // Disable the third-party cookies switch.
                 thirdPartyCookiesEnabledSwitch.setEnabled(false);
 
                 // Set the third-party cookies icon according to the theme.
@@ -921,7 +1187,7 @@ public class DomainSettingsFragment extends Fragment {
             }
         });
 
-        // Set the `thirdPartyCookiesEnabledSwitch` `OnCheckedChangeListener()`.
+        // Set the third-party cookies switch listener.
         thirdPartyCookiesEnabledSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
             // Update the icon.
             if (isChecked) {
@@ -936,7 +1202,7 @@ public class DomainSettingsFragment extends Fragment {
             }
         });
 
-        // Set the `domStorageEnabledSwitch` `OnCheckedChangeListener()`.
+        // Set the DOM Storage switch listener.
         domStorageEnabledSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
             // Update the icon.
             if (isChecked) {
@@ -951,77 +1217,232 @@ public class DomainSettingsFragment extends Fragment {
             }
         });
 
-        // Set the `formDataEnabledSwitch` `OnCheckedChangeListener()`.
-        formDataEnabledSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
+        // 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) -> {
+                // Update the icon.
+                if (isChecked) {
+                    formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_enabled));
+                } 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 EasyList switch listener.
+        easyListSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
             // Update the icon.
-            if (isChecked) {
-                formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_enabled));
-            } else {
+            if (isChecked) {  // EasyList is on.
                 // Set the icon according to the theme.
                 if (MainWebViewActivity.darkTheme) {
-                    formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_dark));
+                    easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_dark));
                 } else {
-                    formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_light));
+                    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));
+                }
+            }
+        });
+
+        // Set the EasyPrivacy switch listener.
+        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 Fanboy's Annoyance List switch listener.
+        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));
+                }
+
+                // 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));
+                }
+            } 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));
+                }
+
+                // 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));
+                    }
+                }
+            }
+
+        });
+
+        // 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));
+                }
+            }
+        });
+
+        // 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));
+                }
+            }
+        });
+
+        // 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));
                 }
             }
         });
 
-        // Set the `userAgentSpinner` `onItemClickListener()`.
+        // Set the user agent spinner listener.
         userAgentSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
             @Override
             public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
-                // Store the new user agent string.
-                String newUserAgentString = resources.getStringArray(R.array.domain_settings_user_agent_entry_values)[position];
-
                 // Set the new user agent.
-                switch (newUserAgentString) {
-                    case "System default user agent":
-                        // Show `userAgentTextView`.
+                switch (position) {
+                    case MainWebViewActivity.DOMAINS_SYSTEM_DEFAULT_USER_AGENT:
+                        // Show the user agent TextView.
                         userAgentTextView.setVisibility(View.VISIBLE);
 
-                        // Hide `customUserAgentEditText`.
+                        // Hide the custom user agent EditText.
                         customUserAgentEditText.setVisibility(View.GONE);
 
                         // Set the user text.
-                        switch (defaultUserAgentString) {
-                            case "WebView default user agent":
+                        switch (defaultUserAgentArrayPosition) {
+                            case MainWebViewActivity.UNRECOGNIZED_USER_AGENT:  // The default user agent name is not on the canonical list.
+                                // This is probably because it was set in an older version of Privacy Browser before the switch to persistent user agent names.
+                                userAgentTextView.setText(defaultUserAgentName);
+                                break;
+
+                            case MainWebViewActivity.SETTINGS_WEBVIEW_DEFAULT_USER_AGENT:
                                 // Display the `WebView` default user agent.
                                 userAgentTextView.setText(webViewDefaultUserAgentString);
                                 break;
 
-                            case "Custom user agent":
+                            case MainWebViewActivity.SETTINGS_CUSTOM_USER_AGENT:
                                 // Display the custom user agent.
                                 userAgentTextView.setText(defaultCustomUserAgentString);
                                 break;
 
                             default:
-                                // Display the text from `defaultUserAgentString`.
-                                userAgentTextView.setText(defaultUserAgentString);
+                                // Get the user agent string from the user agent data array.
+                                userAgentTextView.setText(userAgentDataArray[defaultUserAgentArrayPosition]);
                         }
                         break;
 
-                    case "WebView default user agent":
-                        // Show `userAgentTextView` and set the text.
+                    case MainWebViewActivity.DOMAINS_WEBVIEW_DEFAULT_USER_AGENT:
+                        // Show the user agent TextView and set the text.
                         userAgentTextView.setVisibility(View.VISIBLE);
                         userAgentTextView.setText(webViewDefaultUserAgentString);
 
-                        // Hide `customUserAgentEditText`.
+                        // Hide the custom user agent EditTex.
                         customUserAgentEditText.setVisibility(View.GONE);
                         break;
 
-                    case "Custom user agent":
-                        // Hide `userAgentTextView`.
+                    case MainWebViewActivity.DOMAINS_CUSTOM_USER_AGENT:
+                        // Hide the user agent TextView.
                         userAgentTextView.setVisibility(View.GONE);
 
-                        // Show `customUserAgentEditText` and set `userAgentString` as the text.
+                        // Show the custom user agent EditText and set the current user agent name as the text.
                         customUserAgentEditText.setVisibility(View.VISIBLE);
-                        customUserAgentEditText.setText(currentUserAgentString);
+                        customUserAgentEditText.setText(currentUserAgentName);
                         break;
 
                     default:
-                        // Show `userAgentTextView` and set the text.
+                        // Show the user agent TextView and set the text from the user agent data array, which has one less entry than the spinner, so the position must be decremented.
                         userAgentTextView.setVisibility(View.VISIBLE);
-                        userAgentTextView.setText(newUserAgentString);
+                        userAgentTextView.setText(userAgentDataArray[position - 1]);
 
                         // Hide `customUserAgentEditText`.
                         customUserAgentEditText.setVisibility(View.GONE);
@@ -1034,7 +1455,7 @@ public class DomainSettingsFragment extends Fragment {
             }
         });
 
-        // Set the `fontSizeSpinner` `onItemSelectedListener()`.
+        // Set the font size spinner listener.
         fontSizeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
             @Override
             public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
@@ -1052,56 +1473,55 @@ public class DomainSettingsFragment extends Fragment {
             }
         });
 
-        // Set the `displayWebpageImagesSpinner` `onItemSelectedListener()`.
-        displayWebpageImagesSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+        // Set the swipe to refresh spinner listener.
+        swipeToRefreshSpinner.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 `nightModeTextView`.  Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
                 switch (position) {
-                    case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_SYSTEM_DEFAULT:
-                        if (defaultDisplayWebpageImagesBoolean) {
+                    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) {
-                                displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark));
+                                swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark));
                             } else {
-                                displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light));
+                                swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light));
                             }
-                        } else {
+                        } else {  // Swipe to refresh disabled by default.
                             // Set the icon according to the theme.
                             if (MainWebViewActivity.darkTheme) {
-                                displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark));
+                                swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark));
                             } else {
-                                displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light));
+                                swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light));
                             }
                         }
 
-                        // Show `displayImagesTextView`.
-                        displayImagesTextView.setVisibility(View.VISIBLE);
+                        // Show the swipe to refresh TextView.
+                        swipeToRefreshTextView.setVisibility(View.VISIBLE);
                         break;
 
-                    case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_ENABLED:
+                    case DomainsDatabaseHelper.SWIPE_TO_REFRESH_ENABLED:
                         // Set the icon according to the theme.
                         if (MainWebViewActivity.darkTheme) {
-                            displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark));
+                            swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark));
                         } else {
-                            displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light));
+                            swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light));
                         }
 
-                        // Hide `displayImagesTextView`.
-                        displayImagesTextView.setVisibility(View.GONE);
+                        // Hide the swipe to refresh TextView.
+                        swipeToRefreshTextView.setVisibility(View.GONE);
                         break;
 
-                    case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_DISABLED:
+                    case DomainsDatabaseHelper.SWIPE_TO_REFRESH_DISABLED:
                         // Set the icon according to the theme.
                         if (MainWebViewActivity.darkTheme) {
-                            displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark));
+                            swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark));
                         } else {
-                            displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light));
+                            swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light));
                         }
 
-                        // Hide `displayImagesTextView`.
-                        displayImagesTextView.setVisibility(View.GONE);
-                        break;
+                        // Hide the swipe to refresh TextView.
+                        swipeToRefreshTextView.setVisibility(View.GONE);
                 }
             }
 
@@ -1111,14 +1531,14 @@ public class DomainSettingsFragment extends Fragment {
             }
         });
 
-        // Set the `nightModeSpinner` `onItemSelectedListener()`.
+        // Set the night mode spinner listener.
         nightModeSpinner.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 minimum API >= 21 we can use a selector as the tint mode instead of specifying different icons.
+                // 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.
                 switch (position) {
                     case DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT:
-                        if (defaultNightModeBoolean) {  // Night mode enabled by 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));
@@ -1134,7 +1554,7 @@ public class DomainSettingsFragment extends Fragment {
                             }
                         }
 
-                        // Show `nightModeTextView`.
+                        // Show the night mode TextView.
                         nightModeTextView.setVisibility(View.VISIBLE);
                         break;
 
@@ -1164,7 +1584,7 @@ public class DomainSettingsFragment extends Fragment {
                 }
 
                 // Create a `boolean` to store the current night mode setting.
-                boolean currentNightModeEnabled = (position == DomainsDatabaseHelper.NIGHT_MODE_ENABLED) || ((position == DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT) && defaultNightModeBoolean);
+                boolean currentNightModeEnabled = (position == DomainsDatabaseHelper.NIGHT_MODE_ENABLED) || ((position == DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT) && defaultNightMode);
 
                 // Disable the JavaScript `Switch` if night mode is enabled.
                 if (currentNightModeEnabled) {
@@ -1185,7 +1605,7 @@ public class DomainSettingsFragment extends Fragment {
                     // Enable the DOM storage `Switch`.
                     domStorageEnabledSwitch.setEnabled(true);
 
-                    // Set the DOM storage status.  Once minimum API >= 21 we can use a selector as the tint mode instead of specifying different icons.
+                    // 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));
@@ -1225,8 +1645,67 @@ public class DomainSettingsFragment extends Fragment {
                 // Do nothing.
             }
         });
+
+        // Set the display webpage images spinner listener.
+        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`.
+                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));
+                            }
+                        }
+
+                        // Show `displayImagesTextView`.
+                        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));
+                        }
+
+                        // Hide `displayImagesTextView`.
+                        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));
+                        }
+
+                        // Hide `displayImagesTextView`.
+                        displayImagesTextView.setVisibility(View.GONE);
+                        break;
+                }
+            }
+
+            @Override
+            public void onNothingSelected(AdapterView<?> parent) {
+                // Do nothing.
+            }
+        });
         
-        // Set the `pinnedSSLCertificateSwitch` `onCheckedChangeListener()`.
+        // Set the pinned SSL certificate switch listener.
         pinnedSslCertificateSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
             // Update the icon
             if (isChecked) {  // Pinned SSL certificate is enabled.
@@ -1316,14 +1795,15 @@ public class DomainSettingsFragment extends Fragment {
         // Initialize `domainNamesMatch`.
         boolean domainNamesMatch = false;
 
-        // Check if the domains match.
-        if (domainName.equals(certificateCommonName)) {
-            domainNamesMatch = true;
-        }
-
-        // 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`.
+        // 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)) {
+                domainNamesMatch = true;
+            }
+
             // If `domainName` starts with a wildcard, check the base domain against all the subdomains of `certificateCommonName`.
             if (!domainNamesMatch && domainName.startsWith("*.") && (domainName.length() > 2)) {
                 // Remove the initial `*.`.