diff --git a/app/src/main/java/org/oppia/android/app/policies/PoliciesFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/policies/PoliciesFragmentPresenter.kt index 4fad16c9462..1b2bcb20a3d 100644 --- a/app/src/main/java/org/oppia/android/app/policies/PoliciesFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/policies/PoliciesFragmentPresenter.kt @@ -46,12 +46,10 @@ class PoliciesFragmentPresenter @Inject constructor( var policyWebLink = "" if (policyPage == PolicyPage.PRIVACY_POLICY) { - policyDescription = - resourceHandler.getStringInLocale(R.string.privacy_policy_content) + policyDescription = resourceHandler.getStringInLocale(R.string.privacy_policy_content) policyWebLink = resourceHandler.getStringInLocale(R.string.privacy_policy_web_link) } else if (policyPage == PolicyPage.TERMS_OF_SERVICE) { - policyDescription = - resourceHandler.getStringInLocale(R.string.terms_of_service_content) + policyDescription = resourceHandler.getStringInLocale(R.string.terms_of_service_content) policyWebLink = resourceHandler.getStringInLocale(R.string.terms_of_service_web_link) } diff --git a/utility/src/main/java/org/oppia/android/util/parser/html/HtmlParser.kt b/utility/src/main/java/org/oppia/android/util/parser/html/HtmlParser.kt index cb37742ff19..97db2dce9db 100755 --- a/utility/src/main/java/org/oppia/android/util/parser/html/HtmlParser.kt +++ b/utility/src/main/java/org/oppia/android/util/parser/html/HtmlParser.kt @@ -4,8 +4,11 @@ import android.app.Application import android.content.Context import android.text.Spannable import android.text.SpannableStringBuilder +import android.text.Spanned import android.text.method.LinkMovementMethod +import android.text.style.URLSpan import android.text.util.Linkify +import android.util.Patterns import android.view.View import android.widget.TextView import androidx.core.text.util.LinkifyCompat @@ -128,6 +131,16 @@ class HtmlParser private constructor( htmlContent, imageGetter, computeCustomTagHandlers(supportsConceptCards, htmlContentTextView) ) + val urlPattern = Patterns.WEB_URL + val matcher = urlPattern.matcher(htmlSpannable) + while (matcher.find()) { + val start = matcher.start() + val end = matcher.end() + val url = htmlSpannable.subSequence(start, end).toString() + val urlSpan = URLSpan(url) + htmlSpannable.setSpan(urlSpan, start, end, Spanned.SPAN_EXCLUSIVE_INCLUSIVE) + } + return ensureNonEmpty(trimSpannable(htmlSpannable as SpannableStringBuilder)) }