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 <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-11-30 11:00:25 +01:00 committed by Andy Scherzinger
parent 3e4995de36
commit cabe16202b
2 changed files with 7 additions and 4 deletions

View file

@ -11,8 +11,8 @@ import android.content.Intent
import android.net.Uri import android.net.Uri
import android.text.SpannableString import android.text.SpannableString
import android.text.Spanned import android.text.Spanned
import android.util.Log
import android.view.View import android.view.View
import androidx.core.content.ContextCompat.startActivity
import com.nextcloud.talk.R import com.nextcloud.talk.R
import com.nextcloud.talk.models.json.chat.ChatMessage import com.nextcloud.talk.models.json.chat.ChatMessage
import com.nextcloud.talk.ui.theme.ViewThemeUtils import com.nextcloud.talk.ui.theme.ViewThemeUtils
@ -155,8 +155,12 @@ class MessageUtils(val context: Context) {
} }
override fun configureConfiguration(builder: MarkwonConfiguration.Builder) { override fun configureConfiguration(builder: MarkwonConfiguration.Builder) {
builder.linkResolver { view: View?, link: String? -> builder.linkResolver { _: View?, link: String? ->
Log.i(TAG, "Link action not implemented $view / $link") val urlIntent = Intent(
Intent.ACTION_VIEW,
Uri.parse(link)
)
startActivity(context, urlIntent, null)
} }
} }
}) })

View file

@ -154,7 +154,6 @@
app:outcomingTextLinkColor="@color/high_emphasis_text" app:outcomingTextLinkColor="@color/high_emphasis_text"
app:outcomingTextSize="@dimen/chat_text_size" app:outcomingTextSize="@dimen/chat_text_size"
app:outcomingTimeTextSize="12sp" app:outcomingTimeTextSize="12sp"
app:textAutoLink="all"
tools:visibility="visible" /> tools:visibility="visible" />
<com.nextcloud.ui.popupbubble.PopupBubble <com.nextcloud.ui.popupbubble.PopupBubble