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

Commit cb8f0c39 authored by Tsung-Mao Fang's avatar Tsung-Mao Fang Committed by Android (Google) Code Review
Browse files

Merge "Fix can't focus on learn more link." into tm-dev

parents a8b31104 e708048b
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -46,7 +46,7 @@
        android:layout_width="wrap_content"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        android:orientation="vertical">
        <com.android.settingslib.widget.LinkTextView
        <TextView
            android:id="@android:id/title"
            android:id="@android:id/title"
            android:layout_width="wrap_content"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_height="wrap_content"
+1 −1
Original line number Original line Diff line number Diff line
@@ -45,7 +45,7 @@
        android:layout_width="wrap_content"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        android:orientation="vertical">
        <com.android.settingslib.widget.LinkTextView
        <TextView
            android:id="@android:id/title"
            android:id="@android:id/title"
            android:layout_width="wrap_content"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_height="wrap_content"
+1 −6
Original line number Original line Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.settingslib.widget;
import android.content.Context;
import android.content.Context;
import android.text.SpannableString;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.URLSpan;
import android.text.style.URLSpan;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.view.View;
import android.view.View;
@@ -59,10 +58,6 @@ public class FooterPreference extends Preference {
    public void onBindViewHolder(PreferenceViewHolder holder) {
    public void onBindViewHolder(PreferenceViewHolder holder) {
        super.onBindViewHolder(holder);
        super.onBindViewHolder(holder);
        TextView title = holder.itemView.findViewById(android.R.id.title);
        TextView title = holder.itemView.findViewById(android.R.id.title);
        title.setMovementMethod(new LinkMovementMethod());
        title.setClickable(false);
        title.setLongClickable(false);
        title.setFocusable(false);
        if (!TextUtils.isEmpty(mContentDescription)) {
        if (!TextUtils.isEmpty(mContentDescription)) {
            title.setContentDescription(mContentDescription);
            title.setContentDescription(mContentDescription);
        }
        }
@@ -86,7 +81,6 @@ public class FooterPreference extends Preference {
            if (!TextUtils.isEmpty(mLearnMoreContentDescription)) {
            if (!TextUtils.isEmpty(mLearnMoreContentDescription)) {
                learnMore.setContentDescription(mLearnMoreContentDescription);
                learnMore.setContentDescription(mLearnMoreContentDescription);
            }
            }
            learnMore.setFocusable(false);
        } else {
        } else {
            learnMore.setVisibility(View.GONE);
            learnMore.setVisibility(View.GONE);
        }
        }
@@ -180,6 +174,7 @@ public class FooterPreference extends Preference {
        if (TextUtils.isEmpty(getKey())) {
        if (TextUtils.isEmpty(getKey())) {
            setKey(KEY_FOOTER);
            setKey(KEY_FOOTER);
        }
        }
        setSelectable(false);
    }
    }


    /**
    /**
+25 −11
Original line number Original line Diff line number Diff line
@@ -23,17 +23,18 @@
    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:background="?android:attr/selectableItemBackground"
    android:background="?android:attr/selectableItemBackground"
    android:orientation="vertical"
    android:clipToPadding="false">
    android:clipToPadding="false">


    <LinearLayout
    <LinearLayout
        android:id="@+id/icon_container"
        android:id="@+id/icon_frame"
        android:layout_width="wrap_content"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_height="wrap_content"
        android:minWidth="60dp"
        android:minWidth="56dp"
        android:gravity="start|top"
        android:gravity="start|top"
        android:orientation="horizontal"
        android:orientation="horizontal"
        android:paddingEnd="12dp"
        android:paddingEnd="12dp"
        android:paddingTop="20dp"
        android:paddingTop="16dp"
        android:paddingBottom="4dp">
        android:paddingBottom="4dp">
        <ImageView
        <ImageView
            android:id="@android:id/icon"
            android:id="@android:id/icon"
@@ -41,14 +42,27 @@
            android:layout_height="wrap_content"/>
            android:layout_height="wrap_content"/>
    </LinearLayout>
    </LinearLayout>


    <com.android.settingslib.widget.LinkTextView
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <TextView
            android:id="@android:id/title"
            android:id="@android:id/title"
            android:layout_width="wrap_content"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_height="wrap_content"
        android:paddingBottom="16dp"
            android:paddingTop="16dp"
            android:paddingTop="16dp"
        android:maxLines="10"
            android:paddingBottom="8dp"
            android:textColor="?android:attr/textColorSecondary"
            android:textColor="?android:attr/textColorSecondary"
            android:ellipsize="marquee" />
            android:ellipsize="marquee" />


        <com.android.settingslib.widget.LinkTextView
            android:id="@+id/settingslib_learn_more"
            android:text="@string/settingslib_learn_more_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:visibility="gone"
            style="@style/TextAppearance.Footer.Title.SettingsLib"/>
    </LinearLayout>

</LinearLayout>
</LinearLayout>
+0 −12
Original line number Original line Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.settingslib.widget;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertThat;


import android.content.Context;
import android.content.Context;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.LayoutInflater;
import android.widget.TextView;
import android.widget.TextView;


@@ -45,17 +44,6 @@ public class FooterPreferenceTest {
        mFooterPreference = new FooterPreference(mContext);
        mFooterPreference = new FooterPreference(mContext);
    }
    }


    @Test
    public void bindPreference_shouldLinkifyContent() {
        final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
                LayoutInflater.from(mContext).inflate(R.layout.preference_footer, null));

        mFooterPreference.onBindViewHolder(holder);

        assertThat(((TextView) holder.findViewById(android.R.id.title)).getMovementMethod())
                .isInstanceOf(LinkMovementMethod.class);
    }

    @Test
    @Test
    public void setSummary_summarySet_shouldSetAsTitle() {
    public void setSummary_summarySet_shouldSetAsTitle() {
        mFooterPreference.setSummary("summary");
        mFooterPreference.setSummary("summary");