From 778718c7b2eef4031af8b432509e8a3705ecb5ec Mon Sep 17 00:00:00 2001 From: Hocuri Date: Sun, 8 Nov 2020 12:34:04 +0100 Subject: [PATCH] Don't cut the document icon in quotes I also deleted an unnecessary LinearLayout, so you should look at the diff with --ignore-all-space Firstly, I lifted quote_attachment_container out of the FrameLayout with the thumbnail so that quote_attachment_container can be wrap_content (and enlarge the quote if necessary) while the thumbnail still always matches the size of the quote. Then I made the document view itself a little smaller so it does not enlarge the quote all the times. --- res/layout/quote_view.xml | 212 ++++++++---------- .../securesms/components/QuoteView.java | 6 +- 2 files changed, 101 insertions(+), 117 deletions(-) diff --git a/res/layout/quote_view.xml b/res/layout/quote_view.xml index 5bec36824..043b47df5 100644 --- a/res/layout/quote_view.xml +++ b/res/layout/quote_view.xml @@ -10,138 +10,118 @@ tools:visibility="visible"> + android:orientation="horizontal"> + + + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" + android:orientation="vertical" + android:layout_weight="1"> + + + + + + + + + + + + + - - - - - - - - - - + android:scaleType="centerCrop" + android:visibility="gone" + tools:visibility="gone" /> - - - - - - + android:id="@+id/quote_video_overlay" + android:layout_width="32dp" + android:layout_height="32dp" + android:background="@drawable/circle_universal_overlay" + android:layout_gravity="center" + android:longClickable="false" + android:visibility="gone" + tools:visibility="gone"> - - - - - - + android:layout_width="13dp" + android:layout_height="16dp" + android:layout_marginStart="11dp" + android:layout_marginTop="8dp" + android:scaleType="fitXY" + app:srcCompat="@drawable/triangle_right" + android:layout_marginLeft="11dp" /> - - + + \ No newline at end of file diff --git a/src/org/thoughtcrime/securesms/components/QuoteView.java b/src/org/thoughtcrime/securesms/components/QuoteView.java index 34ebde80d..cf21c718c 100644 --- a/src/org/thoughtcrime/securesms/components/QuoteView.java +++ b/src/org/thoughtcrime/securesms/components/QuoteView.java @@ -3,7 +3,6 @@ package org.thoughtcrime.securesms.components; import android.content.Context; import android.content.res.TypedArray; -import android.graphics.Canvas; import android.graphics.Color; import android.net.Uri; import android.os.Build; @@ -111,6 +110,11 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver { typedArray.recycle(); dismissView.setVisibility(messageType == MESSAGE_TYPE_PREVIEW ? VISIBLE : GONE); + if (messageType == MESSAGE_TYPE_PREVIEW) { + bodyView.setSingleLine(); + } else { + bodyView.setMaxLines(3); + } // if (messageType == MESSAGE_TYPE_PREVIEW) { // int radius = getResources().getDimensionPixelOffset(R.dimen.quote_corner_radius_preview);