2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

Closes #135: Adds accessibility support to Browser UI

This commit is contained in:
Sawyer Blatz 2019-01-28 10:14:51 -08:00 committed by Colin Lee
parent 63973c4086
commit edcdd05c68
4 changed files with 20 additions and 6 deletions

View File

@ -3,11 +3,13 @@
file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.browser
import android.content.Context
import android.os.Bundle
import android.transition.TransitionInflater
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.accessibility.AccessibilityManager
import androidx.fragment.app.Fragment
import kotlinx.android.synthetic.main.fragment_browser.*
import mozilla.components.feature.session.SessionFeature
@ -16,6 +18,7 @@ import mozilla.components.support.ktx.android.arch.lifecycle.addObservers
import org.mozilla.fenix.R
import org.mozilla.fenix.components.toolbar.ToolbarIntegration
import org.mozilla.fenix.ext.requireComponents
import androidx.coordinatorlayout.widget.CoordinatorLayout
class BrowserFragment : Fragment() {
@ -54,5 +57,12 @@ class BrowserFragment : Fragment() {
)
lifecycle.addObservers(sessionFeature)
// Stop toolbar from collapsing if TalkBack is enabled
val accessibilityManager = context?.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
if (accessibilityManager.isEnabled) {
val layoutParams = toolbar.layoutParams as CoordinatorLayout.LayoutParams
layoutParams.behavior = null
}
}
}

View File

@ -40,7 +40,7 @@ class Toolbar(
val back = BrowserMenuItemToolbar.Button(
mozilla.components.ui.icons.R.drawable.mozac_ic_back,
iconTintColorResource = R.color.icons,
contentDescription = "Back"
contentDescription = context.getString(R.string.browser_menu_back)
) {
sessionUseCases.goBack.invoke()
}
@ -48,7 +48,7 @@ class Toolbar(
val forward = BrowserMenuItemToolbar.Button(
mozilla.components.ui.icons.R.drawable.mozac_ic_forward,
iconTintColorResource = R.color.icons,
contentDescription = "Forward"
contentDescription = context.getString(R.string.browser_menu_forward)
) {
sessionUseCases.goForward.invoke()
}
@ -56,7 +56,7 @@ class Toolbar(
val refresh = BrowserMenuItemToolbar.Button(
mozilla.components.ui.icons.R.drawable.mozac_ic_refresh,
iconTintColorResource = R.color.icons,
contentDescription = "Refresh"
contentDescription = context.getString(R.string.browser_menu_refresh)
) {
sessionUseCases.reload.invoke()
}

View File

@ -32,8 +32,7 @@ class ToolbarIntegration(
context.resources.getDrawable(
R.drawable.ic_home,
context.application.theme
),
"Home"
), context.getString(R.string.browser_home_button)
) {
Navigation.findNavController(toolbar).navigate(R.id.action_browserFragment_to_homeFragment)
}

View File

@ -4,9 +4,14 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources>
<string name="app_name">Fenix</string>
<string name="search_hint">Search the Web or enter address</string>
<string name="menu_share_with">Share with…</string>
<string name="browser_home_button">Home</string>
<!-- Browser Menu -->
<string name="browser_menu_back">Back</string>
<string name="browser_menu_forward">Forward</string>
<string name="browser_menu_refresh">Refresh</string>
<string name="browser_menu_help">Help</string>
<string name="browser_menu_settings">Settings</string>
<string name="browser_menu_library">Your Library</string>