diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-04-13 21:32:14 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-04-13 21:32:14 +0200 |
commit | e752f5ad1eff417e2b4a9620c94e3e78071cea39 (patch) | |
tree | a1665419d1d22f7aab2b7e70ab3fa9b14ca5b96e | |
parent | eda9c3542d784ac5071240839b94a94343f92444 (diff) |
use comma seperation for multiple mentions
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 7324f27b0..c94e6f4f0 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -871,16 +871,20 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa String oldString = editable.toString().trim(); final int pos = mEditMessage.getSelectionStart(); if (oldString.isEmpty() || pos == 0) { - mEditMessage.getText().insert(0, nick + ": "); + editable.insert(0, nick + ": "); } else { final char before = editable.charAt(pos - 1); final char after = editable.length() > pos ? editable.charAt(pos) : '\0'; if (before == '\n') { editable.insert(pos, nick + ": "); } else { - editable.insert(pos, (Character.isWhitespace(before) ? "" : " ") + nick + (Character.isWhitespace(after) ? "" : " ")); - if (Character.isWhitespace(after)) { - mEditMessage.setSelection(mEditMessage.getSelectionStart() + 1); + if (pos > 2 && editable.subSequence(pos - 2, pos).toString().equals(": ")) { + editable.insert(pos - 2, ", " + nick); + } else { + editable.insert(pos, (Character.isWhitespace(before) ? "" : " ") + nick + (Character.isWhitespace(after) ? "" : " ")); + if (Character.isWhitespace(after)) { + mEditMessage.setSelection(mEditMessage.getSelectionStart() + 1); + } } } } |