diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index 9f279e78e..7aca17bf2 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -85,6 +85,7 @@ class HomeFragment : Fragment() { return view } + @SuppressWarnings("LongMethod") override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -160,7 +161,10 @@ class HomeFragment : Fragment() { override fun onTransitionCompleted(p0: MotionLayout?, p1: Int) { } }) - view.toolbar_wrapper.isPrivateModeEnabled = (activity as HomeActivity).browsingModeManager.isPrivate + val isPrivate = (activity as HomeActivity).browsingModeManager.isPrivate + + view.toolbar_wrapper.isPrivateModeEnabled = isPrivate + privateBrowsingButton.contentDescription = contentDescriptionForPrivateBrowsingButton(isPrivate) privateBrowsingButton.setOnClickListener { val browsingModeManager = (activity as HomeActivity).browsingModeManager @@ -253,6 +257,14 @@ class HomeFragment : Fragment() { } } + private fun contentDescriptionForPrivateBrowsingButton(isPrivate: Boolean): String { + val resourceId = + if (isPrivate) R.string.content_description_disable_private_browsing_button else + R.string.content_description_private_browsing_button + + return getString(resourceId) + } + private fun setupPrivateBrowsingDescription() { // Format the description text to include a hyperlink val descriptionText = String diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 227ed9624..50703e516 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -10,6 +10,8 @@ More options Enable private browsing + + Disable private browsing Sessions help you return to the sites you visit often and those you\'ve just discovered. Start browsing and they\'ll begin to appear here.