Skip to content

Highlights various information (like credit cards, phone numbers, number values) in TextView and adds actions on it

License

Notifications You must be signed in to change notification settings

StevenRudenko/OmniText

Repository files navigation

License

OmniText

Highlights various information (like credit cards, phone numbers, number values) in TextView and adds actions on it.

Definition of omni-: All, Universally

Example

OmniText Disabled OmniText Enabled

Installation

  1. Put Github username and token with read:packages scope into local.properties file:
gpr.user=<github username>
gpr.key=<token>
  1. Add Github Maven repository to the root build.gradle script:
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

allprojects {
    repositories {
        ...
        maven {
            url "https://maven.pkg.github.com/StevenRudenko/OmniText"
            credentials {
                username properties.getProperty("gpr.user")
                password properties.getProperty("gpr.key")
            }
        }
    }
}
  1. Add dependency to app build.gradle
implementation "com.github.stevenrudenko:omnitext:1.0.0"

Usage

Include the OmniTextView into layout and use it as standard TextView:

<com.github.stevenrudenko.omnitext.OmniTextView
    android:id="@+id/omniText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

To subscribe for an omni-actions, add next tines into Activity or Fragment code:

val omniText = view.findViewById<OmniTextView>(R.id.omniText)
omniText.onOmniAction = { omni ->
    // use omni data here
}

Features

There are next omni parsers available:

  • Custom text wrapped with tag: {omni}Text Here{/onmi}
  • Numbers: 12.45, 0.23, 244532
  • Phone numbers: +1-234-567-89-00
  • Credit cards (American Express, MasterCard, Visa, etc.): 371449635398431, 4012 8888 8888 1881, 6011-0009-9013-9424

About

Highlights various information (like credit cards, phone numbers, number values) in TextView and adds actions on it

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages