Thanks to visit codestin.com
Credit goes to github.com

Skip to content

therealandroid/Mentions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Mentions for Android

This class provides an easily way to create Clickable span area based on a Regex Pattern for basic TextView. The class use SpannableString to build it up.

How it works?

Go to the class and replace the two lines that match the charactere you want by any charactere of your choice, in this case @.

static final String MENTION_CHARACTER = "@";

static final String A_MENTION_REGEX = "\\B@\\w+$";

Simple Usage

   MentionUtil.createMentions(this, "message with people mentioned starting with the character @", textView, new MentionUtil.OnMentionClickListener() {
      @Override
      public void onMentionClick(String textClicked) {
          //You have been clicked in a mentioned name
      }
    });

Example text input

Hello @diogojayme how are you? Im contacting you because I have to presentate you @guilhermedourado my new friend, he is from Brazil and want's to go out today, are you ready?

Exemple text Output

Hello diogojayme how are you? Im contacting you because I have to presentate you guilhermedourado my new friend, he is from Brazil and want's to go out today, are you ready?

Next steps

Customize for accept custom Span styles

About

This repository offers a class that create mentions with clickable events from a String

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages