From 6b7ca5d18468d60551e8ef7a45c641b26561e3e1 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Wed, 30 Jan 2019 22:10:05 +0100 Subject: [PATCH] fix autocomplete of usernames (#1019) --- .../tusky/adapter/MentionTagAutoCompleteAdapter.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/MentionTagAutoCompleteAdapter.java b/app/src/main/java/com/keylesspalace/tusky/adapter/MentionTagAutoCompleteAdapter.java index fad51103..84bef0cc 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/MentionTagAutoCompleteAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/MentionTagAutoCompleteAdapter.java @@ -76,7 +76,7 @@ public class MentionTagAutoCompleteAdapter extends BaseAdapter @Override public CharSequence convertResultToString(Object resultValue) { if (resultValue instanceof AccountResult) { - return ((AccountResult) resultValue).account.getUsername(); + return formatUsername(((AccountResult) resultValue)); } else { return formatHashtag((HashtagResult) resultValue); } @@ -166,6 +166,10 @@ public class MentionTagAutoCompleteAdapter extends BaseAdapter return view; } + private String formatUsername(AccountResult result) { + return String.format("@%s", result.account.getUsername()); + } + private String formatHashtag(HashtagResult result) { return String.format("#%s", result.hashtag); }