Merge pull request #400 from xsrc/development

Smarter nickname highlight insert in confernces
This commit is contained in:
Daniel Gultsch 2014-08-31 17:40:29 +02:00
commit 4793081c2c
1 changed files with 3 additions and 6 deletions

View File

@ -287,14 +287,11 @@ public class ConversationFragment extends Fragment {
protected void highlightInConference(String nick) {
String oldString = mEditMessage.getText().toString().trim();
if (oldString.isEmpty()) {
mEditMessage.setText(nick + ": ");
if (oldString.isEmpty() || mEditMessage.getSelectionStart() == 0) {
mEditMessage.getText().insert(0, nick + ": ");
} else {
mEditMessage.setText(oldString + " " + nick + " ");
mEditMessage.getText().insert(mEditMessage.getSelectionStart(), nick + " ");
}
int position = mEditMessage.length();
Editable etext = mEditMessage.getText();
Selection.setSelection(etext, position);
}
@Override