From fe18bb4c65dabac0da1fa7f4240c4696f3f172a9 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Thu, 30 Nov 2023 11:00:25 +0100 Subject: [PATCH] fix to enable links in markdown fix to enable links in markdown when no top level domain was included in the link description This will disable automatic link parsing for hyperlinks, numbers, email address,... Signed-off-by: Marcel Hibbe --- .../com/nextcloud/talk/utils/message/MessageUtils.kt | 10 +++++++--- app/src/main/res/layout/activity_chat.xml | 1 - 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/utils/message/MessageUtils.kt b/app/src/main/java/com/nextcloud/talk/utils/message/MessageUtils.kt index 9ac61bb0aa..fbabf9a943 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/message/MessageUtils.kt +++ b/app/src/main/java/com/nextcloud/talk/utils/message/MessageUtils.kt @@ -11,8 +11,8 @@ import android.content.Intent import android.net.Uri import android.text.SpannableString import android.text.Spanned -import android.util.Log import android.view.View +import androidx.core.content.ContextCompat.startActivity import com.nextcloud.talk.R import com.nextcloud.talk.models.json.chat.ChatMessage import com.nextcloud.talk.ui.theme.ViewThemeUtils @@ -155,8 +155,12 @@ class MessageUtils(val context: Context) { } override fun configureConfiguration(builder: MarkwonConfiguration.Builder) { - builder.linkResolver { view: View?, link: String? -> - Log.i(TAG, "Link action not implemented $view / $link") + builder.linkResolver { _: View?, link: String? -> + val urlIntent = Intent( + Intent.ACTION_VIEW, + Uri.parse(link) + ) + startActivity(context, urlIntent, null) } } }) diff --git a/app/src/main/res/layout/activity_chat.xml b/app/src/main/res/layout/activity_chat.xml index f9efc89c16..5d9ad46efa 100644 --- a/app/src/main/res/layout/activity_chat.xml +++ b/app/src/main/res/layout/activity_chat.xml @@ -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" />