Fix can't focus on learn more link.
Prior to this cl, we set learn more text not focusable, it causes a11y services can't distinguish it as an action item. Also do some clean up, because we only allow clean plain text for title id, so we can simply make it as <TitleView> Also, we make footer preference can't be selectable, so it can group subcomponents to make more accessible. Test: Verify on battery saver / a11y related page with talkback service , switch access, voice access. Fix: 216516546 FIx: 215478454 Fix: 215476405 Fix: 215484382 Fix: 215483374 Change-Id: I15e82f871107115650c347aa32db5fb29ee446f7
This commit is contained in:
parent
372e99c655
commit
e708048bed
@ -46,7 +46,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<com.android.settingslib.widget.LinkTextView
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -45,7 +45,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<com.android.settingslib.widget.LinkTextView
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -19,7 +19,6 @@ package com.android.settingslib.widget;
|
||||
import android.content.Context;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
@ -59,10 +58,6 @@ public class FooterPreference extends Preference {
|
||||
public void onBindViewHolder(PreferenceViewHolder holder) {
|
||||
super.onBindViewHolder(holder);
|
||||
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)) {
|
||||
title.setContentDescription(mContentDescription);
|
||||
}
|
||||
@ -86,7 +81,6 @@ public class FooterPreference extends Preference {
|
||||
if (!TextUtils.isEmpty(mLearnMoreContentDescription)) {
|
||||
learnMore.setContentDescription(mLearnMoreContentDescription);
|
||||
}
|
||||
learnMore.setFocusable(false);
|
||||
} else {
|
||||
learnMore.setVisibility(View.GONE);
|
||||
}
|
||||
@ -180,6 +174,7 @@ public class FooterPreference extends Preference {
|
||||
if (TextUtils.isEmpty(getKey())) {
|
||||
setKey(KEY_FOOTER);
|
||||
}
|
||||
setSelectable(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,32 +23,46 @@
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:orientation="vertical"
|
||||
android:clipToPadding="false">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/icon_container"
|
||||
android:id="@+id/icon_frame"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="60dp"
|
||||
android:minWidth="56dp"
|
||||
android:gravity="start|top"
|
||||
android:orientation="horizontal"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="4dp">
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
||||
<com.android.settingslib.widget.LinkTextView
|
||||
android:id="@android:id/title"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:maxLines="10"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:ellipsize="marquee" />
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
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>
|
||||
|
@ -19,7 +19,6 @@ package com.android.settingslib.widget;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.TextView;
|
||||
|
||||
@ -45,17 +44,6 @@ public class FooterPreferenceTest {
|
||||
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
|
||||
public void setSummary_summarySet_shouldSetAsTitle() {
|
||||
mFooterPreference.setSummary("summary");
|
||||
|
Loading…
x
Reference in New Issue
Block a user