1
0
Fork 0

Closes #804: Adds disable private browsing content description (#851)

master
Sawyer Blatz 2019-03-08 08:37:35 -08:00 committed by GitHub
parent 44336c429c
commit d6ebd88186
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -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

View File

@ -10,6 +10,8 @@
<string name="content_description_menu">More options</string>
<!-- Content description (not visible, for screen readers etc.): "Private Browsing" menu button. -->
<string name="content_description_private_browsing_button">Enable private browsing</string>
<!-- Content description (not visible, for screen readers etc.): "Private Browsing" menu button. -->
<string name="content_description_disable_private_browsing_button">Disable private browsing</string>
<!-- Explanation for how sessions work -->
<string name="sessions_intro_description">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. </string>
<!-- Placeholder text shown in the search bar before a user enters text -->