aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/ui/ConversationFragment.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-05-21 16:43:19 +0200
committerDaniel Gultsch <daniel@gultsch.de>2014-05-21 16:43:19 +0200
commit0de9d57420e74282b09b7963017137fd32c98876 (patch)
treeb39c000876dda9329da6e70748673f6948983f27 /src/eu/siacs/conversations/ui/ConversationFragment.java
parent9d2ce5ff980d8469ee48efc25d645f2c9ca399c0 (diff)
cleaned up shared text
Diffstat (limited to 'src/eu/siacs/conversations/ui/ConversationFragment.java')
-rw-r--r--src/eu/siacs/conversations/ui/ConversationFragment.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java
index 41837d8f..44d1848f 100644
--- a/src/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/eu/siacs/conversations/ui/ConversationFragment.java
@@ -459,15 +459,11 @@ public class ConversationFragment extends Fragment {
}
protected void highlightInConference(String nick) {
- if (chatMsg.getText().toString().isEmpty()) {
+ String oldString = chatMsg.getText().toString().trim();
+ if (oldString.isEmpty()) {
chatMsg.setText(nick+": ");
} else {
- String oldString = chatMsg.getText().toString();
- if (oldString.endsWith(" ")) {
- chatMsg.setText(oldString+nick+" ");
- } else {
- chatMsg.setText(oldString+" "+nick+" ");
- }
+ chatMsg.setText(oldString+" "+nick+" ");
}
int position = chatMsg.length();
Editable etext = chatMsg.getText();
@@ -510,10 +506,16 @@ public class ConversationFragment extends Fragment {
if (this.conversation == null) {
return;
}
+ String oldString = conversation.getNextMessage().trim();
if (this.pastedText == null) {
- this.chatMsg.setText(conversation.getNextMessage());
+ this.chatMsg.setText(oldString);
} else {
- chatMsg.setText(conversation.getNextMessage() + " " + pastedText);
+
+ if (oldString.isEmpty()) {
+ chatMsg.setText(pastedText);
+ } else {
+ chatMsg.setText(oldString + " " + pastedText);
+ }
pastedText = null;
}
int position = chatMsg.length();