use comma seperation for multiple mentions
This commit is contained in:
parent
65b3655a8b
commit
d91c314ac2
|
@ -9,8 +9,6 @@ import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentSender.SendIntentException;
|
import android.content.IntentSender.SendIntentException;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.support.v13.view.inputmethod.InputConnectionCompat;
|
import android.support.v13.view.inputmethod.InputConnectionCompat;
|
||||||
|
@ -34,7 +32,6 @@ import android.widget.AbsListView;
|
||||||
import android.widget.AbsListView.OnScrollListener;
|
import android.widget.AbsListView.OnScrollListener;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.PopupMenu;
|
import android.widget.PopupMenu;
|
||||||
|
@ -840,16 +837,20 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
String oldString = editable.toString().trim();
|
String oldString = editable.toString().trim();
|
||||||
final int pos = mEditMessage.getSelectionStart();
|
final int pos = mEditMessage.getSelectionStart();
|
||||||
if (oldString.isEmpty() || pos == 0) {
|
if (oldString.isEmpty() || pos == 0) {
|
||||||
mEditMessage.getText().insert(0, nick + ": ");
|
editable.insert(0, nick + ": ");
|
||||||
} else {
|
} else {
|
||||||
final char before = editable.charAt(pos - 1);
|
final char before = editable.charAt(pos - 1);
|
||||||
final char after = editable.length() > pos ? editable.charAt(pos) : '\0';
|
final char after = editable.length() > pos ? editable.charAt(pos) : '\0';
|
||||||
if (before == '\n') {
|
if (before == '\n') {
|
||||||
editable.insert(pos, nick + ": ");
|
editable.insert(pos, nick + ": ");
|
||||||
} else {
|
} else {
|
||||||
editable.insert(pos,(Character.isWhitespace(before)? "" : " ") + nick + (Character.isWhitespace(after) ? "" : " "));
|
if (pos > 2 && editable.subSequence(pos-2,pos).toString().equals(": ")) {
|
||||||
if (Character.isWhitespace(after)) {
|
editable.insert(pos-2,", "+nick);
|
||||||
mEditMessage.setSelection(mEditMessage.getSelectionStart()+1);
|
} else {
|
||||||
|
editable.insert(pos, (Character.isWhitespace(before) ? "" : " ") + nick + (Character.isWhitespace(after) ? "" : " "));
|
||||||
|
if (Character.isWhitespace(after)) {
|
||||||
|
mEditMessage.setSelection(mEditMessage.getSelectionStart() + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue