From: Soren Stoutner Date: Wed, 19 Apr 2023 20:17:11 +0000 (-0700) Subject: Update the proxy app bar background color. https://redmine.stoutner.com/issues/998 X-Git-Tag: v3.14~4 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=0019f066a3b42f018e8042089b81f0f89e43e91e;p=PrivacyBrowserAndroid.git Update the proxy app bar background color. https://redmine.stoutner.com/issues/998 --- diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt index 2d0fc04a..e13e8567 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt @@ -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. diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.kt b/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.kt index d00bcb0c..dea186fc 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.kt @@ -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. diff --git a/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.kt b/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.kt index 30f8f6dd..965158d7 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.kt @@ -70,7 +70,7 @@ class RequestsArrayAdapter(context: Context, resourceRequestsList: List { diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.kt b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.kt index b7e514ed..94ee8202 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.kt @@ -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 -> { diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.kt b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.kt index a7fa53ff..23fce5d8 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.kt @@ -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(R.id.ultraprivacy_switch) val blockAllThirdPartyRequestsImageView = domainSettingsView.findViewById(R.id.block_all_third_party_requests_imageview) val blockAllThirdPartyRequestsSwitch = domainSettingsView.findViewById(R.id.block_all_third_party_requests_switch) + val userAgentLinearLayout = domainSettingsView.findViewById(R.id.user_agent_linear_layout) val userAgentSpinner = domainSettingsView.findViewById(R.id.user_agent_spinner) val userAgentTextView = domainSettingsView.findViewById(R.id.user_agent_textview) val customUserAgentEditText = domainSettingsView.findViewById(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)) } } } diff --git a/app/src/main/res/layout/domain_settings_fragment.xml b/app/src/main/res/layout/domain_settings_fragment.xml index c91d9254..1e19683d 100644 --- a/app/src/main/res/layout/domain_settings_fragment.xml +++ b/app/src/main/res/layout/domain_settings_fragment.xml @@ -1,7 +1,7 @@ Almacenamiento DOM habilitado Almacenamiento DOM deshabilitado Datos de formulario habilitados - Datos de fromulario deshabilitados + Datos de formulario deshabilitados Cookies borradas Almacenamiento DOM borrado Datos de formulario borrado @@ -50,7 +50,7 @@ Nueva pestaña Cargando… Error:\u0020 %1$s - Apply + Aplicar Cargando EasyList @@ -429,7 +429,7 @@ %1$s (variante de Google Play) OpenKeychain: \u0020 Uso de memoria - Memoria conumida de la app: \u0020 + Memoria consumida de la app: \u0020 Memoria disponible de la app: \u0020 Memoria total de la app: \u0020 Memoria máxima de la app: \u0020 diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index b674c4da..a09f99ee 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -371,8 +371,8 @@ Esporta Importa Decripta - Privacy Browser Android %1$s Settings - Schema %2$d.pbs - Privacy Browser Android %1$s Settings - Schema %2$d.pbs.aes + Privacy Browser Android %1$s Impostazioni - Schema %2$d.pbs + Privacy Browser Android %1$s Impostazioni - Schema %2$d.pbs.aes Esportazione riuscita Esportazione fallita:\u0020 %1$s Importazione fallita:\u0020 %1$s diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index c3795a5c..fee950be 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -21,7 +21,7 @@ @color/violet_700 - @color/blue_700_50 + @color/violet_a900 @color/violet_700 @color/violet_500 @color/violet_500 @@ -34,10 +34,10 @@ @color/gray_700 @color/white @color/gray_300 - @color/dark_blue_30 @color/red_700_40 @color/red_night @color/red_night + @color/violet_a900 @color/gray_700 @color/black_translucent_33 @color/yellow_700_50 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 82780f5c..807bca3a 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -21,7 +21,7 @@ @color/blue_700 - @color/blue_100 + @color/blue_50 @color/blue_600 @color/blue_800 @color/blue_700 @@ -34,10 +34,10 @@ @color/gray_425 @color/gray_925 @color/gray_700 - @color/blue_50 @color/red_100 @color/red_900 @color/red_a700 + @color/blue_100 @color/gray_300 @color/black_translucent_11 @color/yellow_100 @@ -69,6 +69,9 @@ #FFBAD3FB #FF8AB4F8 #FF5785C5 + #FF3E6EAC + #FF245692 + #FFB0C8F2 #FF586479 #FF607D8B