MaskedEditText


Source link: https://github.com/VicMikhailau/MaskedEditText

MaskedEditText

It allows you to add a mask to EditText

Version

2.0.3

Installation

To use this library in your android project, just simply add the following dependency into your build.gradle

dependencies {

  compile 'com.vicmikhailau:MaskedEditText:2.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:

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

Object of MaskedWatcher class has got a weakreference to formatter object, so you must to conside this.

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 MaskedEditText mEdtMaskedCustom just use

    String unamskedString = mEdtMaskedCustom.getUnMaskedString();
    
  • For getting unmasked text for default EditText just use

    String text = mEditText.getText().toString();
     String unmaskedString = formatter.formatString(text).getUnMaskedString();
    

Change Logs

v2.0.3

Bug with getting ?redit ?ard mask was fixed (issue #13).

v2.0.2

Bug with getting unmasked string was fixed (issue #11).

v2.0.1

Bug with mask was fixed.

v2.0.0

Main logic was updated. Bugs with deleting and changing characters inside masked EditText was fixed

v1.1.2

Fixed crash for getting unmasked text

v1.1.1

Superclass for MaskedEditText was changed to AppCompatEditText, which supports compatible features on older version of the platform

v1.1.0

Ability to get unmasked text (text without mask) was added

v1.0.0

Initial version

Licence

Copyright 2016 Vic 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.

Resources

Demo project with drawing animation.

A simple, unified fingerprint authentication library for Android with ReactiveX extensions.

Fingerprint authentication on Android is a mess. This library unifies the different available APIs, deals with the idiosyncrasies of each, and adds an optional reactive interface.

A powerful Android library that provides highly-customizable widgets (with smart defaults) to easily add social-media-esque mention (aka tag) support to your app.

Android In-App Billing Library which provides several Rx Methods for Purchasing, Consuming and Listing Products Based on the initial work of Anjlab.

A simple implementation of swipe card like StreetView.

Show/Hide Password EditText is a very simple extension of Android's EditText that puts a clickable hide/show icon in the right hand side of the EditText that allows showing of the password.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes