mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-21 12:35:30 +03:00
handle link clicks properly
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
9f6c6b010c
commit
0c9f01ba29
3 changed files with 29 additions and 2 deletions
|
@ -9,7 +9,12 @@ package com.nextcloud.talk.adapters.messages
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.text.SpannableString
|
||||
import android.text.Spanned
|
||||
import android.text.TextUtils
|
||||
import android.text.style.UnderlineSpan
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
|
@ -92,6 +97,16 @@ class IncomingLinkPreviewMessageViewHolder(incomingView: View, payload: Any) :
|
|||
|
||||
binding.messageText.text = processedMessageText
|
||||
|
||||
val link = SpannableString(processedMessageText)
|
||||
link.setSpan(UnderlineSpan(), 0, link.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
binding.messageText.text = link
|
||||
|
||||
binding.messageText.setOnClickListener {
|
||||
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(processedMessageText.toString()))
|
||||
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(browserIntent)
|
||||
}
|
||||
|
||||
setAvatarAndAuthorOnMessageItem(message)
|
||||
|
||||
colorizeMessageBubble(message)
|
||||
|
|
|
@ -9,6 +9,11 @@ package com.nextcloud.talk.adapters.messages
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.text.SpannableString
|
||||
import android.text.Spanned
|
||||
import android.text.style.UnderlineSpan
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
|
@ -84,7 +89,15 @@ class OutcomingLinkPreviewMessageViewHolder(outcomingView: View, payload: Any) :
|
|||
itemView
|
||||
)
|
||||
|
||||
binding.messageText.text = processedMessageText
|
||||
val link = SpannableString(processedMessageText)
|
||||
link.setSpan(UnderlineSpan(), 0, link.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
binding.messageText.text = link
|
||||
|
||||
binding.messageText.setOnClickListener {
|
||||
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(processedMessageText.toString()))
|
||||
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(browserIntent)
|
||||
}
|
||||
|
||||
itemView.isSelected = false
|
||||
|
||||
|
|
|
@ -154,7 +154,6 @@
|
|||
app:outcomingTextLinkColor="@color/high_emphasis_text"
|
||||
app:outcomingTextSize="@dimen/chat_text_size"
|
||||
app:outcomingTimeTextSize="12sp"
|
||||
app:textAutoLink="all"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.nextcloud.ui.popupbubble.PopupBubble
|
||||
|
|
Loading…
Reference in a new issue