[Material Next] Support "Learn more" for help link
Allow CaptionManager, Magnification, Color correction, Color inversion, Time to take action, and Autoclick. Bug: 187671696 Test: make RunSettingsRoboTests -j52 ROBOTEST_FILTER=AccessibilityFooterPreferenceTest Change-Id: I9d753243d4f61b6b3d58b50425b7a75a812a481d
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
package com.android.settings.accessibility;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.AttributeSet;
|
||||
@@ -25,7 +27,9 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import com.android.settingslib.R;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.utils.AnnotationSpan;
|
||||
import com.android.settingslib.HelpUtils;
|
||||
import com.android.settingslib.widget.FooterPreference;
|
||||
|
||||
/**
|
||||
@@ -106,4 +110,23 @@ public final class AccessibilityFooterPreference extends FooterPreference {
|
||||
public boolean isLinkEnabled() {
|
||||
return mLinkEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends {@link AnnotationSpan} with learn more link apart from the other text.
|
||||
*
|
||||
* @param helpLinkRes The Help Uri Resource key
|
||||
*/
|
||||
public void appendHelpLink(int helpLinkRes) {
|
||||
final SpannableStringBuilder sb = new SpannableStringBuilder();
|
||||
sb.append(getTitle()).append("\n\n").append(getLearnMoreLink(getContext(), helpLinkRes));
|
||||
setTitle(sb);
|
||||
}
|
||||
|
||||
private CharSequence getLearnMoreLink(Context context, int helpLinkRes) {
|
||||
final Intent helpIntent = HelpUtils.getHelpIntent(
|
||||
context, context.getString(helpLinkRes), context.getClass().getName());
|
||||
final AnnotationSpan.LinkInfo linkInfo = new AnnotationSpan.LinkInfo(
|
||||
context, AnnotationSpan.LinkInfo.DEFAULT_ANNOTATION, helpIntent);
|
||||
return AnnotationSpan.linkify(context.getText(R.string.footer_learn_more), linkInfo);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user