Unverified Commit f0e411c4 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito Committed by GitHub

Merge branch 'develop' into members-user-status

parents c32b2e8e a1255c05
...@@ -7,6 +7,7 @@ import androidx.core.view.isVisible ...@@ -7,6 +7,7 @@ import androidx.core.view.isVisible
import chat.rocket.android.emoji.internal.GlideApp import chat.rocket.android.emoji.internal.GlideApp
import chat.rocket.android.util.extensions.getFileName import chat.rocket.android.util.extensions.getFileName
import chat.rocket.android.util.extensions.getMimeType import chat.rocket.android.util.extensions.getMimeType
import com.bumptech.glide.load.resource.gif.GifDrawable
import com.bumptech.glide.request.target.SimpleTarget import com.bumptech.glide.request.target.SimpleTarget
import com.bumptech.glide.request.transition.Transition import com.bumptech.glide.request.transition.Transition
...@@ -21,6 +22,15 @@ fun ChatRoomFragment.showFileAttachmentDialog(uri: Uri) { ...@@ -21,6 +22,15 @@ fun ChatRoomFragment.showFileAttachmentDialog(uri: Uri) {
description.text.clear() description.text.clear()
when { when {
mimeType.startsWith("image") -> { mimeType.startsWith("image") -> {
if (mimeType.contains("gif")) {
GlideApp
.with(context)
.asGif()
.load(uri)
.override(imagePreview.width, imagePreview.height)
.fitCenter()
.into(imagePreview)
} else {
GlideApp GlideApp
.with(context) .with(context)
.asBitmap() .asBitmap()
...@@ -34,10 +44,11 @@ fun ChatRoomFragment.showFileAttachmentDialog(uri: Uri) { ...@@ -34,10 +44,11 @@ fun ChatRoomFragment.showFileAttachmentDialog(uri: Uri) {
) { ) {
bitmap = resource bitmap = resource
imagePreview.setImageBitmap(resource) imagePreview.setImageBitmap(resource)
imagePreview.isVisible = true
} }
}) })
} }
imagePreview.isVisible = true
}
mimeType.startsWith("video") -> audioVideoAttachment.isVisible = true mimeType.startsWith("video") -> audioVideoAttachment.isVisible = true
else -> { else -> {
textFile.isVisible = true textFile.isVisible = true
......
...@@ -13,7 +13,6 @@ import android.text.style.ReplacementSpan ...@@ -13,7 +13,6 @@ import android.text.style.ReplacementSpan
import android.view.View import android.view.View
import androidx.core.content.res.ResourcesCompat import androidx.core.content.res.ResourcesCompat
import androidx.core.util.PatternsCompat import androidx.core.util.PatternsCompat
import chat.rocket.android.R
import chat.rocket.android.chatroom.ui.StrikethroughDelimiterProcessor import chat.rocket.android.chatroom.ui.StrikethroughDelimiterProcessor
import chat.rocket.android.emoji.EmojiParser import chat.rocket.android.emoji.EmojiParser
import chat.rocket.android.emoji.EmojiRepository import chat.rocket.android.emoji.EmojiRepository
...@@ -32,6 +31,7 @@ import org.commonmark.node.Emphasis ...@@ -32,6 +31,7 @@ import org.commonmark.node.Emphasis
import org.commonmark.node.ListItem import org.commonmark.node.ListItem
import org.commonmark.node.Node import org.commonmark.node.Node
import org.commonmark.node.OrderedList import org.commonmark.node.OrderedList
import org.commonmark.node.SoftLineBreak
import org.commonmark.node.StrongEmphasis import org.commonmark.node.StrongEmphasis
import org.commonmark.parser.Parser import org.commonmark.parser.Parser
import ru.noties.markwon.SpannableBuilder import ru.noties.markwon.SpannableBuilder
...@@ -219,6 +219,11 @@ class MessageParser @Inject constructor( ...@@ -219,6 +219,11 @@ class MessageParser @Inject constructor(
builder.append('\n') builder.append('\n')
} }
} }
override fun visit(softLineBreak: SoftLineBreak) {
super.visit(softLineBreak)
builder.append("\n")
}
} }
class LinkVisitor(private val builder: SpannableBuilder) : AbstractVisitor() { class LinkVisitor(private val builder: SpannableBuilder) : AbstractVisitor() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment