diff --git a/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/DeepLinkTest.kt b/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/DeepLinkTest.kt index f68f077a24a8..7a5b955f1432 100644 --- a/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/DeepLinkTest.kt +++ b/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/DeepLinkTest.kt @@ -123,7 +123,7 @@ class DeepLinkTest { @Test fun openSettingsTrackingProtection() { robot.openSettingsTrackingProtection { - verifyEnhancedTrackingProtectionHeader() + verifyEnhancedTrackingProtectionSummary() } } diff --git a/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/EnhancedTrackingProtectionTest.kt b/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/EnhancedTrackingProtectionTest.kt index 5282fa3a15f2..fc16704d2a3e 100644 --- a/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/EnhancedTrackingProtectionTest.kt +++ b/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/EnhancedTrackingProtectionTest.kt @@ -33,7 +33,6 @@ import org.mozilla.fenix.ui.robots.navigationToolbar * Including * - Verifying default states * - Verifying Enhanced Tracking Protection notification bubble - * - Verifying Enhanced Tracking Protection notification shield * - Verifying Enhanced Tracking Protection content sheet * - Verifying Enhanced Tracking Protection content sheet details * - Verifying Enhanced Tracking Protection toggle @@ -72,8 +71,7 @@ class EnhancedTrackingProtectionTest { verifyEnhancedTrackingProtectionButton() verifySettingsOptionSummary("Enhanced Tracking Protection", "Standard") }.openEnhancedTrackingProtectionSubMenu { - verifyEnhancedTrackingProtectionHeader() - verifyEnhancedTrackingProtectionHeaderDescription() + verifyEnhancedTrackingProtectionSummary() verifyLearnMoreText() verifyEnhancedTrackingProtectionTextWithSwitchWidget() verifyTrackingProtectionSwitchEnabled() diff --git a/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuEnhancedTrackingProtectionRobot.kt b/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuEnhancedTrackingProtectionRobot.kt index 571f0dbcd255..87cecddced23 100644 --- a/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuEnhancedTrackingProtectionRobot.kt +++ b/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuEnhancedTrackingProtectionRobot.kt @@ -40,9 +40,7 @@ class SettingsSubMenuEnhancedTrackingProtectionRobot { fun verifyNavigationToolBarHeader() = assertNavigationToolBarHeader() - fun verifyEnhancedTrackingProtectionHeader() = assertEnhancedTrackingProtectionHeader() - - fun verifyEnhancedTrackingProtectionHeaderDescription() = assertEnhancedTrackingProtectionHeaderDescription() + fun verifyEnhancedTrackingProtectionSummary() = assertEnhancedTrackingProtectionSummary() fun verifyLearnMoreText() = assertLearnMoreText() @@ -61,17 +59,22 @@ class SettingsSubMenuEnhancedTrackingProtectionRobot { fun verifyTrackingProtectionSwitchEnabled() = assertTrackingProtectionSwitchEnabled() - fun switchEnhancedTrackingProtectionToggle() = onView(withResourceName("switch_widget")).click() + fun switchEnhancedTrackingProtectionToggle() = onView( + allOf( + withText("Enhanced Tracking Protection"), + hasSibling(withResourceName("checkbox")), + ), + ).click() fun verifyStandardOptionDescription() { - onView(withText(R.string.preference_enhanced_tracking_protection_standard_description_4)) + onView(withText(R.string.preference_enhanced_tracking_protection_standard_description_5)) .check(matches(isDisplayed())) onView(withContentDescription(R.string.preference_enhanced_tracking_protection_standard_info_button)) .check(matches(isDisplayed())) } fun verifyStrictOptionDescription() { - onView(withText(org.mozilla.fenix.R.string.preference_enhanced_tracking_protection_strict_description_3)) + onView(withText(R.string.preference_enhanced_tracking_protection_strict_description_4)) .check(matches(isDisplayed())) onView(withContentDescription(R.string.preference_enhanced_tracking_protection_strict_info_button)) .check(matches(isDisplayed())) @@ -79,7 +82,7 @@ class SettingsSubMenuEnhancedTrackingProtectionRobot { fun verifyCustomTrackingProtectionSettings() { scrollToElementByText("Redirect Trackers") - onView(withText(org.mozilla.fenix.R.string.preference_enhanced_tracking_protection_custom_description_2)) + onView(withText(R.string.preference_enhanced_tracking_protection_custom_description_2)) .check(matches(isDisplayed())) onView(withContentDescription(R.string.preference_enhanced_tracking_protection_custom_info_button)) .check(matches(isDisplayed())) @@ -171,22 +174,15 @@ class SettingsSubMenuEnhancedTrackingProtectionRobot { private fun assertNavigationToolBarHeader() { onView( allOf( - withParent(withId(org.mozilla.fenix.R.id.navigationToolbar)), + withParent(withId(R.id.navigationToolbar)), withText("Enhanced Tracking Protection"), ), ) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } -private fun assertEnhancedTrackingProtectionHeader() { - onView(withText("Browse without being followed")) - .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) -} - -private fun assertEnhancedTrackingProtectionHeaderDescription() { - onView( - withText("Keep your data to yourself. $appName protects you from many of the most common trackers that follow what you do online."), - ) +private fun assertEnhancedTrackingProtectionSummary() { + onView(withText("$appName protects you from many of the most common trackers that follow what you do online.")) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -206,7 +202,7 @@ private fun assertEnhancedTrackingProtectionTextWithSwitchWidget() { } private fun assertTrackingProtectionSwitchEnabled() { - onView(withResourceName("switch_widget")).check( + onView(withResourceName("checkbox")).check( matches( isChecked( true, diff --git a/fenix/app/src/main/java/org/mozilla/fenix/settings/FenixSwitchPreference.kt b/fenix/app/src/main/java/org/mozilla/fenix/settings/FenixSwitchPreference.kt new file mode 100644 index 000000000000..63eac764400a --- /dev/null +++ b/fenix/app/src/main/java/org/mozilla/fenix/settings/FenixSwitchPreference.kt @@ -0,0 +1,26 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.mozilla.fenix.settings + +import android.content.Context +import android.util.AttributeSet +import androidx.preference.CheckBoxPreference +import androidx.preference.SwitchPreference +import org.mozilla.fenix.R + +/** + * Switch Preference that adheres to Fenix styling. + * + * **Note:** The [SwitchPreference] layout internal id "switch_widget" has a min API of 24, so we use + * [CheckBoxPreference] instead and use the layout internal id "checkbox". + */ +class FenixSwitchPreference @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, +) : CheckBoxPreference(context, attrs) { + init { + layoutResource = R.layout.preference_widget_switch_fenix_style + } +} diff --git a/fenix/app/src/main/java/org/mozilla/fenix/settings/TrackingProtectionFragment.kt b/fenix/app/src/main/java/org/mozilla/fenix/settings/TrackingProtectionFragment.kt index 4912ed47fcd7..660e82db2bb0 100644 --- a/fenix/app/src/main/java/org/mozilla/fenix/settings/TrackingProtectionFragment.kt +++ b/fenix/app/src/main/java/org/mozilla/fenix/settings/TrackingProtectionFragment.kt @@ -11,7 +11,6 @@ import androidx.preference.CheckBoxPreference import androidx.preference.DropDownPreference import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat -import androidx.preference.SwitchPreference import org.mozilla.fenix.BrowserDirection import org.mozilla.fenix.GleanMetrics.TrackingProtection import org.mozilla.fenix.HomeActivity @@ -72,7 +71,7 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() { // Tracking Protection Switch val preferenceTP = - requirePreference(R.string.pref_key_tracking_protection) + requirePreference(R.string.pref_key_tracking_protection) preferenceTP.isChecked = requireContext().settings().shouldUseTrackingProtection preferenceTP.setOnPreferenceChangeListener { preference, trackingProtectionOn -> @@ -97,7 +96,7 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() { true } learnMorePreference.summary = getString( - R.string.preference_enhanced_tracking_protection_explanation, + R.string.preference_enhanced_tracking_protection_explanation_2, getString(R.string.app_name), ) diff --git a/fenix/app/src/main/res/drawable/ic_etp_artwork.xml b/fenix/app/src/main/res/drawable/ic_etp_artwork.xml index 2c68b24a5a18..b5e04b181689 100644 --- a/fenix/app/src/main/res/drawable/ic_etp_artwork.xml +++ b/fenix/app/src/main/res/drawable/ic_etp_artwork.xml @@ -1,164 +1,181 @@ - - + xmlns:tools="http://schemas.android.com/tools" + android:width="360dp" + android:height="160dp" + android:viewportWidth="360" + android:viewportHeight="160" + tools:ignore="VectorRaster"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:color="#FF0850BE" + android:offset="0.14" /> + android:color="#FF1851C6" + android:offset="0.32" /> + android:color="#FF3353D2" + android:offset="0.52" /> + android:color="#FF5955E4" + android:offset="0.74" /> + android:color="#FF8859FB" + android:offset="0.97" /> + android:offset="1" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - diff --git a/fenix/app/src/main/res/layout/preference_divider.xml b/fenix/app/src/main/res/layout/preference_divider.xml new file mode 100644 index 000000000000..e455842acc81 --- /dev/null +++ b/fenix/app/src/main/res/layout/preference_divider.xml @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/fenix/app/src/main/res/layout/preference_no_widget.xml b/fenix/app/src/main/res/layout/preference_no_widget.xml new file mode 100644 index 000000000000..27f8377c3d05 --- /dev/null +++ b/fenix/app/src/main/res/layout/preference_no_widget.xml @@ -0,0 +1,32 @@ + + + + + + + + diff --git a/fenix/app/src/main/res/layout/preference_widget_radiobutton_with_info.xml b/fenix/app/src/main/res/layout/preference_widget_radiobutton_with_info.xml index ddc0aff0a09e..b51a21c8109c 100644 --- a/fenix/app/src/main/res/layout/preference_widget_radiobutton_with_info.xml +++ b/fenix/app/src/main/res/layout/preference_widget_radiobutton_with_info.xml @@ -1,5 +1,4 @@ - - + android:paddingTop="6dp" + android:paddingBottom="6dp"> + app:layout_constraintBottom_toBottomOf="@id/vertical_divider" + app:layout_constraintEnd_toEndOf="@id/title" + app:layout_constraintStart_toStartOf="@id/title" + app:layout_constraintTop_toBottomOf="@id/title" + tools:text="@tools:sample/full_names" /> diff --git a/fenix/app/src/main/res/layout/preference_widget_switch_fenix_style.xml b/fenix/app/src/main/res/layout/preference_widget_switch_fenix_style.xml new file mode 100644 index 000000000000..f22d8bc65637 --- /dev/null +++ b/fenix/app/src/main/res/layout/preference_widget_switch_fenix_style.xml @@ -0,0 +1,53 @@ + + + + + + + + + + diff --git a/fenix/app/src/main/res/layout/tracking_protection_learn_more_preference.xml b/fenix/app/src/main/res/layout/tracking_protection_learn_more_preference.xml index 6f96cf973463..0339bc9f4ef3 100644 --- a/fenix/app/src/main/res/layout/tracking_protection_learn_more_preference.xml +++ b/fenix/app/src/main/res/layout/tracking_protection_learn_more_preference.xml @@ -19,74 +19,51 @@ app:layout_constraintTop_toTopOf="parent" app:srcCompat="@drawable/ic_etp_artwork" /> - - + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - - + app:layout_constraintStart_toStartOf="@android:id/summary" + app:layout_constraintTop_toBottomOf="@android:id/summary" /> + app:layout_constraintGuide_percent="0.55" /> diff --git a/fenix/app/src/main/res/values/strings.xml b/fenix/app/src/main/res/values/strings.xml index 5e7b1351e37a..544b708975aa 100644 --- a/fenix/app/src/main/res/values/strings.xml +++ b/fenix/app/src/main/res/values/strings.xml @@ -1445,29 +1445,29 @@ Enhanced Tracking Protection - Browse without being followed + Browse without being followed - Now featuring Total Cookie Protection, our most powerful barrier yet against cross-site trackers. + Now featuring Total Cookie Protection, our most powerful barrier yet against cross-site trackers. - Keep your data to yourself. %s protects you from many of the most common trackers that follow what you do online. + Keep your data to yourself. %s protects you from many of the most common trackers that follow what you do online. - %s protects you from many of the most common trackers that follow what you do online. + %s protects you from many of the most common trackers that follow what you do online. Learn more Standard (default) - Balanced for privacy and performance. Pages load normally. + Balanced for privacy and performance. Pages load normally. - Pages will load normally, but block fewer trackers. + Pages will load normally, but block fewer trackers. What’s blocked by standard tracking protection Strict - Blocks more trackers so pages load faster, but some on-page functionality may break. + Blocks more trackers so pages load faster, but some on-page functionality may break. - Stronger tracking protection and faster performance, but some sites may not work properly. + Stronger tracking protection and faster performance, but some sites may not work properly. What’s blocked by strict tracking protection @@ -1552,6 +1552,9 @@ Some trackers marked below have been partially unblocked on this page because you interacted with them *. Learn more + + Enhanced tracking protection exception preference icon Support diff --git a/fenix/app/src/main/res/xml/tracking_protection_preferences.xml b/fenix/app/src/main/res/xml/tracking_protection_preferences.xml index d6d93669859e..186fc8893f97 100644 --- a/fenix/app/src/main/res/xml/tracking_protection_preferences.xml +++ b/fenix/app/src/main/res/xml/tracking_protection_preferences.xml @@ -1,4 +1,5 @@ - - + android:summary="@string/preference_enhanced_tracking_protection_summary" + android:title="@string/preference_enhanced_tracking_protection" + app:iconSpaceReserved="false" /> - + + android:layout="@layout/preference_no_widget" + android:title="@string/preferences_tracking_protection_exceptions" />