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.Intent;
|
||||
import android.content.IntentSender.SendIntentException;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.v13.view.inputmethod.InputConnectionCompat;
|
||||
|
@ -34,7 +32,6 @@ import android.widget.AbsListView;
|
|||
import android.widget.AbsListView.OnScrollListener;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ListView;
|
||||
import android.widget.PopupMenu;
|
||||
|
@ -840,16 +837,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue