Apply monocles context file preview

This commit is contained in:
Arne 2024-08-31 22:33:36 +02:00
parent da9e5e868d
commit c5d9ad1d64
3 changed files with 24 additions and 1 deletions

View file

@ -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 {

View file

@ -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);

View file

@ -61,6 +61,18 @@
android:layout_marginRight="8dp"
android:contentDescription="Reply to" />
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/image_reply_preview"
android:layout_width="64dp"
android:layout_height="64dp"
android:adjustViewBounds="true"
android:paddingTop="2dp"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:scaleType="fitCenter"
app:shapeAppearance="@style/ShapeAppearanceOverlay.Photo"
android:visibility="gone" />
<TextView
android:id="@+id/context_preview_text"
android:layout_weight="1"