1
0
Fork 0

Add ETP accessibility labels

master
matthewcmckenna 2019-11-01 00:51:30 -04:00 committed by Emily Kager
parent 0a86676563
commit afac413c98
3 changed files with 10 additions and 0 deletions

View File

@ -19,6 +19,7 @@ class RadioButtonInfoPreference @JvmOverloads constructor(
) : RadioButtonPreference(context, attrs) {
private var infoClickListener: (() -> Unit)? = null
private var infoView: ImageView? = null
var contentDescription: String? = null
fun onInfoClickListener(listener: (() -> Unit)) {
infoClickListener = listener
@ -65,6 +66,7 @@ class RadioButtonInfoPreference @JvmOverloads constructor(
infoClickListener?.invoke()
}
infoView?.alpha = if (isEnabled) FULL_ALPHA else HALF_ALPHA
contentDescription?.let { infoView?.contentDescription = it }
}
companion object {

View File

@ -89,6 +89,8 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
private fun bindStrict() {
val keyStrict = getString(R.string.pref_key_tracking_protection_strict_default)
radioStrict = requireNotNull(findPreference(keyStrict))
radioStrict.contentDescription =
getString(R.string.preference_enhanced_tracking_protection_strict_info_button)
radioStrict.onPreferenceChangeListener = object : SharedPreferenceUpdater() {
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
if (newValue == true) {
@ -114,6 +116,8 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
private fun bindStandard() {
val keyStandard = getString(R.string.pref_key_tracking_protection_standard_option)
radioStandard = requireNotNull(findPreference(keyStandard))
radioStandard.contentDescription =
getString(R.string.preference_enhanced_tracking_protection_standard_info_button)
radioStandard.onPreferenceChangeListener = object : SharedPreferenceUpdater() {
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
if (newValue == true) {

View File

@ -870,6 +870,8 @@
<string name="preference_enhanced_tracking_protection_standard_description">Balanced for protection and performance.</string>
<!-- Preference description for enhanced tracking protection for the standard protection settings -->
<string name="preference_enhanced_tracking_protection_standard_description_2">Pages will load normally, but block fewer trackers.</string>
<!-- Accessibility text for the Standard protection information icon -->
<string name="preference_enhanced_tracking_protection_standard_info_button">What\'s blocked by standard tracking protection</string>
<!-- Preference for enhanced tracking protection for the strict protection settings -->
<string name="preference_enhanced_tracking_protection_strict">Strict</string>
<!-- Preference for enhanced tracking protection for the strict protection settings, default setting -->
@ -880,6 +882,8 @@
<string name="preference_enhanced_tracking_protection_strict_recommended">Strict (recommended)</string>
<!-- Preference description for enhanced tracking protection for the strict protection settings -->
<string name="preference_enhanced_tracking_protection_strict_description">Stronger protection, but may cause some sites or content to break.</string>
<!-- Accessibility text for the Strict protection information icon -->
<string name="preference_enhanced_tracking_protection_strict_info_button">What\'s blocked by strict tracking protection</string>
<!-- Header for categories that are being blocked by current Enhanced Tracking Protection settings -->
<string name="enhanced_tracking_protection_blocked">Blocked</string>
<!-- Header for categories that are being not being blocked by current Enhanced Tracking Protection settings -->