Loading src/com/android/settings/accessibility/AccessibilityFooterPreferenceController.java +9 −3 Original line number Diff line number Diff line Loading @@ -104,11 +104,17 @@ public class AccessibilityFooterPreferenceController extends BasePreferenceContr sb.append(getIntroductionTitle()).append("\n\n").append(footerPreference.getTitle()); footerPreference.setContentDescription(sb); final Intent helpIntent; if (getHelpResource() != 0) { footerPreference.setLearnMoreAction(view -> { final Intent helpIntent = HelpUtils.getHelpIntent( mContext, mContext.getString(getHelpResource()), // Returns may be null if content is wrong or empty. helpIntent = HelpUtils.getHelpIntent(mContext, mContext.getString(getHelpResource()), mContext.getClass().getName()); } else { helpIntent = null; } if (helpIntent != null) { footerPreference.setLearnMoreAction(view -> { view.startActivityForResult(helpIntent, 0); }); footerPreference.setLearnMoreContentDescription(getLearnMoreContentDescription()); Loading tests/robotests/src/com/android/settings/accessibility/AccessibilityFooterPreferenceControllerTest.java +5 −5 Original line number Diff line number Diff line Loading @@ -109,16 +109,16 @@ public class AccessibilityFooterPreferenceControllerTest { } @Test public void onBindViewHolder_setupHelpLink_setCorrectHelpLinkAndContentDescription() { mController.setupHelpLink(TEST_HELP_ID, TEST_CONTENT_DESCRIPTION); public void onBindViewHolder_setHelpResource_emptyString_notVisible() { mController.setupHelpLink(R.string.help_url_timeout, TEST_CONTENT_DESCRIPTION); mController.displayPreference(mScreen); mPreference.onBindViewHolder(mPreferenceViewHolder); final TextView learnMoreView = (TextView) mPreferenceViewHolder .findViewById(com.android.settingslib.R.id.settingslib_learn_more); assertThat(learnMoreView.getContentDescription().toString()) .contains(TEST_CONTENT_DESCRIPTION); assertThat(mPreference.isLinkEnabled()).isTrue(); assertThat(learnMoreView.getContentDescription()).isNull(); assertThat(learnMoreView.getVisibility()).isEqualTo(View.GONE); assertThat(mPreference.isLinkEnabled()).isFalse(); } } Loading
src/com/android/settings/accessibility/AccessibilityFooterPreferenceController.java +9 −3 Original line number Diff line number Diff line Loading @@ -104,11 +104,17 @@ public class AccessibilityFooterPreferenceController extends BasePreferenceContr sb.append(getIntroductionTitle()).append("\n\n").append(footerPreference.getTitle()); footerPreference.setContentDescription(sb); final Intent helpIntent; if (getHelpResource() != 0) { footerPreference.setLearnMoreAction(view -> { final Intent helpIntent = HelpUtils.getHelpIntent( mContext, mContext.getString(getHelpResource()), // Returns may be null if content is wrong or empty. helpIntent = HelpUtils.getHelpIntent(mContext, mContext.getString(getHelpResource()), mContext.getClass().getName()); } else { helpIntent = null; } if (helpIntent != null) { footerPreference.setLearnMoreAction(view -> { view.startActivityForResult(helpIntent, 0); }); footerPreference.setLearnMoreContentDescription(getLearnMoreContentDescription()); Loading
tests/robotests/src/com/android/settings/accessibility/AccessibilityFooterPreferenceControllerTest.java +5 −5 Original line number Diff line number Diff line Loading @@ -109,16 +109,16 @@ public class AccessibilityFooterPreferenceControllerTest { } @Test public void onBindViewHolder_setupHelpLink_setCorrectHelpLinkAndContentDescription() { mController.setupHelpLink(TEST_HELP_ID, TEST_CONTENT_DESCRIPTION); public void onBindViewHolder_setHelpResource_emptyString_notVisible() { mController.setupHelpLink(R.string.help_url_timeout, TEST_CONTENT_DESCRIPTION); mController.displayPreference(mScreen); mPreference.onBindViewHolder(mPreferenceViewHolder); final TextView learnMoreView = (TextView) mPreferenceViewHolder .findViewById(com.android.settingslib.R.id.settingslib_learn_more); assertThat(learnMoreView.getContentDescription().toString()) .contains(TEST_CONTENT_DESCRIPTION); assertThat(mPreference.isLinkEnabled()).isTrue(); assertThat(learnMoreView.getContentDescription()).isNull(); assertThat(learnMoreView.getVisibility()).isEqualTo(View.GONE); assertThat(mPreference.isLinkEnabled()).isFalse(); } }