From 27f979b9d40e940492f5472f9ed6c50927119c80 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 1 Feb 2023 17:51:32 +0100 Subject: [PATCH] use setText instead of append() (Daniel Gultsch) --- .../eu/siacs/conversations/ui/ConversationFragment.java | 6 ++++-- .../java/eu/siacs/conversations/utils/MessageUtils.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index c74a5648d..4330097cc 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -2795,11 +2795,13 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke this.binding.textSendButton.setContentDescription(activity.getString(R.string.send_message_to_x, conversation.getName())); this.binding.textinput.setKeyboardListener(null); - this.binding.textinput.setText(""); showRecordVoiceButton(); final boolean participating = conversation.getMode() == Conversational.MODE_SINGLE || conversation.getMucOptions().participating(); if (participating) { - this.binding.textinput.append(this.conversation.getNextMessage()); + this.binding.textinput.setText(this.conversation.getNextMessage()); + this.binding.textinput.setSelection(this.binding.textinput.length()); + } else { + this.binding.textinput.setText(MessageUtils.EMPTY_STRING); } this.binding.textinput.setKeyboardListener(this); messageListAdapter.updatePreferences(); diff --git a/src/main/java/eu/siacs/conversations/utils/MessageUtils.java b/src/main/java/eu/siacs/conversations/utils/MessageUtils.java index fb6a7017d..483cc5952 100644 --- a/src/main/java/eu/siacs/conversations/utils/MessageUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/MessageUtils.java @@ -44,7 +44,7 @@ import eu.siacs.conversations.ui.util.QuoteHelper; public class MessageUtils { private static final Pattern LTR_RTL = Pattern.compile("(\\u200E[^\\u200F]*\\u200F){3,}"); - private static final String EMPTY_STRING = ""; + public static final String EMPTY_STRING = ""; public static String prepareQuote(Message message) { final StringBuilder builder = new StringBuilder();