socialview icon indicating copy to clipboard operation
socialview copied to clipboard

Some help to retrieve hashtags and mentions Object and position

Open GrindingOgre opened this issue 4 years ago • 3 comments

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.

GrindingOgre avatar Sep 23 '20 16:09 GrindingOgre

  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.

hanggrian avatar Jun 08 '21 20:06 hanggrian

onHashtagtextChangelistener not getting called

ManpreetKaurTuteja avatar Jun 29 '21 10:06 ManpreetKaurTuteja

@ManpreetKaurTuteja are you using simple EditText or AutoCompleteTextView?

hanggrian avatar Jun 30 '21 19:06 hanggrian

Closed for inactivity.

hanggrian avatar Aug 29 '23 19:08 hanggrian