socialview
socialview copied to clipboard
Mention not show suggestions
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!
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.
Closed for inactivity.