]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Update the proxy app bar background color. https://redmine.stoutner.com/issues/998
authorSoren Stoutner <soren@stoutner.com>
Wed, 19 Apr 2023 20:17:11 +0000 (13:17 -0700)
committerSoren Stoutner <soren@stoutner.com>
Wed, 19 Apr 2023 20:17:11 +0000 (13:17 -0700)
app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt
app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.kt
app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.kt
app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.kt
app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.kt
app/src/main/res/layout/domain_settings_fragment.xml
app/src/main/res/values-es/strings.xml
app/src/main/res/values-it/strings.xml
app/src/main/res/values-night/colors.xml
app/src/main/res/values/colors.xml

index 2d0fc04aa28d5e99130212cbafbfb1948f9eb647..e13e8567c5c7475805f66e9eec3260b2c8b38abf 100644 (file)
@@ -3269,7 +3269,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook
 
             ProxyHelper.TOR -> {
                 // Set the app bar background to indicate proxying is enabled.
-                appBarLayout.setBackgroundResource(R.color.proxy_appbar_background)
+                appBarLayout.setBackgroundResource(R.color.blue_background)
 
                 // Check to see if Orbot is installed.
                 try {
@@ -3320,7 +3320,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook
 
             ProxyHelper.I2P -> {
                 // Set the app bar background to indicate proxying is enabled.
-                appBarLayout.setBackgroundResource(R.color.proxy_appbar_background)
+                appBarLayout.setBackgroundResource(R.color.blue_background)
 
                 // Check to see if I2P is installed.
                 try {
@@ -3355,7 +3355,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook
 
             ProxyHelper.CUSTOM ->
                 // Set the app bar background to indicate proxying is enabled.
-                appBarLayout.setBackgroundResource(R.color.proxy_appbar_background)
+                appBarLayout.setBackgroundResource(R.color.blue_background)
         }
 
         // Reload the WebViews if requested and not waiting for the proxy.
index d00bcb0c272a834f5b2ba19e502d6fd8d3fece7f..dea186fc7a878582113584931e10d733f2e01b33 100644 (file)
@@ -177,7 +177,7 @@ class RequestsActivity : AppCompatActivity(), ViewRequestListener {
 
         // Handle clicks on the spinner dropdown.
         appBarSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
-            override fun onItemSelected(parent: AdapterView<*>?, view: View, position: Int, id: Long) {
+            override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
                 when (id.toInt()) {
                     0 -> {
                         // Get an adapter for all the requests.
index 30f8f6dd59d2861aec8052ef5f965e6ef192539e..965158d7d4dab41d09fc3d5d502981f6ef7abaa6 100644 (file)
@@ -70,7 +70,7 @@ class RequestsArrayAdapter(context: Context, resourceRequestsList: List<Array<St
                 dispositionTextView.text = context.resources.getString(R.string.request_allowed, id)
 
                 // Set the background color.
-                linearLayout.setBackgroundColor(context.getColor(R.color.blue_background))
+                linearLayout.setBackgroundColor(context.getColor(R.color.requests_blue_background))
             }
 
             REQUEST_THIRD_PARTY -> {
index b7e514edb3abf1fbdbfba98e7889e1e406407825..94ee820224eafa761a4c1ac40bf99d8b4ecaf189 100644 (file)
@@ -199,7 +199,7 @@ class ViewRequestDialog : DialogFragment() {
                 requestDisposition.setText(R.string.allowed)
 
                 // Set the background color to be blue.
-                requestDisposition.setBackgroundColor(getColor(requireContext(), R.color.blue_background))
+                requestDisposition.setBackgroundColor(getColor(requireContext(), R.color.requests_blue_background))
             }
 
             REQUEST_THIRD_PARTY -> {
index a7fa53ff8e47c452c2cceb0021437eb8a132c687..23fce5d8b358c717cd8571f0ae5bb15334fef8c1 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,6 +131,7 @@ 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_linear_layout)
         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)
@@ -350,33 +352,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 +405,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 { displayWebpageImagesSpinner.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 +445,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 +459,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 +480,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.
@@ -502,9 +519,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)
 
@@ -541,9 +555,6 @@ class DomainSettingsFragment : Fragment() {
             }
         }
 
-        // 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)
@@ -601,9 +612,6 @@ class DomainSettingsFragment : Fragment() {
             }
         }
 
-        // 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)
 
@@ -639,9 +647,6 @@ class DomainSettingsFragment : Fragment() {
             }
         }
 
-        // 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)
 
@@ -678,9 +683,6 @@ class DomainSettingsFragment : Fragment() {
             }
         }
 
-        // 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 +986,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 +1000,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 +1014,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 +1028,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))
                     }
                 }
             }
index c91d9254d323e9a15b15cb70d60a5c373e14b339..1e19683d484ba389c6f6412d1daa343cfbf47f02 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
-  Copyright 2017-2022 Soren Stoutner <soren@stoutner.com>.
+  Copyright 2017-2023 Soren Stoutner <soren@stoutner.com>.
 
   This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
 
 
         <!-- User Agent. -->
         <LinearLayout
+            android:id="@+id/user_agent_linear_layout"
             android:layout_height="wrap_content"
             android:layout_width="match_parent"
             android:orientation="vertical"
index f9cdf8efa60d8f7c877583b5978791028b4fe557..b53b510a70a816e9a7b5c3c2ac4f659bd80c992d 100644 (file)
@@ -37,7 +37,7 @@
     <string name="dom_storage_enabled">Almacenamiento DOM habilitado</string>
     <string name="dom_storage_disabled">Almacenamiento DOM deshabilitado</string>
     <string name="form_data_enabled">Datos de formulario habilitados</string>
