GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - 8bitDream/MaskedEditText: It allows you to add a mask to EditText

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

80 Commits
80 Commits

Folders and files

NameName
Last commit message
Last commit date
MaskedEditText
MaskedEditText
 
 
app
app
 
 
gradle/wrapper
gradle/wrapper
 
 
resources
resources
 
 
scripts
scripts
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle.kts
build.gradle.kts
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle.kts
settings.gradle.kts
 
 

Repository files navigation

Maven Central GitHub license Android Arsenal

MaskedEditText

It allows you to add a mask to EditText

GIF of its use

Version

5.0.3

Installation

Step 1: Add MavenCentral and Jitpack to your repositories in your project level build.gradle file:

allprojects {
    repositories {
        mavenCentral()
    }
}

Step 2: Add the library as a dependency in your module level build.gradle file:

Groovy:

dependencies {
    implementation 'io.github.vicmikhailau:MaskedEditText:5.0.3'
}

Kotlin:

dependencies {
    implementation("io.github.vicmikhailau:MaskedEditText:5.0.3")
}

Usage

Just add in xml custom MaskedEditText with attribute app:mask="your_mask" like below:

<com.vicmikhailau.maskededittext.MaskedEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:mask="your_mask" />

Or add TextChangedListener for your EditText like in following code:

val formatter = MaskedFormatter("your_mask")
mEditText.addTextChangedListener(MaskedWatcher(formatter, mEditText))

Connect to the MaskedWatcher for your MaskedEditText through:

mMaskedEditText.addMaskedTextChangedListener
mMaskedEditText.doBeforeMaskedTextChanged
mMaskedEditText.doOnMaskedTextChanged
mMaskedEditText.doAfterMaskedTextChanged

Or use MaskedWatcher reference:

maskedWatcher.addTextChangedListener

For create your mask you need to use following keys:

ANYTHING KEY = *
DIGIT KEY = #
UPPERCASE KEY = U
LOWERCASE KEY = L
ALPHA NUMERIC KEY = A
CHARACTER KEY = ?
HEX KEY = H

For example: you would like create a mask for a mobile number in format (029)777-77-77. Just use the simple mask "(###)###-##-##".

If you want to get text without mask just use following code:

  • For getting unmasked text for mEdtMaskedCustom: MaskedEditText just use

    val unamskedString = mEdtMaskedCustom.unMaskedText
    
  • For getting unmasked text for default EditText just use

    val text = mEditText.text.toString()
    val unmaskedString = formatter.formatString(text).unMaskedString
    

Kotlin dependency in pure Java project

Add in your build.gradle: implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" VicMikhailau#27

Fixes and updates

Unfortunately, there is no way to devote much time to the project. Please feel free to Fork the project and add Pull requests. Thanks a lot!

Change Logs

v5.0.3

Updated dependencies and targetSdk to 35.

v5.0.2

Updated dependencies and targetSdk to 34.

v5.0.1

Added convenient MaskedEditText listeners.

v5.0.0

Updated dependencies and targetSdk to 33.

v4.0.7

Fixed InflateException appeared in 4.0.6.

v4.0.6

Updated Gradle and libraries. Changed targetSdkVersion to 31.

v4.0.5

Moved project to the MavenCentral. Changed groupId to io.github.vicmikhailau

v3.1.1

Updated Gradle and libraries.

v3.1.0

Updated Gradle and libraries.

v3.0.4

Fixes (Pull Request #26).

v3.0.3

Removed private attribute of the setMask function (Pull Request #25).

v3.0.2

Changed asserts to safe call (Pull Request #23).

v3.0.1

Moved library to androidx and kotlin.

Licence

Copyright 2021 Victor Mikhailau

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.

About

It allows you to add a mask to EditText

Resources

Readme
License
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.