hanggrian / socialview

Android TextView and EditText with hashtag, mention, and hyperlink support
https://hendraanggrian.github.io/socialview/
Apache License 2.0
322 stars 81 forks source link

Some help to retrieve hashtags and mentions Object and position #87

Closed GrindingOgre closed 10 months ago

GrindingOgre commented 3 years ago

Hi,

before saying anything, i'd like to thank you for this library, because it's saving my life!

I'm in need of some support because i have some specifics that your library doesn't fulfill:

  1. I need to know something more about the mention. I've implemented the Mentionable interface and when i call the mentions method, what the SocialAutoCompleteTextView returns me is a list of String, but i need the source Object and not the String representation... If you can point me in the right direction, i can try to extend SocialAutoCompleteTextView class to have this information...
  2. Is it possible to get the exact position (start and length) of the spans of every mention? If not, is there a way to extract this information? (maybe from the getSpans(...) method on the editable?)
  3. I think this is a bug: when i try to get all the hashtags (via the getHashtags method), it goes in IndexOutOfBoundsException, precisely with this stacktrace:
java.lang.IndexOutOfBoundsException: No group 1
        at java.util.regex.Matcher.group(Matcher.java:458)
        at com.hendraanggrian.appcompat.widget.SocialViewHelper.listOf(SocialViewHelper.java:456)
        at com.hendraanggrian.appcompat.widget.SocialViewHelper.getHashtags(SocialViewHelper.java:353)
        at com.hendraanggrian.appcompat.widget.SocialAutoCompleteTextView.getHashtags(SocialAutoCompleteTextView.java:347)

I don't know if you need some other information about my env, but if needed, i'll try to explain better

PS: Sorry for the bad english... It's not my first language.

hanggrian commented 3 years ago
  1. May I see your source Object that doesn't have a unique string?
  2. This is possible by providing more arguments to SocialView.OnClickListener#onClick, the information is already up there in SocialViewHelper.spanAll.
  3. I will need your test case to help fix these.

I will be exploring the options in the following days. Thanks for your input and don't worry, English isn't my first language too.

ManpreetKaurTuteja commented 3 years ago

onHashtagtextChangelistener not getting called

hanggrian commented 3 years ago

@ManpreetKaurTuteja are you using simple EditText or AutoCompleteTextView?

hanggrian commented 10 months ago

Closed for inactivity.