Merge "[Material Next] Support "Learn more" for help link" into sc-dev

This commit is contained in:
Menghan Li
2021-05-12 08:44:30 +00:00
committed by Android (Google) Code Review
9 changed files with 88 additions and 3 deletions

View File

@@ -303,6 +303,11 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
return SettingsEnums.ACCESSIBILITY_SERVICE;
}
@Override
public int getHelpResource() {
return 0;
}
@Override
public void onDestroyView() {
super.onDestroyView();
@@ -508,7 +513,13 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
new AccessibilityFooterPreference(screen.getContext());
htmlFooterPreference.setKey(KEY_HTML_DESCRIPTION_PREFERENCE);
htmlFooterPreference.setSummary(htmlDescription);
htmlFooterPreference.setLinkEnabled(false);
// Only framework tools support help link
if (getHelpResource() != 0) {
htmlFooterPreference.appendHelpLink(getHelpResource());
htmlFooterPreference.setLinkEnabled(true);
} else {
htmlFooterPreference.setLinkEnabled(false);
}
htmlFooterPreference.setIconContentDescription(iconContentDescription);
screen.addPreference(htmlFooterPreference);
}
@@ -542,6 +553,10 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
new AccessibilityFooterPreference(screen.getContext());
footerPreference.setSummary(summary);
footerPreference.setIconContentDescription(iconContentDescription);
if (getHelpResource() != 0) {
footerPreference.appendHelpLink(getHelpResource());
footerPreference.setLinkEnabled(true);
}
screen.addPreference(footerPreference);
}