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

Seting pattern doesnt work. #90

Closed uzaysan closed 3 years ago

uzaysan commented 3 years ago

I need a costum regex for usernames so I wanted to change username patter by using setMentionPattern method provided in version 0.3-rc.

But that doesnt make any difference. Autocomplete edittext doesnt use my pattern. It still uses old pattern.

This is how I set pattern commenttext.setMentionPattern(Pattern.compile("(^|[^\\w])@([\\w\\_\\.]+)"));

salted-kang commented 3 years ago

I want to fix this also. It should be public void setMentionPattern(@Nullable Pattern pattern) { if (mentionPattern != pattern) { mentionPattern = pattern; recolorize(); } }

ErfanDP commented 3 years ago

here is the problem in SocialViewHelper @Override public void setMentionPattern(@Nullable Pattern pattern) { if (mentionPattern != null) { mentionPattern = pattern; recolorize(); } }

mentionPattern is always null and can't be changed setMentionPattern() will call this but do nothing

hanggrian commented 3 years ago

Thank you very much for pointing out this bug. It has been fixed in latest Sonatype SNAPSHOT version.

idnael commented 2 years ago

I'm also having this problem and can't see the fix. How can I use the "latest SNAPSHOT version"? I have this in my build.gradle files:

allprojects {
    repositories {
        mavenCentral()
        google()
        jcenter()
        maven { url "https://jitpack.io" }

and implementation "com.hendraanggrian.appcompat:socialview:0.3-rc1"

hanggrian commented 2 years ago

I'm sorry, since jcenter shutted down, I can't find a time to reupload to maven central. But it is already in snapshot repositories, so what you need to do is add maven url https://s01.oss.sonatype.org/content/repositories/snapshots to that DSL.

Then see which versions are available in snapshot builds.