From 33a09db9de31534e1822c8a10f76c779f2996c77 Mon Sep 17 00:00:00 2001 From: tom79 Date: Thu, 10 Aug 2017 09:54:43 +0200 Subject: [PATCH] Fixes issue when first character starts with @ --- .../fr/gouv/etalab/mastodon/activities/TootActivity.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java index a5b94a6d6..85ce1d611 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java @@ -416,8 +416,11 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc if( currentCursorPosition- (searchLength-1) < 0 || currentCursorPosition == 0 || currentCursorPosition > s.toString().length()) return; - Matcher m = sPattern.matcher(s.toString().substring(currentCursorPosition- (searchLength-1), currentCursorPosition)); - + Matcher m; + if( s.toString().charAt(0) == '@') + m = sPattern.matcher(s.toString().substring(currentCursorPosition- searchLength, currentCursorPosition)); + else + m = sPattern.matcher(s.toString().substring(currentCursorPosition- (searchLength-1), currentCursorPosition)); if(m.matches()) { String search = m.group(3); if (pp_progress != null && pp_actionBar != null) {