Linkify URLs

This commit is contained in:
Niels Andriesse 2021-06-23 14:08:17 +10:00
parent c181dfec81
commit 74697b0be7
2 changed files with 6 additions and 1 deletions

View File

@ -52,7 +52,8 @@ class LinkPreviewView : LinearLayout {
} }
titleTextView.setTextColor(ResourcesCompat.getColor(resources, textColorID, context.theme)) titleTextView.setTextColor(ResourcesCompat.getColor(resources, textColorID, context.theme))
// Body // Body
mainLinkPreviewContainer.addView(VisibleMessageContentView.getBodyTextView(context, message)) val bodyTextView = VisibleMessageContentView.getBodyTextView(context, message)
mainLinkPreviewContainer.addView(bodyTextView)
} }
fun recycle() { fun recycle() {

View File

@ -1,7 +1,9 @@
package org.thoughtcrime.securesms.conversation.v2.messages package org.thoughtcrime.securesms.conversation.v2.messages
import android.content.Context import android.content.Context
import android.content.res.ColorStateList
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.text.util.Linkify
import android.util.AttributeSet import android.util.AttributeSet
import android.util.Log import android.util.Log
import android.util.TypedValue import android.util.TypedValue
@ -132,6 +134,8 @@ class VisibleMessageContentView : LinearLayout {
result.setTextSize(TypedValue.COMPLEX_UNIT_PX, context.resources.getDimension(R.dimen.small_font_size)) result.setTextSize(TypedValue.COMPLEX_UNIT_PX, context.resources.getDimension(R.dimen.small_font_size))
val color = getTextColor(context, message) val color = getTextColor(context, message)
result.setTextColor(color) result.setTextColor(color)
result.setLinkTextColor(color)
Linkify.addLinks(result, Linkify.WEB_URLS)
return result return result
} }