aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-04-13 21:32:14 +0200
committerChristian Schneppe <christian@pix-art.de>2017-04-13 21:32:14 +0200
commite752f5ad1eff417e2b4a9620c94e3e78071cea39 (patch)
treea1665419d1d22f7aab2b7e70ab3fa9b14ca5b96e /src/main/java/de/pixart/messenger/ui
parenteda9c3542d784ac5071240839b94a94343f92444 (diff)
use comma seperation for multiple mentions
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java12
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);
+ }
}
}
}