Don't ellipsize multi-line text in conversation list.

Instead, basically convert newlines to spaces.
master
Greyson Parrelli 2020-07-24 11:28:24 -04:00
parent 8ce5c4b885
commit 7446c2096d
1 changed files with 13 additions and 2 deletions

View File

@ -56,7 +56,6 @@ import org.thoughtcrime.securesms.util.ExpirationUtil;
import org.thoughtcrime.securesms.util.MediaUtil;
import org.thoughtcrime.securesms.util.SearchUtil;
import org.thoughtcrime.securesms.util.ThemeUtil;
import org.thoughtcrime.securesms.util.Util;
import org.thoughtcrime.securesms.util.ViewUtil;
import java.util.Collections;
@ -454,11 +453,23 @@ public class ConversationListItem extends RelativeLayout
} else if (extra != null && extra.isRemoteDelete()) {
return new SpannableString(emphasisAdded(context.getString(thread.isOutgoing() ? R.string.ThreadRecord_you_deleted_this_message : R.string.ThreadRecord_this_message_was_deleted)));
} else {
return new SpannableString(Util.emptyIfNull(thread.getBody()));
return new SpannableString(removeNewlines(thread.getBody()));
}
}
}
private static @NonNull String removeNewlines(@Nullable String text) {
if (text == null) {
return "";
}
if (text.indexOf('\n') >= 0) {
return text.replaceAll("\n", " ");
} else {
return text;
}
}
private static @NonNull SpannableString emphasisAdded(String sequence) {
return emphasisAdded(sequence, 0, sequence.length());
}