Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 073addda authored by Sunny Shao's avatar Sunny Shao
Browse files

Fix Learn more link placement is wrong problem

- Use the new style of the FooterPreference.

Fixes: 190951058
Test: manual test
Change-Id: I33d30f00b3785f5195e38e3e26524dd93971d486
parent b8c610b1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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">
+0 −1
Original line number Diff line number Diff line
@@ -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>
+13 −10
Original line number Diff line number Diff line
@@ -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() {
        final CharSequence footerText = mContext.getText(R.string.app_launch_footer);
        final FooterPreference footerPreference = (FooterPreference) findPreference(
                FOOTER_PREF_KEY);
        footerPreference.setTitle(footerText);
        // learn more
        final AnnotationSpan.LinkInfo linkInfo =
                new AnnotationSpan.LinkInfo(ANNOTATION_URL, v -> {
        footerPreference.setLearnMoreAction(view -> {
            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));
        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() {