Smarter nickname highlight insert in confernces
This commit is contained in:
parent
1ac5be4855
commit
3e3451bcff
|
@ -287,14 +287,11 @@ public class ConversationFragment extends Fragment {
|
||||||
|
|
||||||
protected void highlightInConference(String nick) {
|
protected void highlightInConference(String nick) {
|
||||||
String oldString = mEditMessage.getText().toString().trim();
|
String oldString = mEditMessage.getText().toString().trim();
|
||||||
if (oldString.isEmpty()) {
|
if (oldString.isEmpty() || mEditMessage.getSelectionStart() == 0) {
|
||||||
mEditMessage.setText(nick + ": ");
|
mEditMessage.getText().insert(0, nick + ": ");
|
||||||
} else {
|
} else {
|
||||||
mEditMessage.setText(oldString + " " + nick + " ");
|
mEditMessage.getText().insert(mEditMessage.getSelectionStart(), nick + " ");
|
||||||
}
|
}
|
||||||
int position = mEditMessage.length();
|
|
||||||
Editable etext = mEditMessage.getText();
|
|
||||||
Selection.setSelection(etext, position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue