It allows you to add a mask to EditText
1.0.0
To use this library in your android project, just simply add the following dependency into your build.gradle
dependencies {
compile 'com.vicmikhailau:MaskedEditText:1.0.0'
}
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:
mEditText.addTextChangedListener(new MaskedWatcher("your_mask"));
For create your mask you need to use following keys:
ANYTHING KEY = *;
DIGIT KEY = #;
UPPERCASE KEY = U;
LOWERCASE KEY = L;
ALPHA NUMERIC KEY = A;
LITERAL KEY = \';
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 "(###)###-##-##".
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.