summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml6
-rw-r--r--src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java2
-rw-r--r--src/com/android/settings/utils/AnnotationSpan.java20
3 files changed, 24 insertions, 4 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1dbc0a0589..4acfde3706 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -12117,11 +12117,11 @@
<!-- Content description for the 5G limited VoLTE dialog. [CHAR LIMIT=NONE] -->
<string name="volte_5G_limited_text">This also turns off your 5G connection.\nDuring a voice call, you can\u2019t use the internet and some apps may not work.</string>
<!-- Footer to show current limitation of 5G on DSDS mode. [CHAR LIMIT=NONE] -->
- <string name="no_5g_in_dsds_text" product="default">When using 2 SIMs, this phone will be limited to 4G. <annotation id="url">Learn more</annotation>.</string>
+ <string name="no_5g_in_dsds_text" product="default">When using 2 SIMs, this phone will be limited to 4G. <annotation id="url">Learn more</annotation></string>
<!-- Footer to show current limitation of 5G on DSDS mode for tablets. [CHAR LIMIT=NONE] -->
- <string name="no_5g_in_dsds_text" product="tablet">When using 2 SIMs, this tablet will be limited to 4G. <annotation id="url">Learn more</annotation>.</string>
+ <string name="no_5g_in_dsds_text" product="tablet">When using 2 SIMs, this tablet will be limited to 4G. <annotation id="url">Learn more</annotation></string>
<!-- Footer to show current limitation of 5G on DSDS mode for general devices. [CHAR LIMIT=NONE] -->
- <string name="no_5g_in_dsds_text" product="device">When using 2 SIMs, this device will be limited to 4G. <annotation id="url">Learn more</annotation>.</string>
+ <string name="no_5g_in_dsds_text" product="device">When using 2 SIMs, this device will be limited to 4G. <annotation id="url">Learn more</annotation></string>
<!-- Help URI, 5G limitation in DSDS condition. [DO NOT TRANSLATE] -->
<string name="help_uri_5g_dsds" translatable="false"></string>
diff --git a/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java b/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java
index 4077e91ae8..3911fb8038 100644
--- a/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java
+++ b/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java
@@ -69,7 +69,7 @@ public class NrDisabledInDsdsFooterPreferenceController extends BasePreferenceCo
if (linkInfo.isActionable()) {
return AnnotationSpan.linkify(mContext.getText(R.string.no_5g_in_dsds_text), linkInfo);
} else {
- return mContext.getText(R.string.no_5g_in_dsds_text);
+ return AnnotationSpan.textWithoutLink(mContext.getText(R.string.no_5g_in_dsds_text));
}
}
diff --git a/src/com/android/settings/utils/AnnotationSpan.java b/src/com/android/settings/utils/AnnotationSpan.java
index 1b8179d759..98256a00cb 100644
--- a/src/com/android/settings/utils/AnnotationSpan.java
+++ b/src/com/android/settings/utils/AnnotationSpan.java
@@ -27,6 +27,9 @@ import android.text.style.URLSpan;
import android.util.Log;
import android.view.View;
+import java.util.Arrays;
+import java.util.Comparator;
+
/**
* This class is used to add {@link View.OnClickListener} for the text been wrapped by
* annotation.
@@ -76,6 +79,23 @@ public class AnnotationSpan extends URLSpan {
}
/**
+ * get the text part without having text for link part
+ */
+ public static CharSequence textWithoutLink(CharSequence encodedText) {
+ SpannableString msg = new SpannableString(encodedText);
+ Annotation[] spans = msg.getSpans(0, msg.length(), Annotation.class);
+ if (spans == null) {
+ return encodedText;
+ }
+ Arrays.sort(spans, Comparator.comparingInt(span -> -msg.getSpanStart(span)));
+ StringBuilder msgWithoutLink = new StringBuilder(msg.toString());
+ for (Annotation span : spans) {
+ msgWithoutLink.delete(msg.getSpanStart(span), msg.getSpanEnd(span));
+ }
+ return msgWithoutLink.toString();
+ }
+
+ /**
* Data class to store the annotation and the click action
*/
public static class LinkInfo {