All Projects → armcha → Autolinktextviewv2

armcha / Autolinktextviewv2

AutoLinkTextView is a TextView that supports automatic detection of Hashtags (#), Mentions (@) , URLs (http://), Phone Nubers and emails

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Autolinktextviewv2

Regex Benchmark
It's just a simple regex benchmark of different programming languages.
Stars: ✭ 171 (-28.15%)
Mutual labels:  regex
Regexpu
A source code transpiler that enables the use of ES2015 Unicode regular expressions in ES5.
Stars: ✭ 201 (-15.55%)
Mutual labels:  regex
Rainbow
🌈 Colorize commands output or STDIN using patterns.
Stars: ✭ 217 (-8.82%)
Mutual labels:  regex
Html Css Class Completion
🍫 Visual Studio Code extension that provides CSS class name completion for the HTML class attribute based on the CSS files in your workspace
Stars: ✭ 174 (-26.89%)
Mutual labels:  regex
Common Regex
🎃 常用正则表达式 - 收集一些在平时项目开发中经常用到的正则表达式。
Stars: ✭ 2,488 (+945.38%)
Mutual labels:  regex
Retina
A regex-based programming language.
Stars: ✭ 202 (-15.13%)
Mutual labels:  regex
Js Tokens
Tiny JavaScript tokenizer.
Stars: ✭ 166 (-30.25%)
Mutual labels:  regex
Grab
experimental and very fast implementation of a grep
Stars: ✭ 230 (-3.36%)
Mutual labels:  regex
Fancy Regex
Rust library for regular expressions using "fancy" features like look-around and backreferences
Stars: ✭ 199 (-16.39%)
Mutual labels:  regex
Learn gnugrep ripgrep
Example based guide to mastering GNU grep and ripgrep
Stars: ✭ 204 (-14.29%)
Mutual labels:  regex
Sd
Intuitive find & replace CLI (sed alternative)
Stars: ✭ 2,755 (+1057.56%)
Mutual labels:  regex
Lolcate Rs
Lolcate -- A comically fast way of indexing and querying your filesystem. Replaces locate / mlocate / updatedb. Written in Rust.
Stars: ✭ 191 (-19.75%)
Mutual labels:  regex
Regex Automata
A low level regular expression library that uses deterministic finite automata.
Stars: ✭ 203 (-14.71%)
Mutual labels:  regex
Regex.persian.language
Collection of Regex for validating, filtering, sanitizing and finding Persian strings
Stars: ✭ 172 (-27.73%)
Mutual labels:  regex
Tj
stdin line timestamps. single binary, no dependencies. osx & linux & windows. plays well with jq.
Stars: ✭ 218 (-8.4%)
Mutual labels:  regex
Grex
A command-line tool and library for generating regular expressions from user-provided test cases
Stars: ✭ 4,847 (+1936.55%)
Mutual labels:  regex
Pluck
Pluck text in a fast and intuitive way 🐓
Stars: ✭ 202 (-15.13%)
Mutual labels:  regex
Swaglyrics For Spotify
📃 Get lyrics of currently playing Spotify song so you don't sing along with the wrong ones and embarrass yourself later. Very fast.
Stars: ✭ 235 (-1.26%)
Mutual labels:  regex
Pyswiftyregex
Easily deal with Regex in Swift in a Pythonic way
Stars: ✭ 227 (-4.62%)
Mutual labels:  regex
Stringi
THE String Processing Package for R (with ICU)
Stars: ✭ 204 (-14.29%)
Mutual labels:  regex

AutoLinkTextView V2

AutoLinkTextViewV2 is the new version of the AutoLinkTextView.

The main differences between the old and new version are

  • Fully migration to Kotlin
  • Added several new features
  • Some improvements and fixes

It supports automatic detection and click handling for

  • Hashtags (#)
  • Mentions (@)
  • URLs (https://)
  • Phone Numbers
  • Emails
  • Multiple Custom Regex

.

The current minSDK version is API level 16.

Download sample apk

Features

  • Default support for Hashtag, Mention, Link, Phone number and Email
  • Support for custom types via regex
  • Transform url to short clickable text
  • Ability to apply multiple spans to any mode
  • Ability to set specific text color
  • Ability to set pressed state color

Download

Gradle:

implementation 'com.github.armcha:AutoLinkTextViewV2:3.0.0'

Setup and Usage

Add AutoLinkTextView to your layout

<io.github.armcha.autolink.AutoLinkTextView
    android:id="@+id/autolinkTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
val autoLinkTextView = findViewById<AutoLinkTextView>(R.id.autolinkTextView);

Add one or multiple modes

autoLinkTextView.addAutoLinkMode(
                MODE_HASHTAG,
                MODE_URL)

Add url transformations for transforming them to short clickable text

autoLinkTextView.addUrlTransformations(
                "https://google.com" to "Google",
                "https://en.wikipedia.org/wiki/Wear_OS" to "Wear OS")

Or you can attach urlProcessor and transform it

autoLinkTextView.attachUrlProcessor { originalUrl: String ->
    when {
        originalUrl.startsWith("https://en.wikipedia") -> "Wiki"
        originalUrl.contains("android") -> "Android"
        else -> originalUrl
    }
}

Add one or multiple spans to specific mode

autoLinkTextView.addSpan(MODE_URL, StyleSpan(Typeface.ITALIC), UnderlineSpan())
autoLinkTextView.addSpan(MODE_HASHTAG, UnderlineSpan(), TypefaceSpan("monospace"))

Set AutoLinkTextView click listener

autoLinkTextView.onAutoLinkClick { item: AutoLinkItem ->
}

Set text to AutoLinkTextView

autoLinkTextView.text = getString(R.string.android_text)

Customizing

All possible modes

MODE_PHONE

MODE_HASHTAG

MODE_URL

MODE_MENTION

MODE_EMAIL

MODE_CUSTOM

For use of custom mode you can add multiple custom regex

val custom = MODE_CUSTOM("\\sAndroid\\b", "\\sGoogle\\b")

You can change text color for the specific mode

autoLinkTextView.hashTagModeColor = ContextCompat.getColor(this, R.color.color2)
autoLinkTextView.phoneModeColor = ContextCompat.getColor(this, R.color.color3)

You can also change pressed text color

autoLinkTextView.pressedTextColor = ContextCompat.getColor(this, R.color.pressedTextColor)

Contact 📖

▶️ Email: [email protected]

▶️ LinkedIn: https://www.linkedin.com/in/chatikyan

▶️ Medium: https://medium.com/@chatikyan

▶️ Twitter: https://twitter.com/ChatikyanArman

License

  Auto Link TextView V2 library for Android
  Copyright (c) 2021 Arman Chatikyan (https://github.com/armcha/AutoLinkTextViewV2).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].