Closed madhurtewani closed 7 years ago
There did seem to be some issues with this. I have fixed them here and here. I will release a new version shortly.
With these changes, the library has support for regular expressions, using a regex, you can accomplish this.
For example, this regular expression would match any #hello...
hashtags: #hello([$A-Za-z0-9_-]*)
While this regex would match any hashtags: #([$A-Za-z0-9_-]+)
To apply these within the link builder, you could use:
Link helloHashtag = new Link(Pattern.compile("#hello([$A-Za-z0-9_-]*)"));
Thank you @klinker24.
I will not be able to the following because the text is completely dynamic and won't get to know if the text is having similar use case or not.
Link helloHashtag = new Link(Pattern.compile("#hello([$A-Za-z0-9_-]*)"));
Can you please tell me when would you be releasing the updated version of library with the fix?
I was giving an example of a regular expression usage. There is a matcher for any hashtag in my comment too.
The update will be available whenever maven central releases it. Within the hour usually, sometimes longer, hard to give an exact time
OK, thank you.
Hi @klinker24,
I got the updated library and highlight is working fine but link is not.
Link is still applied on the partial text (hello
as per my example) and only that part is clickable. In click listener the clickedText
returned is only the partial text instead of full text.
Here are some changes: https://github.com/klinker24/Android-TextView-LinkBuilder/commit/c4fa9c7aacf375e85fad8cb0a0004a8a2d62962c
If you could try them out and confirm it works, I will make a build.
Yes, it works completely fine. Thank you.
Ok, I will release it as 1.6.1
, it will be available shortly.
Hi @klinker24,
In a TextView if I add a LinkBuilder that links hashtags or @mentions then second word sometimes doesn't link properly. The use case is when the second word starts with the first word.
Example: Consider following text as contents of TextView.
#hello #helloBuddy #hello_buddy
#hello
is highlighted and linked in all 3 words.Below is the screenshot for same.
Please reply ASAP.