From 073addda549c336031c3376e15fa0c915e6f6ea2 Mon Sep 17 00:00:00 2001 From: Sunny Shao Date: Mon, 14 Jun 2021 10:03:16 +0800 Subject: [PATCH] Fix Learn more link placement is wrong problem - Use the new style of the FooterPreference. Fixes: 190951058 Test: manual test Change-Id: I33d30f00b3785f5195e38e3e26524dd93971d486 --- res/values/strings.xml | 2 +- res/xml/installed_app_launch_settings.xml | 1 - .../intentpicker/AppLaunchSettings.java | 23 +++++++++++-------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 3b4fae4b944..5be20c65416 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -10133,7 +10133,7 @@ Add link - An app can verify links to automatically open in the app. Learn more + An app can verify links to automatically open in the app. diff --git a/res/xml/installed_app_launch_settings.xml b/res/xml/installed_app_launch_settings.xml index 7d971b07d2b..3394d864ebe 100644 --- a/res/xml/installed_app_launch_settings.xml +++ b/res/xml/installed_app_launch_settings.xml @@ -63,7 +63,6 @@ diff --git a/src/com/android/settings/applications/intentpicker/AppLaunchSettings.java b/src/com/android/settings/applications/intentpicker/AppLaunchSettings.java index 439a6a31b40..43c377aff7b 100644 --- a/src/com/android/settings/applications/intentpicker/AppLaunchSettings.java +++ b/src/com/android/settings/applications/intentpicker/AppLaunchSettings.java @@ -46,7 +46,6 @@ import com.android.settings.R; import com.android.settings.Utils; import com.android.settings.applications.AppInfoBase; import com.android.settings.applications.ClearDefaultsPreference; -import com.android.settings.utils.AnnotationSpan; import com.android.settings.widget.EntityHeaderController; import com.android.settingslib.applications.AppUtils; import com.android.settingslib.widget.FooterPreference; @@ -73,8 +72,6 @@ public class AppLaunchSettings extends AppInfoBase implements "open_by_default_selected_links_category"; private static final String OTHER_DETAILS_PREF_CATEGORY_KEY = "app_launch_other_defaults"; - // Url and Uri - private static final String ANNOTATION_URL = "url"; private static final String LEARN_MORE_URI = "https://developer.android.com/training/app-links/verify-site-associations"; @@ -356,16 +353,22 @@ public class AppLaunchSettings extends AppInfoBase implements } private void initFooter() { - // learn more - final AnnotationSpan.LinkInfo linkInfo = - new AnnotationSpan.LinkInfo(ANNOTATION_URL, v -> { - final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(LEARN_MORE_URI)); - mContext.startActivity(intent); - }); final CharSequence footerText = mContext.getText(R.string.app_launch_footer); final FooterPreference footerPreference = (FooterPreference) findPreference( FOOTER_PREF_KEY); - footerPreference.setTitle(AnnotationSpan.linkify(footerText, linkInfo)); + footerPreference.setTitle(footerText); + // learn more + footerPreference.setLearnMoreAction(view -> { + final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(LEARN_MORE_URI)); + mContext.startActivity(intent); + }); + final String learnMoreContentDescription = mContext.getString( + R.string.footer_learn_more_content_description, getLabelName()); + footerPreference.setLearnMoreContentDescription(learnMoreContentDescription); + } + + private String getLabelName() { + return mContext.getString(R.string.launch_by_default); } private boolean isClearDefaultsEnabled() {