Fix Learn more link placement is wrong problem
- Use the new style of the FooterPreference. Fixes: 190951058 Test: manual test Change-Id: I33d30f00b3785f5195e38e3e26524dd93971d486
This commit is contained in:
@@ -10133,7 +10133,7 @@
|
||||
<!-- Preference title for Add link [CHAR LIMIT=60] -->
|
||||
<string name="app_launch_add_link">Add link</string>
|
||||
<!-- Footer for Open by default. [CHAR LIMIT=NONE] -->
|
||||
<string name="app_launch_footer">An app can verify links to automatically open in the app. <annotation id="url">Learn more</annotation></string>
|
||||
<string name="app_launch_footer">An app can verify links to automatically open in the app.</string>
|
||||
|
||||
<!-- Title, message and button for verified links dialog. -->
|
||||
<plurals name="app_launch_verified_links_title">
|
||||
|
@@ -63,7 +63,6 @@
|
||||
<com.android.settingslib.widget.FooterPreference
|
||||
android:key="open_by_default_footer"
|
||||
android:selectable="false"
|
||||
settings:allowDividerAbove="true"
|
||||
settings:searchable="false"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
@@ -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() {
|
||||
|
Reference in New Issue
Block a user