From 0539ca412df2a44eb460a8a4b2af76daef50404a Mon Sep 17 00:00:00 2001 From: Warrick Corfe-Tan Date: Thu, 26 Aug 2021 15:18:13 +1000 Subject: [PATCH] constrain min size for cancel button when drafting a quote reply. --- .../securesms/conversation/v2/messages/QuoteView.kt | 9 ++++----- app/src/main/res/layout/view_quote.xml | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/QuoteView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/QuoteView.kt index 65af5edcee..d873978ca7 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/QuoteView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/QuoteView.kt @@ -81,11 +81,10 @@ class QuoteView : LinearLayout { val staticLayout = TextUtilities.getIntrinsicLayout(body, quoteViewBodyTextView.paint, maxContentWidth) result += bodyTextViewIntrinsicHeight if (!quoteViewAuthorTextView.isVisible) { - // We want to at least be as high as the cancel button, and no higher than 56 DP (that's - // approximately the height of 3 lines. - - // Calculating height based on proportion of the static layout. - return min((result / staticLayout.lineCount) * 3, result) + // We want to at least be as high as the cancel button 36DP, and no higher than 3 lines of text. + // Height from intrinsic layout is the height of the text before truncation so we shorten + // proportionally to our max lines setting. + return max(toPx(32, resources) ,min((result / staticLayout.lineCount) * 3, result)) } else { // Because we're showing the author text view, we should have a height of at least 32 DP // anyway, so there's no need to constrain to that. We constrain to a max height of 56 DP diff --git a/app/src/main/res/layout/view_quote.xml b/app/src/main/res/layout/view_quote.xml index d2835c8fb9..32112435a1 100644 --- a/app/src/main/res/layout/view_quote.xml +++ b/app/src/main/res/layout/view_quote.xml @@ -67,11 +67,11 @@ android:id="@+id/quoteViewBodyTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Yo, I need your help here!" - android:textSize="@dimen/small_font_size" - android:textColor="@color/text" + android:ellipsize="end" android:maxLines="3" - android:ellipsize="end" /> + android:text="Yo, I need your help here!" + android:textColor="@color/text" + android:textSize="@dimen/small_font_size" />