Skip to content

A smart TextView for android that detects #hashtags, @mentions, URLs, emails, phone numbers and more.

License

Notifications You must be signed in to change notification settings

priyankvex/SmartTextView

Repository files navigation

SmartTextView

A smart TextView for android that detects #hashtags, @mentions, URLs, emails, phone numbers and more.

device-2016-08-11-181532.png

Features

  • Detect emails, mobile numbers, URLs
  • Detect #hash_tags and @mentions
  • Use default intents or set custom callbacks.
  • Set different colors for each pattern.

Usage

compile 'com.priyankvex:smarttextview:1.0.1'

In layout xml file

  <com.wordpress.priyankvex.smarttextview.SmartTextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="9pt"
        android:id="@+id/textView"
        />

In java Activity or Fragment

mSmartTextView = (SmartTextView) findViewById(R.id.textView);
        mSmartTextView.setEmailColorCode("#3cb371");
        mSmartTextView.setPhoneNumberColorCode("#ff33aa");
        mSmartTextView.setHashTagColorCode("#f37735");
        mSmartTextView.setUrlColorCode("#ffc425");
        mSmartTextView.setMentionColorCode("#57b884");
        mSmartTextView.setDetectMentions(true);
        mSmartTextView.setDetectHashTags(true);
        mSmartTextView.setText(sampleText);
        mSmartTextView.setSmartTextCallback(this);

To use custom callbacks

implements SmartTextCallback

About

A smart TextView for android that detects #hashtags, @mentions, URLs, emails, phone numbers and more.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages