]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.kt
Highlight the background of non-default domain settings. https://redmine.stoutner...
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / fragments / DomainSettingsFragment.kt
index a7fa53ff8e47c452c2cceb0021437eb8a132c687..1576c185537ab7b6c8527b19f6609d48543e2c61 100644 (file)
@@ -45,6 +45,7 @@ import android.widget.TextView
 
 import androidx.appcompat.widget.SwitchCompat
 import androidx.cardview.widget.CardView
+import androidx.core.content.ContextCompat.getColor
 import androidx.core.content.res.ResourcesCompat
 import androidx.fragment.app.Fragment
 import androidx.preference.PreferenceManager
@@ -130,12 +131,15 @@ class DomainSettingsFragment : Fragment() {
         val ultraPrivacySwitch = domainSettingsView.findViewById<SwitchCompat>(R.id.ultraprivacy_switch)
         val blockAllThirdPartyRequestsImageView = domainSettingsView.findViewById<ImageView>(R.id.block_all_third_party_requests_imageview)
         val blockAllThirdPartyRequestsSwitch = domainSettingsView.findViewById<SwitchCompat>(R.id.block_all_third_party_requests_switch)
+        val userAgentLinearLayout = domainSettingsView.findViewById<LinearLayout>(R.id.user_agent_linearlayout)
         val userAgentSpinner = domainSettingsView.findViewById<Spinner>(R.id.user_agent_spinner)
         val userAgentTextView = domainSettingsView.findViewById<TextView>(R.id.user_agent_textview)
         val customUserAgentEditText = domainSettingsView.findViewById<EditText>(R.id.custom_user_agent_edittext)
+        val fontSizeLinearLayout = domainSettingsView.findViewById<LinearLayout>(R.id.font_size_linearlayout)
         val fontSizeSpinner = domainSettingsView.findViewById<Spinner>(R.id.font_size_spinner)
         val defaultFontSizeTextView = domainSettingsView.findViewById<TextView>(R.id.default_font_size_textview)
         val customFontSizeEditText = domainSettingsView.findViewById<EditText>(R.id.custom_font_size_edittext)
+        val swipeToRefreshLinearLayout = domainSettingsView.findViewById<LinearLayout>(R.id.swipe_to_refresh_linearlayout)
         val swipeToRefreshImageView = domainSettingsView.findViewById<ImageView>(R.id.swipe_to_refresh_imageview)
         val swipeToRefreshSpinner = domainSettingsView.findViewById<Spinner>(R.id.swipe_to_refresh_spinner)
         val swipeToRefreshTextView = domainSettingsView.findViewById<TextView>(R.id.swipe_to_refresh_textview)
@@ -143,12 +147,14 @@ class DomainSettingsFragment : Fragment() {
         val webViewThemeImageView = domainSettingsView.findViewById<ImageView>(R.id.webview_theme_imageview)
         val webViewThemeSpinner = domainSettingsView.findViewById<Spinner>(R.id.webview_theme_spinner)
         val webViewThemeTextView = domainSettingsView.findViewById<TextView>(R.id.webview_theme_textview)
+        val wideViewportLinearLayout = domainSettingsView.findViewById<LinearLayout>(R.id.wide_viewport_linearlayout)
         val wideViewportImageView = domainSettingsView.findViewById<ImageView>(R.id.wide_viewport_imageview)
         val wideViewportSpinner = domainSettingsView.findViewById<Spinner>(R.id.wide_viewport_spinner)
         val wideViewportTextView = domainSettingsView.findViewById<TextView>(R.id.wide_viewport_textview)
-        val displayWebpageImagesImageView = domainSettingsView.findViewById<ImageView>(R.id.display_webpage_images_imageview)
-        val displayWebpageImagesSpinner = domainSettingsView.findViewById<Spinner>(R.id.display_webpage_images_spinner)
-        val displayImagesTextView = domainSettingsView.findViewById<TextView>(R.id.display_webpage_images_textview)
+        val displayImagesLinearLayout = domainSettingsView.findViewById<LinearLayout>(R.id.display_images_linearlayout)
+        val displayImagesImageView = domainSettingsView.findViewById<ImageView>(R.id.display_images_imageview)
+        val displayImagesSpinner = domainSettingsView.findViewById<Spinner>(R.id.display_images_spinner)
+        val displayImagesTextView = domainSettingsView.findViewById<TextView>(R.id.display_images_textview)
         val pinnedSslCertificateImageView = domainSettingsView.findViewById<ImageView>(R.id.pinned_ssl_certificate_imageview)
         val pinnedSslCertificateSwitch = domainSettingsView.findViewById<SwitchCompat>(R.id.pinned_ssl_certificate_switch)
         val savedSslCardView = domainSettingsView.findViewById<CardView>(R.id.saved_ssl_certificate_cardview)
@@ -270,7 +276,7 @@ class DomainSettingsFragment : Fragment() {
         swipeToRefreshSpinner.adapter = swipeToRefreshArrayAdapter
         webViewThemeSpinner.adapter = webViewThemeArrayAdapter
         wideViewportSpinner.adapter = wideViewportArrayAdapter
-        displayWebpageImagesSpinner.adapter = displayImagesArrayAdapter
+        displayImagesSpinner.adapter = displayImagesArrayAdapter
 
         // Create a spannable string builder for each TextView that needs multiple colors of text.
         val savedSslIssuedToCNameStringBuilder = SpannableStringBuilder(cNameLabel + savedSslIssuedToCNameString)
@@ -350,33 +356,33 @@ class DomainSettingsFragment : Fragment() {
         })
 
         // Set the switch positions.
-        javaScriptSwitch.isChecked = javaScriptInt == 1
-        cookiesSwitch.isChecked = cookiesInt == 1
-        domStorageSwitch.isChecked = domStorageInt == 1
-        formDataSwitch.isChecked = formDataInt == 1 // Form data can be removed once the minimum API >= 26.
-        easyListSwitch.isChecked = easyListInt == 1
-        easyPrivacySwitch.isChecked = easyPrivacyInt == 1
-        fanboysAnnoyanceListSwitch.isChecked = fanboysAnnoyanceListInt == 1
-        fanboysSocialBlockingListSwitch.isChecked = fanboysSocialBlockingListInt == 1
-        ultraListSwitch.isChecked = ultraListInt == 1
-        ultraPrivacySwitch.isChecked = ultraPrivacyInt == 1
-        blockAllThirdPartyRequestsSwitch.isChecked = blockAllThirdPartyRequestsInt == 1
-        pinnedSslCertificateSwitch.isChecked = pinnedSslCertificateInt == 1
-        pinnedIpAddressesSwitch.isChecked = pinnedIpAddressesInt == 1
+        javaScriptSwitch.isChecked = (javaScriptInt == 1)
+        cookiesSwitch.isChecked = (cookiesInt == 1)
+        domStorageSwitch.isChecked = (domStorageInt == 1)
+        formDataSwitch.isChecked = (formDataInt == 1)  // Form data can be removed once the minimum API >= 26.
+        easyListSwitch.isChecked = (easyListInt == 1)
+        easyPrivacySwitch.isChecked = (easyPrivacyInt == 1)
+        fanboysAnnoyanceListSwitch.isChecked = (fanboysAnnoyanceListInt == 1)
+        fanboysSocialBlockingListSwitch.isChecked = (fanboysSocialBlockingListInt == 1)
+        ultraListSwitch.isChecked = (ultraListInt == 1)
+        ultraPrivacySwitch.isChecked = (ultraPrivacyInt == 1)
+        blockAllThirdPartyRequestsSwitch.isChecked = (blockAllThirdPartyRequestsInt == 1)
+        pinnedSslCertificateSwitch.isChecked = (pinnedSslCertificateInt == 1)
+        pinnedIpAddressesSwitch.isChecked = (pinnedIpAddressesInt == 1)
 
         // Set the switch icon colors.
-        cookiesImageView.isSelected = cookiesInt == 1
-        domStorageImageView.isSelected = domStorageInt == 1
-        formDataImageView.isSelected = formDataInt == 1 // Form data can be removed once the minimum API >= 26.
-        easyListImageView.isSelected = easyListInt == 1
-        easyPrivacyImageView.isSelected = easyPrivacyInt == 1
-        fanboysAnnoyanceListImageView.isSelected = fanboysAnnoyanceListInt == 1
-        fanboysSocialBlockingListImageView.isSelected = fanboysSocialBlockingListInt == 1
-        ultraListImageView.isSelected = ultraListInt == 1
-        ultraPrivacyImageView.isSelected = ultraPrivacyInt == 1
-        blockAllThirdPartyRequestsImageView.isSelected = blockAllThirdPartyRequestsInt == 1
-        pinnedSslCertificateImageView.isSelected = pinnedSslCertificateInt == 1
-        pinnedIpAddressesImageView.isSelected = pinnedIpAddressesInt == 1
+        cookiesImageView.isSelected = (cookiesInt == 1)
+        domStorageImageView.isSelected = (domStorageInt == 1)
+        formDataImageView.isSelected = (formDataInt == 1)  // Form data can be removed once the minimum API >= 26.
+        easyListImageView.isSelected = (easyListInt == 1)
+        easyPrivacyImageView.isSelected = (easyPrivacyInt == 1)
+        fanboysAnnoyanceListImageView.isSelected = (fanboysAnnoyanceListInt == 1)
+        fanboysSocialBlockingListImageView.isSelected = (fanboysSocialBlockingListInt == 1)
+        ultraListImageView.isSelected = (ultraListInt == 1)
+        ultraPrivacyImageView.isSelected = (ultraPrivacyInt == 1)
+        blockAllThirdPartyRequestsImageView.isSelected = (blockAllThirdPartyRequestsInt == 1)
+        pinnedSslCertificateImageView.isSelected = (pinnedSslCertificateInt == 1)
+        pinnedIpAddressesImageView.isSelected = (pinnedIpAddressesInt == 1)
 
         // Set the JavaScript icon.
         if (javaScriptInt == 1)
@@ -403,6 +409,14 @@ class DomainSettingsFragment : Fragment() {
         // Set the Social Blocking List icon ghosted status based on the Annoyance List status.
         fanboysSocialBlockingListImageView.isEnabled = (fanboysAnnoyanceListInt == 0)
 
+        // Open the spinners when the text view is clicked.
+        userAgentTextView.setOnClickListener { userAgentSpinner.performClick() }
+        defaultFontSizeTextView.setOnClickListener { fontSizeSpinner.performClick() }
+        swipeToRefreshTextView.setOnClickListener { swipeToRefreshSpinner.performClick() }
+        webViewThemeTextView.setOnClickListener { webViewThemeSpinner.performClick() }
+        wideViewportTextView.setOnClickListener { wideViewportSpinner.performClick() }
+        displayImagesTextView.setOnClickListener { displayImagesSpinner.performClick() }
+
         // 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") val bareWebViewLayout = inflater.inflate(R.layout.bare_webview, null, false)
@@ -435,6 +449,9 @@ class DomainSettingsFragment : Fragment() {
                 // Get the user agent string from the user agent data array.
                 else -> userAgentTextView.text = userAgentDataArray[defaultUserAgentArrayPosition]
             }
+
+            // Set the background color to be transparent.
+            userAgentLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.transparent))
         } else if (userAgentArrayPosition == UNRECOGNIZED_USER_AGENT || currentUserAgentName == getString(R.string.custom_user_agent)) {
             // A custom user agent is stored in the current user agent name.  The second check is necessary in case the user did not change the default custom text.
             // Set the user agent spinner to `Custom user agent`.
@@ -446,6 +463,9 @@ class DomainSettingsFragment : Fragment() {
             // Show the custom user agent edit text and set the current user agent name as the text.
             customUserAgentEditText.visibility = View.VISIBLE
             customUserAgentEditText.setText(currentUserAgentName)
+
+            // Set the background color to be blue.
+            userAgentLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
         } 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)
@@ -464,10 +484,11 @@ class DomainSettingsFragment : Fragment() {
                 // 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.text = userAgentDataArray[userAgentArrayPosition + 1]
             }
+
+            // Set the background color to be blue.
+            userAgentLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
         }
 
-        // Open the user agent spinner when the text view is clicked.
-        userAgentTextView.setOnClickListener { userAgentSpinner.performClick() }
 
         // Display the font size settings.
         if (fontSizeInt == 0) {  // `0` is the code for system default font size.
@@ -482,6 +503,9 @@ class DomainSettingsFragment : Fragment() {
 
             // 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)
+
+            // Set the background color to be transparent.
+            fontSizeLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.transparent))
         } else {  // A custom font size is selected.
             // Set the spinner to the custom font size.
             fontSizeSpinner.setSelection(1)
@@ -494,6 +518,9 @@ class DomainSettingsFragment : Fragment() {
 
             // Set the custom font size.
             customFontSizeEditText.setText(fontSizeInt.toString())
+
+            // Set the background color to be blue.
+            fontSizeLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
         }
 
         // Initialize the default font size percentage string.
@@ -502,9 +529,6 @@ class DomainSettingsFragment : Fragment() {
         // Set the default font size text in the text view.
         defaultFontSizeTextView.text = defaultFontSizePercentageString
 
-        // Open the font size spinner when the text view is clicked.
-        defaultFontSizeTextView.setOnClickListener { fontSizeSpinner.performClick() }
-
         // Select the swipe-to-refresh selection in the spinner.
         swipeToRefreshSpinner.setSelection(swipeToRefreshInt)
 
@@ -522,6 +546,9 @@ class DomainSettingsFragment : Fragment() {
 
                 // Show the swipe-to-refresh text view.
                 swipeToRefreshTextView.visibility = View.VISIBLE
+
+                // Set the background color to be transparent.
+                swipeToRefreshLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.transparent))
             }
 
             DomainsDatabaseHelper.ENABLED -> {
@@ -530,6 +557,9 @@ class DomainSettingsFragment : Fragment() {
 
                 // Hide the swipe-to-refresh text view.
                 swipeToRefreshTextView.visibility = View.GONE
+
+                // Set the background color to be blue.
+                swipeToRefreshLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
             }
 
             DomainsDatabaseHelper.DISABLED -> {
@@ -538,12 +568,12 @@ class DomainSettingsFragment : Fragment() {
 
                 // Hide the swipe-to-refresh text view.
                 swipeToRefreshTextView.visibility = View.GONE
+
+                // Set the background color to be blue.
+                swipeToRefreshLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
             }
         }
 
-        // Open the swipe-to-refresh spinner when the text view is clicked.
-        swipeToRefreshTextView.setOnClickListener { swipeToRefreshSpinner.performClick() }
-
         // Get the WebView theme string arrays.
         val webViewThemeStringArray = resources.getStringArray(R.array.webview_theme_array)
         val webViewThemeEntryValuesStringArray = resources.getStringArray(R.array.webview_theme_entry_values)
@@ -582,6 +612,9 @@ class DomainSettingsFragment : Fragment() {
 
                 // Show the WebView theme text view.
                 webViewThemeTextView.visibility = View.VISIBLE
+
+                // Set the background color to be transparent.
+                webViewThemeLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.transparent))
             }
 
             DomainsDatabaseHelper.LIGHT_THEME -> {
@@ -590,6 +623,9 @@ class DomainSettingsFragment : Fragment() {
 
                 // Hide the WebView theme text view.
                 webViewThemeTextView.visibility = View.GONE
+
+                // Set the background color to be blue.
+                webViewThemeLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
             }
 
             DomainsDatabaseHelper.DARK_THEME -> {
@@ -598,19 +634,20 @@ class DomainSettingsFragment : Fragment() {
 
                 // Hide the WebView theme text view.
                 webViewThemeTextView.visibility = View.GONE
+
+                // Set the background color to be blue.
+                webViewThemeLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
             }
         }
 
-        // Open the WebView theme spinner when the text view is clicked.
-        webViewThemeTextView.setOnClickListener { webViewThemeSpinner.performClick() }
-
         // Select the wide viewport in the spinner.
         wideViewportSpinner.setSelection(wideViewportInt)
 
         // Set the default wide viewport text.
         if (defaultWideViewport)
             wideViewportTextView.text = wideViewportArrayAdapter.getItem(DomainsDatabaseHelper.ENABLED)
-        else wideViewportTextView.text = wideViewportArrayAdapter.getItem(DomainsDatabaseHelper.DISABLED)
+        else
+            wideViewportTextView.text = wideViewportArrayAdapter.getItem(DomainsDatabaseHelper.DISABLED)
 
         // Set the wide viewport icon and text view settings.
         when (wideViewportInt) {
@@ -620,6 +657,9 @@ class DomainSettingsFragment : Fragment() {
 
                 // Show the wide viewport text view.
                 wideViewportTextView.visibility = View.VISIBLE
+
+                // Set the background color to be transparent.
+                wideViewportLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.transparent))
             }
 
             DomainsDatabaseHelper.ENABLED -> {
@@ -628,6 +668,9 @@ class DomainSettingsFragment : Fragment() {
 
                 // Hide the wide viewport text view.
                 wideViewportTextView.visibility = View.GONE
+
+                // Set the background color to be blue.
+                wideViewportLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
             }
 
             DomainsDatabaseHelper.DISABLED -> {
@@ -636,14 +679,14 @@ class DomainSettingsFragment : Fragment() {
 
                 // Hide the wide viewport text view.
                 wideViewportTextView.visibility = View.GONE
+
+                // Set the background color to be blue.
+                wideViewportLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
             }
         }
 
-        // Open the wide viewport spinner when the text view is clicked.
-        wideViewportTextView.setOnClickListener { wideViewportSpinner.performClick() }
-
         // Display the website images mode in the spinner.
-        displayWebpageImagesSpinner.setSelection(displayImagesInt)
+        displayImagesSpinner.setSelection(displayImagesInt)
 
         // Set the default display images text.
         if (defaultDisplayWebpageImages)
@@ -655,32 +698,38 @@ class DomainSettingsFragment : Fragment() {
         when (displayImagesInt) {
             DomainsDatabaseHelper.SYSTEM_DEFAULT -> {
                 // Set the icon color.
-                displayWebpageImagesImageView.isSelected = defaultDisplayWebpageImages
+                displayImagesImageView.isSelected = defaultDisplayWebpageImages
 
                 // Show the display images text view.
                 displayImagesTextView.visibility = View.VISIBLE
+
+                // Set the background color to be transparent.
+                displayImagesLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.transparent))
             }
 
             DomainsDatabaseHelper.ENABLED -> {
                 // Set the icon color.
-                displayWebpageImagesImageView.isSelected = true
+                displayImagesImageView.isSelected = true
 
                 // Hide the display images text view.
                 displayImagesTextView.visibility = View.GONE
+
+                // Set the background color to be blue.
+                displayImagesLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
             }
 
             DomainsDatabaseHelper.DISABLED -> {
                 // Set the icon color.
-                displayWebpageImagesImageView.isSelected = false
+                displayImagesImageView.isSelected = false
 
                 // Hide the display images text view.
                 displayImagesTextView.visibility = View.GONE
+
+                // Set the background color to be blue.
+               displayImagesLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
             }
         }
 
-        // Open the display images spinner when the text view is clicked.
-        displayImagesTextView.setOnClickListener { displayWebpageImagesSpinner.performClick() }
-
         // Store the current date.
         val currentDate = Calendar.getInstance().time
 
@@ -984,6 +1033,9 @@ class DomainSettingsFragment : Fragment() {
                             // Get the user agent string from the user agent data array.
                             else -> userAgentTextView.text = userAgentDataArray[defaultUserAgentArrayPosition]
                         }
+
+                        // Set the background color to be transparent.
+                        userAgentLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.transparent))
                     }
 
                     DOMAINS_WEBVIEW_DEFAULT_USER_AGENT -> {
@@ -995,6 +1047,9 @@ class DomainSettingsFragment : Fragment() {
 
                         // Hide the custom user agent EditTex.
                         customUserAgentEditText.visibility = View.GONE
+
+                        // Set the background color to be blue.
+                        userAgentLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
                     }
 
                     DOMAINS_CUSTOM_USER_AGENT -> {
@@ -1006,6 +1061,9 @@ class DomainSettingsFragment : Fragment() {
 
                         // Set the current user agent name as the text.
                         customUserAgentEditText.setText(currentUserAgentName)
+
+                        // Set the background color to be blue.
+                        userAgentLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
                     }
 
                     else -> {
@@ -1017,6 +1075,9 @@ class DomainSettingsFragment : Fragment() {
 
                         // Hide the custom user agent edit text.
                         customUserAgentEditText.visibility = View.GONE
+
+                        // Set the background color to be blue.
+                        userAgentLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
                     }
                 }
             }
@@ -1036,12 +1097,18 @@ class DomainSettingsFragment : Fragment() {
 
                     // Hide the custom font size edit text.
                     customFontSizeEditText.visibility = View.GONE
+
+                    // Set the background color to be transparent.
+                    fontSizeLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.transparent))
                 } else {  // A custom font size has been selected.
                     // Hide the default font size text view.
                     defaultFontSizeTextView.visibility = View.GONE
 
                     // Show the custom font size edit text.
                     customFontSizeEditText.visibility = View.VISIBLE
+
+                    // Set the background color to be blue.
+                    fontSizeLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
                 }
             }
 
@@ -1061,6 +1128,9 @@ class DomainSettingsFragment : Fragment() {
 
                         // Show the swipe-to-refresh text view.
                         swipeToRefreshTextView.visibility = View.VISIBLE
+
+                        // Set the background color to be transparent.
+                        swipeToRefreshLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.transparent))
                     }
 
                     DomainsDatabaseHelper.ENABLED -> {
@@ -1069,6 +1139,9 @@ class DomainSettingsFragment : Fragment() {
 
                         // Hide the swipe-to-refresh text view.
                         swipeToRefreshTextView.visibility = View.GONE
+
+                        // Set the background color to be blue.
+                        swipeToRefreshLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
                     }
 
                     DomainsDatabaseHelper.DISABLED -> {
@@ -1077,6 +1150,9 @@ class DomainSettingsFragment : Fragment() {
 
                         // Hide the swipe-to-refresh text view.
                         swipeToRefreshTextView.visibility = View.GONE
+
+                        // Set the background color to be blue.
+                        swipeToRefreshLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
                     }
                 }
             }
@@ -1101,6 +1177,9 @@ class DomainSettingsFragment : Fragment() {
 
                         // Show the WebView theme text view.
                         webViewThemeTextView.visibility = View.VISIBLE
+
+                        // Set the background color to be transparent.
+                        webViewThemeLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.transparent))
                     }
 
                     DomainsDatabaseHelper.LIGHT_THEME -> {
@@ -1109,6 +1188,9 @@ class DomainSettingsFragment : Fragment() {
 
                         // Hide the WebView theme text view.
                         webViewThemeTextView.visibility = View.GONE
+
+                        // Set the background color to be blue.
+                        webViewThemeLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
                     }
 
                     DomainsDatabaseHelper.DARK_THEME -> {
@@ -1117,6 +1199,9 @@ class DomainSettingsFragment : Fragment() {
 
                         // Hide the WebView theme text view.
                         webViewThemeTextView.visibility = View.GONE
+
+                        // Set the background color to be blue.
+                        webViewThemeLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
                     }
                 }
             }
@@ -1137,6 +1222,9 @@ class DomainSettingsFragment : Fragment() {
 
                         // Show the wide viewport text view.
                         wideViewportTextView.visibility = View.VISIBLE
+
+                        // Set the background color to be transparent.
+                        wideViewportLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.transparent))
                     }
 
                     DomainsDatabaseHelper.ENABLED -> {
@@ -1145,6 +1233,9 @@ class DomainSettingsFragment : Fragment() {
 
                         // Hide the wide viewport text view.
                         wideViewportTextView.visibility = View.GONE
+
+                        // Set the background color to be blue.
+                        wideViewportLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
                     }
 
                     DomainsDatabaseHelper.DISABLED -> {
@@ -1153,6 +1244,9 @@ class DomainSettingsFragment : Fragment() {
 
                         // Hid ethe wide viewport text view.
                         wideViewportTextView.visibility = View.GONE
+
+                        // Set the background color to be blue.
+                        wideViewportLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
                     }
                 }
             }
@@ -1163,32 +1257,41 @@ class DomainSettingsFragment : Fragment() {
         }
 
         // Set the display webpage images spinner listener.
-        displayWebpageImagesSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
+        displayImagesSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
             override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
                 // Update the icon and the visibility of the display images text view.
                 when (position) {
                     DomainsDatabaseHelper.SYSTEM_DEFAULT -> {
                         // Set the icon color.
-                        displayWebpageImagesImageView.isSelected = defaultDisplayWebpageImages
+                        displayImagesImageView.isSelected = defaultDisplayWebpageImages
 
                         // Show the display images text view.
                         displayImagesTextView.visibility = View.VISIBLE
+
+                        // Set the background color to be transparent.
+                        displayImagesLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.transparent))
                     }
 
                     DomainsDatabaseHelper.ENABLED -> {
                         // Set the icon color.
-                        displayWebpageImagesImageView.isSelected = true
+                        displayImagesImageView.isSelected = true
 
                         // Hide the display images text view.
                         displayImagesTextView.visibility = View.GONE
+
+                        // Set the background color to be blue.
+                        displayImagesLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
                     }
 
                     DomainsDatabaseHelper.DISABLED -> {
                         // Set the icon color.
-                        displayWebpageImagesImageView.isSelected = false
+                        displayImagesImageView.isSelected = false
 
                         // Hide the display images text view.
                         displayImagesTextView.visibility = View.GONE
+
+                        // Set the background color to be blue.
+                        displayImagesLinearLayout.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
                     }
                 }
             }