Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention not show suggestions #63

Closed
vsoftphuong opened this issue May 7, 2019 · 2 comments
Closed

Mention not show suggestions #63

vsoftphuong opened this issue May 7, 2019 · 2 comments

Comments

@vsoftphuong
Copy link

vsoftphuong commented May 7, 2019

In class SocialAutoCompleteTextView in line 42, event onTextChanged it have error, you should use my code, my code is working well.

if (!TextUtils.isEmpty(s) && start < s.length()) { switch (s.charAt(start)) { case '#': if (getAdapter() != hashtagAdapter) { setAdapter(hashtagAdapter); } break; case '@': if (getAdapter() != mentionAdapter) { setAdapter(mentionAdapter); } break; } }

==> My solution:

if (!TextUtils.isEmpty(s) && s.length()>=2) { String string = s.toString(); String[] words = string.split(" "); if (words.length > 0) { String lastWord = words[words.length - 1]; //#h, @t if(lastWord.length()>=2){ if (lastWord.charAt(0) == '#') { String keyword = lastWord.substring(1); if (getAdapter() != hashtagAdapter) { setAdapter(hashtagAdapter); } } else if (lastWord.charAt(0) == '@') { String keyword = lastWord.substring(1); if (getAdapter() != mentionAdapter) { setAdapter(mentionAdapter); } } } } }

Hope to help improve your code!
Thanks your project, it is very good!

@hanggrian
Copy link
Owner

I get a lot of issue reports for this library, but unfortunately not much for code suggestion. So thanks for your help.

I admit that the text watcher logic could be better, it's even reported in #7.

What would be great is that you could create a pull request submitting your code, also run all tests before submission.

Otherwise it might take me a while to apply your fixes, in the meantime I'm keeping this open.

@hanggrian
Copy link
Owner

Closed for inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants