fix autocomplete of usernames (#1019)

This commit is contained in:
Konrad Pozniak 2019-01-30 22:10:05 +01:00 committed by GitHub
parent a38319fad0
commit 6b7ca5d184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -76,7 +76,7 @@ public class MentionTagAutoCompleteAdapter extends BaseAdapter
@Override @Override
public CharSequence convertResultToString(Object resultValue) { public CharSequence convertResultToString(Object resultValue) {
if (resultValue instanceof AccountResult) { if (resultValue instanceof AccountResult) {
return ((AccountResult) resultValue).account.getUsername(); return formatUsername(((AccountResult) resultValue));
} else { } else {
return formatHashtag((HashtagResult) resultValue); return formatHashtag((HashtagResult) resultValue);
} }
@ -166,6 +166,10 @@ public class MentionTagAutoCompleteAdapter extends BaseAdapter
return view; return view;
} }
private String formatUsername(AccountResult result) {
return String.format("@%s", result.account.getUsername());
}
private String formatHashtag(HashtagResult result) { private String formatHashtag(HashtagResult result) {
return String.format("#%s", result.hashtag); return String.format("#%s", result.hashtag);
} }