-    <string name="form_data_disabled">Datos de fromulario deshabilitados</string>
+    <string name="form_data_disabled">Datos de formulario deshabilitados</string>
     <string name="cookies_deleted">Cookies borradas</string>
     <string name="dom_storage_deleted">Almacenamiento DOM borrado</string>
     <string name="form_data_deleted">Datos de formulario borrado</string>
@@ -50,7 +50,7 @@
     <string name="new_tab">Nueva pestaña</string>
     <string name="loading">Cargando…</string>
     <string name="error">Error:\u0020 %1$s</string>
-    <string name="apply">Apply</string>
+    <string name="apply">Aplicar</string>
 
     <!-- Loading Blocklists. -->
     <string name="loading_easylist">Cargando EasyList</string>
                 <string name="google_play_flavor">%1$s (variante de Google Play)</string>
             <string name="openkeychain">OpenKeychain: \u0020</string>
         <string name="memory_usage">Uso de memoria</string>
-            <string name="app_consumed_memory">Memoria conumida de la app: \u0020</string>
+            <string name="app_consumed_memory">Memoria consumida de la app: \u0020</string>
             <string name="app_available_memory">Memoria disponible de la app: \u0020</string>
             <string name="app_total_memory">Memoria total de la app: \u0020</string>
             <string name="app_maximum_memory">Memoria máxima de la app: \u0020</string>
index b674c4da7ba883493f4a0b2392ccc27006dd864f..a09f99ee00a9d5aaa084a92d76a3123cee728a90 100644 (file)
     <string name="export">Esporta</string>
     <string name="import_button">Importa</string>  <!-- `import` is a reserved word and cannot be used as the name. -->
     <string name="decrypt">Decripta</string>
-    <string name="privacy_browser_settings_pbs">Privacy Browser Android %1$s Settings - Schema %2$d.pbs</string>
-    <string name="privacy_browser_settings_pbs_aes">Privacy Browser Android %1$s Settings - Schema %2$d.pbs.aes</string>
+    <string name="privacy_browser_settings_pbs">Privacy Browser Android %1$s Impostazioni - Schema %2$d.pbs</string>
+    <string name="privacy_browser_settings_pbs_aes">Privacy Browser Android %1$s Impostazioni - Schema %2$d.pbs.aes</string>
     <string name="export_successful">Esportazione riuscita</string>
     <string name="export_failed">Esportazione fallita:\u0020 %1$s</string>
     <string name="import_failed">Importazione fallita:\u0020 %1$s</string>
index c3795a5ca8265d2409326e00f82ea23339674b43..fee950be89861886a991d96928140b203065de9c 100644 (file)
@@ -21,7 +21,7 @@
 <resources>
     <!-- Nicknamed colors. -->
     <color name="alt_blue_text">@color/violet_700</color>
-    <color name="blue_background">@color/blue_700_50</color>
+    <color name="blue_background">@color/violet_a900</color>
     <color name="blue_button">@color/violet_700</color>
     <color name="blue_icon">@color/violet_500</color>
     <color name="blue_text">@color/violet_500</color>
     <color name="ghosted_icon">@color/gray_700</color>
     <color name="icon">@color/white</color>
     <color name="parent_folder_text">@color/gray_300</color>
-    <color name="proxy_appbar_background">@color/dark_blue_30</color>
     <color name="red_background">@color/red_700_40</color>
     <color name="red_icon">@color/red_night</color>
     <color name="red_text">@color/red_night</color>
+    <color name="requests_blue_background">@color/violet_a900</color>
     <color name="selected_icon_background">@color/gray_700</color>
     <color name="translucent_background">@color/black_translucent_33</color>
     <color name="yellow_background">@color/yellow_700_50</color>
index 82780f5c13af475d367204926bda8b9f75b1a65b..807bca3a182c49d703904e48ed1c371936dbc5f1 100644 (file)
@@ -21,7 +21,7 @@
 <resources>
     <!-- Nicknamed colors. -->
     <color name="alt_blue_text">@color/blue_700</color>
-    <color name="blue_background">@color/blue_100</color>
+    <color name="blue_background">@color/blue_50</color>
     <color name="blue_button">@color/blue_600</color>
     <color name="blue_icon">@color/blue_800</color>
     <color name="blue_text">@color/blue_700</color>
     <color name="ghosted_icon">@color/gray_425</color>
     <color name="icon">@color/gray_925</color>
     <color name="parent_folder_text">@color/gray_700</color>
-    <color name="proxy_appbar_background">@color/blue_50</color>
     <color name="red_background">@color/red_100</color>
     <color name="red_icon">@color/red_900</color>
     <color name="red_text">@color/red_a700</color>
+    <color name="requests_blue_background">@color/blue_100</color>
     <color name="selected_icon_background">@color/gray_300</color>
     <color name="translucent_background">@color/black_translucent_11</color>
     <color name="yellow_background">@color/yellow_100</color>
@@ -69,6 +69,9 @@
     <color name="violet_300">#FFBAD3FB</color>
     <color name="violet_500">#FF8AB4F8</color>
     <color name="violet_700">#FF5785C5</color>
+    <color name="violet_800">#FF3E6EAC</color>
+    <color name="violet_900">#FF245692</color>
+    <color name="violet_a400">#FFB0C8F2</color>
     <color name="violet_a900">#FF586479</color>
 
     <color name="blue_gray_500">#FF607D8B</color>