diff --git a/build.gradle b/build.gradle index 3da11e99c9..9ac734e658 100644 --- a/build.gradle +++ b/build.gradle @@ -122,6 +122,7 @@ dependencies { implementation 'me.xdrop:fuzzywuzzy:1.4.0' implementation 'net.fellbaum:jemoji:1.4.1' implementation "com.daimajia.swipelayout:library:1.2.0@aar" + implementation 'com.github.bumptech.glide:glide:4.16.0' } ext { diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 1c24977d6a..979a319f4b 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1,5 +1,7 @@ package eu.siacs.conversations.ui; +import static android.view.View.GONE; +import static android.view.View.VISIBLE; import static eu.siacs.conversations.ui.XmppActivity.EXTRA_ACCOUNT; import static eu.siacs.conversations.ui.XmppActivity.REQUEST_INVITE_TO_CONVERSATION; import static eu.siacs.conversations.ui.util.SoftKeyboardUtils.hideSoftKeyboard; @@ -86,6 +88,8 @@ import androidx.documentfile.provider.DocumentFile; import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.ViewPager; +import com.bumptech.glide.Glide; + import de.monocles.chat.BobTransfer; import de.monocles.chat.EmojiSearch; import de.monocles.chat.WebxdcPage; @@ -1625,7 +1629,13 @@ public class ConversationFragment extends XmppFragment } SpannableStringBuilder body = message.getSpannableBody(null, null); - if (message.isFileOrImage() || message.isOOb()) body.append(" 🖼️"); + if ((message.isFileOrImage() || message.isOOb()) && binding.imageReplyPreview != null) { + binding.imageReplyPreview.setVisibility(VISIBLE); + Glide.with(activity).load(message.getRelativeFilePath()).placeholder(R.drawable.ic_image_24dp).thumbnail(0.2f).into(binding.imageReplyPreview); + } else if (binding.imageReplyPreview != null) { + Glide.with(activity).clear(binding.imageReplyPreview); + binding.imageReplyPreview.setVisibility(GONE); + } messageListAdapter.handleTextQuotes(binding.contextPreviewText, body); binding.contextPreviewText.setText(body); binding.contextPreview.setVisibility(View.VISIBLE); diff --git a/src/main/res/layout/fragment_conversation.xml b/src/main/res/layout/fragment_conversation.xml index 80b99aa44c..687ccb8e04 100644 --- a/src/main/res/layout/fragment_conversation.xml +++ b/src/main/res/layout/fragment_conversation.xml @@ -61,6 +61,18 @@ android:layout_marginRight="8dp" android:contentDescription="Reply to" /> + +