Improve collapsable text feature

This commit is contained in:
Arne 2025-01-05 21:19:01 +01:00
parent 0c4a46eb54
commit 1aeaed404f
2 changed files with 3 additions and 1 deletions

View file

@ -771,10 +771,12 @@ public class MessageAdapter extends ArrayAdapter<Message> {
public void onClick(View v) { public void onClick(View v) {
if (isTextViewClicked[0]) { if (isTextViewClicked[0]) {
//This will shrink textview to 6 lines if it is expanded. //This will shrink textview to 6 lines if it is expanded.
viewHolder.showMore().setText(R.string.show_more);
viewHolder.messageBody().setMaxLines(6); viewHolder.messageBody().setMaxLines(6);
isTextViewClicked[0] = false; isTextViewClicked[0] = false;
} else { } else {
//This will expand the textview if it is of 6 lines //This will expand the textview if it is of 6 lines
viewHolder.showMore().setText(R.string.show_less);
viewHolder.messageBody().setMaxLines(Integer.MAX_VALUE); viewHolder.messageBody().setMaxLines(Integer.MAX_VALUE);
isTextViewClicked[0] = true; isTextViewClicked[0] = true;
} }

View file

@ -75,7 +75,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/message_body" android:layout_below="@+id/message_body"
android:layout_marginHorizontal="10dp" android:layout_marginHorizontal="10dp"
android:text="... more / less" android:text="@string/show_more"
android:textColor="?colorPrimary" android:textColor="?colorPrimary"
android:textStyle="bold" android:textStyle="bold"
android:textAppearance="?textAppearanceBodyLarge" android:textAppearance="?textAppearanceBodyLarge"