Update learn more string of FooterPrefernce
Replace FooterPreference#SetLearnMoreContentDescription() with FooterPreference#SetLearnMoreText(). This is a requirement: All links, controls, and buttons should also have comprehensible text or tooltip text, so users can identify its purpose, independent of context, such as when using the URL list from TalkBack’s local context menu. Bug: 215045903 Test: manual & robotest Change-Id: Ib657ba336c5688c1434a58611dea3891001afe14
This commit is contained in:
@@ -33,7 +33,7 @@ public class AccessibilityButtonFooterPreferenceController extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getLearnMoreContentDescription() {
|
protected String getLearnMoreText() {
|
||||||
return mContext.getString(
|
return mContext.getString(
|
||||||
R.string.accessibility_button_gesture_footer_learn_more_content_description);
|
R.string.accessibility_button_gesture_footer_learn_more_content_description);
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ public class AccessibilityControlTimeoutFooterPreferenceController extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getLearnMoreContentDescription() {
|
protected String getLearnMoreText() {
|
||||||
return mContext.getString(
|
return mContext.getString(
|
||||||
R.string.accessibility_control_timeout_footer_learn_more_content_description);
|
R.string.accessibility_control_timeout_footer_learn_more_content_description);
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ import com.android.settingslib.HelpUtils;
|
|||||||
public class AccessibilityFooterPreferenceController extends BasePreferenceController {
|
public class AccessibilityFooterPreferenceController extends BasePreferenceController {
|
||||||
|
|
||||||
private int mHelpResource;
|
private int mHelpResource;
|
||||||
private String mLearnMoreContentDescription;
|
private String mLearnMoreText;
|
||||||
private String mIntroductionTitle;
|
private String mIntroductionTitle;
|
||||||
|
|
||||||
public AccessibilityFooterPreferenceController(Context context, String key) {
|
public AccessibilityFooterPreferenceController(Context context, String key) {
|
||||||
@@ -56,9 +56,9 @@ public class AccessibilityFooterPreferenceController extends BasePreferenceContr
|
|||||||
* Setups a help item in the {@link AccessibilityFooterPreference} with specific content
|
* Setups a help item in the {@link AccessibilityFooterPreference} with specific content
|
||||||
* description.
|
* description.
|
||||||
*/
|
*/
|
||||||
public void setupHelpLink(int helpResource, String learnMoreContentDescription) {
|
public void setupHelpLink(int helpResource, String learnMoreText) {
|
||||||
mHelpResource = helpResource;
|
mHelpResource = helpResource;
|
||||||
mLearnMoreContentDescription = learnMoreContentDescription;
|
mLearnMoreText = learnMoreText;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,12 +73,12 @@ public class AccessibilityFooterPreferenceController extends BasePreferenceContr
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides this if showing a help item in the {@link AccessibilityFooterPreference} with
|
* Overrides this if showing a help item in the {@link AccessibilityFooterPreference} with
|
||||||
* specific content description.
|
* specific learn more title.
|
||||||
*
|
*
|
||||||
* @return the content description for the help url
|
* @return learn more title for the help url
|
||||||
*/
|
*/
|
||||||
protected String getLearnMoreContentDescription() {
|
protected String getLearnMoreText() {
|
||||||
return mLearnMoreContentDescription;
|
return mLearnMoreText;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,7 +117,7 @@ public class AccessibilityFooterPreferenceController extends BasePreferenceContr
|
|||||||
footerPreference.setLearnMoreAction(view -> {
|
footerPreference.setLearnMoreAction(view -> {
|
||||||
view.startActivityForResult(helpIntent, 0);
|
view.startActivityForResult(helpIntent, 0);
|
||||||
});
|
});
|
||||||
footerPreference.setLearnMoreContentDescription(getLearnMoreContentDescription());
|
footerPreference.setLearnMoreText(getLearnMoreText());
|
||||||
footerPreference.setLinkEnabled(true);
|
footerPreference.setLinkEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
footerPreference.setLinkEnabled(false);
|
footerPreference.setLinkEnabled(false);
|
||||||
|
@@ -30,7 +30,7 @@ public class CaptionFooterPreferenceController extends AccessibilityFooterPrefer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getLearnMoreContentDescription() {
|
protected String getLearnMoreText() {
|
||||||
return mContext.getString(
|
return mContext.getString(
|
||||||
R.string.accessibility_captioning_footer_learn_more_content_description);
|
R.string.accessibility_captioning_footer_learn_more_content_description);
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ public class ToggleAutoclickFooterPreferenceController extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getLearnMoreContentDescription() {
|
protected String getLearnMoreText() {
|
||||||
return mContext.getString(
|
return mContext.getString(
|
||||||
R.string.accessibility_autoclick_footer_learn_more_content_description);
|
R.string.accessibility_autoclick_footer_learn_more_content_description);
|
||||||
}
|
}
|
||||||
|
@@ -114,10 +114,10 @@ public class ToggleColorInversionPreferenceFragment extends ToggleFeaturePrefere
|
|||||||
private void updateFooterPreference() {
|
private void updateFooterPreference() {
|
||||||
final String title = getPrefContext().getString(
|
final String title = getPrefContext().getString(
|
||||||
R.string.accessibility_color_inversion_about_title);
|
R.string.accessibility_color_inversion_about_title);
|
||||||
final String learnMoreContentDescription = getPrefContext().getString(
|
final String learnMoreText = getPrefContext().getString(
|
||||||
R.string.accessibility_color_inversion_footer_learn_more_content_description);
|
R.string.accessibility_color_inversion_footer_learn_more_content_description);
|
||||||
mFooterPreferenceController.setIntroductionTitle(title);
|
mFooterPreferenceController.setIntroductionTitle(title);
|
||||||
mFooterPreferenceController.setupHelpLink(getHelpResource(), learnMoreContentDescription);
|
mFooterPreferenceController.setupHelpLink(getHelpResource(), learnMoreText);
|
||||||
mFooterPreferenceController.displayPreference(getPreferenceScreen());
|
mFooterPreferenceController.displayPreference(getPreferenceScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -106,10 +106,10 @@ public final class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePrefe
|
|||||||
private void updateFooterPreference() {
|
private void updateFooterPreference() {
|
||||||
final String title = getPrefContext()
|
final String title = getPrefContext()
|
||||||
.getString(R.string.accessibility_daltonizer_about_title);
|
.getString(R.string.accessibility_daltonizer_about_title);
|
||||||
final String learnMoreContentDescription = getPrefContext()
|
final String learnMoreText = getPrefContext()
|
||||||
.getString(R.string.accessibility_daltonizer_footer_learn_more_content_description);
|
.getString(R.string.accessibility_daltonizer_footer_learn_more_content_description);
|
||||||
mFooterPreferenceController.setIntroductionTitle(title);
|
mFooterPreferenceController.setIntroductionTitle(title);
|
||||||
mFooterPreferenceController.setupHelpLink(getHelpResource(), learnMoreContentDescription);
|
mFooterPreferenceController.setupHelpLink(getHelpResource(), learnMoreText);
|
||||||
mFooterPreferenceController.displayPreference(getPreferenceScreen());
|
mFooterPreferenceController.displayPreference(getPreferenceScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -109,10 +109,10 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
private void updateFooterPreference() {
|
private void updateFooterPreference() {
|
||||||
final String title = getPrefContext().getString(
|
final String title = getPrefContext().getString(
|
||||||
R.string.accessibility_screen_magnification_about_title);
|
R.string.accessibility_screen_magnification_about_title);
|
||||||
final String learnMoreContentDescription = getPrefContext().getString(
|
final String learnMoreText = getPrefContext().getString(
|
||||||
R.string.accessibility_screen_magnification_footer_learn_more_content_description);
|
R.string.accessibility_screen_magnification_footer_learn_more_content_description);
|
||||||
mFooterPreferenceController.setIntroductionTitle(title);
|
mFooterPreferenceController.setIntroductionTitle(title);
|
||||||
mFooterPreferenceController.setupHelpLink(getHelpResource(), learnMoreContentDescription);
|
mFooterPreferenceController.setupHelpLink(getHelpResource(), learnMoreText);
|
||||||
mFooterPreferenceController.displayPreference(getPreferenceScreen());
|
mFooterPreferenceController.displayPreference(getPreferenceScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -68,9 +68,9 @@ public class EnterpriseDisclosurePreferenceController extends BasePreferenceCont
|
|||||||
footerPreference.setLearnMoreAction(view -> {
|
footerPreference.setLearnMoreAction(view -> {
|
||||||
mContext.startActivity(new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS));
|
mContext.startActivity(new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS));
|
||||||
});
|
});
|
||||||
final String learnMoreContentDescription = mContext.getString(
|
final String learnMoreText = mContext.getString(
|
||||||
R.string.footer_learn_more_content_description, getLabelName());
|
R.string.footer_learn_more_content_description, getLabelName());
|
||||||
footerPreference.setLearnMoreContentDescription(learnMoreContentDescription);
|
footerPreference.setLearnMoreText(learnMoreText);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLabelName() {
|
private String getLabelName() {
|
||||||
|
@@ -367,9 +367,9 @@ public class AppLaunchSettings extends AppInfoBase implements
|
|||||||
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(LEARN_MORE_URI));
|
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(LEARN_MORE_URI));
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
});
|
});
|
||||||
final String learnMoreContentDescription = mContext.getString(
|
final String learnMoreText = mContext.getString(
|
||||||
R.string.footer_learn_more_content_description, getLabelName());
|
R.string.footer_learn_more_content_description, getLabelName());
|
||||||
footerPreference.setLearnMoreContentDescription(learnMoreContentDescription);
|
footerPreference.setLearnMoreText(learnMoreText);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLabelName() {
|
private String getLabelName() {
|
||||||
|
@@ -134,7 +134,7 @@ public class SmartAutoRotatePreferenceFragment extends DashboardFragment {
|
|||||||
getString(getHelpResource()),
|
getString(getHelpResource()),
|
||||||
/*backupContext=*/ ""), /*requestCode=*/ 0);
|
/*backupContext=*/ ""), /*requestCode=*/ 0);
|
||||||
});
|
});
|
||||||
pref.setLearnMoreContentDescription(getString(R.string.auto_rotate_link_a11y));
|
pref.setLearnMoreText(getString(R.string.auto_rotate_link_a11y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,8 +19,8 @@ package com.android.settings.fuelgauge;
|
|||||||
import android.annotation.UserIdInt;
|
import android.annotation.UserIdInt;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.settings.SettingsEnums;
|
|
||||||
import android.app.backup.BackupManager;
|
import android.app.backup.BackupManager;
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@@ -386,7 +386,7 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
|
|||||||
if (helpIntent != null) {
|
if (helpIntent != null) {
|
||||||
mFooterPreference.setLearnMoreAction(v ->
|
mFooterPreference.setLearnMoreAction(v ->
|
||||||
startActivityForResult(helpIntent, /*requestCode=*/ 0));
|
startActivityForResult(helpIntent, /*requestCode=*/ 0));
|
||||||
mFooterPreference.setLearnMoreContentDescription(
|
mFooterPreference.setLearnMoreText(
|
||||||
context.getString(R.string.manager_battery_usage_link_a11y));
|
context.getString(R.string.manager_battery_usage_link_a11y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -90,7 +90,7 @@ public class BatterySaverSettings extends DashboardFragment {
|
|||||||
getString(R.string.help_url_battery_saver_settings),
|
getString(R.string.help_url_battery_saver_settings),
|
||||||
/*backupContext=*/ ""), /*requestCode=*/ 0);
|
/*backupContext=*/ ""), /*requestCode=*/ 0);
|
||||||
});
|
});
|
||||||
pref.setLearnMoreContentDescription(getString(R.string.battery_saver_link_a11y));
|
pref.setLearnMoreText(getString(R.string.battery_saver_link_a11y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -107,7 +107,7 @@ public class LocationSettingsFooterPreferenceController extends LocationBasePref
|
|||||||
if (mFooterPreference != null) {
|
if (mFooterPreference != null) {
|
||||||
mFooterPreference.setTitle(Html.fromHtml(footerString));
|
mFooterPreference.setTitle(Html.fromHtml(footerString));
|
||||||
mFooterPreference.setLearnMoreAction(v -> openLocationLearnMoreLink());
|
mFooterPreference.setLearnMoreAction(v -> openLocationLearnMoreLink());
|
||||||
mFooterPreference.setLearnMoreContentDescription(mContext.getString(
|
mFooterPreference.setLearnMoreText(mContext.getString(
|
||||||
R.string.location_settings_footer_learn_more_content_description));
|
R.string.location_settings_footer_learn_more_content_description));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -100,11 +100,11 @@ public class AccessibilityFooterPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setupHelpLink_setCorrectHelpLinkAndContentDescription() {
|
public void setupHelpLink_setCorrectHelpLinkAndLearnMoreText() {
|
||||||
mController.setupHelpLink(TEST_HELP_ID, TEST_CONTENT_DESCRIPTION);
|
mController.setupHelpLink(TEST_HELP_ID, TEST_CONTENT_DESCRIPTION);
|
||||||
|
|
||||||
assertThat(mController.getHelpResource()).isEqualTo(TEST_HELP_ID);
|
assertThat(mController.getHelpResource()).isEqualTo(TEST_HELP_ID);
|
||||||
assertThat(mController.getLearnMoreContentDescription())
|
assertThat(mController.getLearnMoreText())
|
||||||
.isEqualTo(TEST_CONTENT_DESCRIPTION);
|
.isEqualTo(TEST_CONTENT_DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user