mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-26 02:42:16 -05:00
Ignore status characters in front of nicks for the purpose of nick completion
This commit is contained in:
parent
7c7ce7cc41
commit
d4e22f3846
@ -893,7 +893,8 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
|||||||
List<Integer> result = new ArrayList<Integer>();
|
List<Integer> result = new ArrayList<Integer>();
|
||||||
|
|
||||||
for (int i = 0; i < users.length; i++) {
|
for (int i = 0; i < users.length; i++) {
|
||||||
if (users[i].toLowerCase().startsWith(word)) {
|
String nick = removeStatusChar(users[i].toLowerCase());
|
||||||
|
if (nick.startsWith(word)) {
|
||||||
result.add(Integer.valueOf(i));
|
result.add(Integer.valueOf(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -926,6 +927,7 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
|||||||
private void insertNickCompletion(EditText input, String nick) {
|
private void insertNickCompletion(EditText input, String nick) {
|
||||||
int start = input.getSelectionStart();
|
int start = input.getSelectionStart();
|
||||||
int end = input.getSelectionEnd();
|
int end = input.getSelectionEnd();
|
||||||
|
nick = removeStatusChar(nick);
|
||||||
|
|
||||||
if (start == 0) {
|
if (start == 0) {
|
||||||
nick += ":";
|
nick += ":";
|
||||||
@ -953,4 +955,20 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
|||||||
private void openSoftKeyboard(View view) {
|
private void openSoftKeyboard(View view) {
|
||||||
((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
|
((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the status char off the front of a nick if one is present
|
||||||
|
*
|
||||||
|
* @param nick
|
||||||
|
* @return nick without statuschar
|
||||||
|
*/
|
||||||
|
private String removeStatusChar(String nick)
|
||||||
|
{
|
||||||
|
/* Discard status characters */
|
||||||
|
if (nick.startsWith("@") || nick.startsWith("+")
|
||||||
|
|| nick.startsWith("%")) {
|
||||||
|
nick = nick.substring(1);
|
||||||
|
}
|
||||||
|
return nick;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user