Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AzimoLabs/MaskFormatter
Add text masking functionality to Android EditText. It will prevent user from inserting not allowed signs, and format input as well.
https://github.com/AzimoLabs/MaskFormatter
android hacktoberfest
Last synced: 2 months ago
JSON representation
Add text masking functionality to Android EditText. It will prevent user from inserting not allowed signs, and format input as well.
- Host: GitHub
- URL: https://github.com/AzimoLabs/MaskFormatter
- Owner: AzimoLabs
- License: apache-2.0
- Created: 2016-03-16T10:24:36.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-04-07T08:23:11.000Z (almost 4 years ago)
- Last Synced: 2024-08-05T19:35:25.649Z (6 months ago)
- Topics: android, hacktoberfest
- Language: Java
- Homepage:
- Size: 441 KB
- Stars: 160
- Watchers: 8
- Forks: 30
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-android-ui - https://github.com/AzimoLabs/MaskFormatter
- awesome-android-ui - https://github.com/AzimoLabs/MaskFormatter
README
# MaskFormatter
MaskFormatter adds mask functionality to your EditText. It will prevent user from inserting not allowed signs, and format input as well.![MaskFormatter](https://raw.githubusercontent.com/AzimoLabs/MaskFormatter/master/art/screenshot.png)
![Animated](https://raw.githubusercontent.com/AzimoLabs/MaskFormatter/master/art/animated.gif)
Mask should be built from characters listed below (java regex associated to character given after colon):
```
'9': '[0-9]',
'8': '[0-8]',
'7': '[0-7]',
'6': '[0-6]',
'5': '[0-5]',
'4': '[0-4]',
'3': '[0-3]',
'2': '[0-2]',
'1': '[0-1]',
'0': '[0]','*': '.',
'W': '\W',
'd': '\d',
'D': '\D',
's': '\s',
'S': '\S','A': '[A-Z]',
'a': '[a-z]',
'Z': '[A-ZÇÀÁÂÃÈÉÊẼÌÍÎĨÒÓÔÕÙÚÛŨ]',
'z': '[a-zçáàãâéèêẽíìĩîóòôõúùũüû]',
'@': '[a-zA-Z]',
'#': '[a-zA-ZçáàãâéèêẽíìĩîóòôõúùũüûÇÀÁÂÃÈÉÊẼÌÍÎĨÒÓÔÕÙÚÛŨ]','%': '[A-Z0-9]',
'w': '[a-zA-Z0-9]'
```# Usage
In your `build.gradle`:```gradle
dependencies {
compile 'com.azimolabs.maskformatter:maskformatter:0.2'
}```
Library is distributed via jCenter Maven repository. Make sure that you have it in your root gradle config:
```gradle
allprojects {
repositories {
jcenter()
}
}
```Then you can use it like this:
```java
public MainActivity extends Activity {private static final IBAN_MASK = "AA 99 9999 AAAA wwww wwww wwww";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sample_layout);EditText ibanEditText = (EditText) findViewById(R.id.etIban);
MaskFormatter ibanMaskFormatter = new MaskFormatter(IBAN_MASK, ibanEditText);
ibanEditText.addTextChangedListener(ibanMaskFormatter);
}}
```And make sure that you disabled suggestions from used EditText:
```xml
```
# License
```
Copyright (C) 2016 AzimoLabsLicensed 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 athttp://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.
```# Towards financial services available to all
We’re working throughout the company to create faster, cheaper, and more available financial services all over the world, and here are some of the techniques that we’re utilizing. There’s still a long way ahead of us, and if you’d like to be part of that journey, check out our [careers page](https://bit.ly/3vajnu6).