Giter Site home page Giter Site logo

abnerescocio / edittext-mask Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 4.04 MB

Put masks to edit fields with this library. It is so easy!

License: MIT License

Kotlin 98.32% Java 1.68%
android-library kotlin-library kotlin maskededittext mask library edittext edittextview android

edittext-mask's Introduction

edittext-mask

Put masks to edit fields with this library. It is so easy!

Select one inside of various masks for your edittext and write something like this app:mask="phone"

Look this followings steps to more details

How to add

Step 1. Add the JitPack repository to your build file

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2. Add the dependency

dependencies {
    implementation 'com.github.abnerescocio:edittext-mask:**version**'
}

How to use

Step 1. Use the class TextInputEditTextMask on your xml layout

...

    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <com.abnerescocio.lib.TextInputEditTextMask
            android:id="@+id/text_input_edit_text_mask"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:mask="email"
            app:mask_errorMsg="Invalid email"
            app:regex_auxiliary="^(?!.*test).*$"
            app:regex_auxiliary_errorMsg="You can't use test"
            app:required="true"
            app:required_errorMsg="Required field*"
            />

    </android.support.design.widget.TextInputLayout>

...

Use of required field

screenshot1

Use of email mask

screenshot2

Use of regex auxiliary

screenshot3

Step 2. The use of attrs

Mask Example
phone 85 98765-4321
email [email protected]
credit card 2236 9958 4578 5131
cpf 986.909.630-14
cnpj 32.338.068/0001-71
cep 60650-140
ip 192.168.1.10
web url www.google.com
Regex auxliary Example
Can't use test ^(?!.*test).*$
Need input 5 characters \d{5,}
Use just letters [a-zA-Z]
Use just numbers [0-9]
Required Example
Need be true or false

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.