From 6180f22bfe6baf64d43b997d5b221ec49e4d0818 Mon Sep 17 00:00:00 2001
From: Arne <arne@monocles.de>
Date: Thu, 9 Jan 2025 19:05:59 +0100
Subject: [PATCH] Expandable Text, collapse after 8 lines

---
 .../siacs/conversations/ui/adapter/MessageAdapter.java | 10 +++++-----
 src/main/res/layout/item_message_content.xml           |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index 347b4d037..625f86d35 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -755,13 +755,13 @@ public class MessageAdapter extends ArrayAdapter<Message> {
             viewHolder.messageBody().setAutoLinkMask(0);
             viewHolder.messageBody().setText(body);
 
-            // Experimental expandable text
+            // Experimental expandable text, collapse after 8 lines
             if (activity.xmppConnectionService.getBooleanPreference("set_text_collapsable", R.bool.set_text_collapsable)) {
                 viewHolder.messageBody().post(new Runnable() {
                     @Override
                     public void run() {
                         int lineCount = viewHolder.messageBody().getLineCount();
-                        if (lineCount > 6) {
+                        if (lineCount > 8) {
                             viewHolder.showMore().setVisibility(View.VISIBLE);
                         } else {
                             viewHolder.showMore().setVisibility(GONE);
@@ -773,12 +773,12 @@ public class MessageAdapter extends ArrayAdapter<Message> {
                     @Override
                     public void onClick(View v) {
                         if (isTextViewClicked[0]) {
-                            //This will shrink textview to 6 lines if it is expanded.
+                            //This will shrink textview to 8 lines if it is expanded.
                             viewHolder.showMore().setText(R.string.show_more);
-                            viewHolder.messageBody().setMaxLines(6);
+                            viewHolder.messageBody().setMaxLines(8);
                             isTextViewClicked[0] = false;
                         } else {
-                            //This will expand the textview if it is of 6 lines
+                            //This will expand the textview if it is of 8 lines
                             viewHolder.showMore().setText(R.string.show_less);
                             viewHolder.messageBody().setMaxLines(Integer.MAX_VALUE);
                             isTextViewClicked[0] = true;
diff --git a/src/main/res/layout/item_message_content.xml b/src/main/res/layout/item_message_content.xml
index 5619c585b..2c6c5825e 100644
--- a/src/main/res/layout/item_message_content.xml
+++ b/src/main/res/layout/item_message_content.xml
@@ -64,7 +64,7 @@
             android:layout_marginHorizontal="10dp"
             android:paddingTop="4dp"
             android:autoLink="web"
-            android:maxLines="6"
+            android:maxLines="8"
             android:longClickable="false"
             android:textAppearance="?textAppearanceBodyMedium"
             android:visibility="gone" />