Merge branch 'ubrir/develop' of https://git.svc.touchin.ru/TouchInstinct/RoboSwag into merge_dev_into_43443
This commit is contained in:
commit
c8cdfe7b88
|
|
@ -20,11 +20,11 @@ import ru.touchin.utils.ActionThrottler.DEFAULT_THROTTLE_DELAY_MS
|
|||
*/
|
||||
fun String.getSpannedTextWithUrls(
|
||||
removeUnderline: Boolean = true,
|
||||
flags: Int = HtmlCompat.FROM_HTML_MODE_COMPACT
|
||||
htmlFormatFlags: Int = HtmlCompat.FROM_HTML_MODE_COMPACT
|
||||
): Spanned {
|
||||
// HtmlCompat.fromHtml doesn't respect line breaks
|
||||
val text = this.replace(lineBreakRegex, "<br/>")
|
||||
val spannableText = SpannableString(HtmlCompat.fromHtml(text, flags))
|
||||
val spannableText = SpannableString(HtmlCompat.fromHtml(text, htmlFormatFlags))
|
||||
|
||||
// Linkify removes all previous URLSpan's, we need to save all created spans for reapply after Linkify
|
||||
val spans = spannableText.getUrlSpans()
|
||||
|
|
@ -33,7 +33,7 @@ fun String.getSpannedTextWithUrls(
|
|||
spannableText.setSpan(it.span, it.start, it.end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
}
|
||||
|
||||
if (!removeUnderline) {
|
||||
if (removeUnderline) {
|
||||
spannableText.getUrlSpans()
|
||||
.forEach { urlSpan ->
|
||||
spannableText.removeSpan(urlSpan.span)
|
||||
|
|
|
|||
Loading…
Reference in New Issue