Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vacxe/phonemask
Android library for EditText. Easy way for add phone readability in your project.
https://github.com/vacxe/phonemask
Last synced: 14 days ago
JSON representation
Android library for EditText. Easy way for add phone readability in your project.
- Host: GitHub
- URL: https://github.com/vacxe/phonemask
- Owner: Vacxe
- License: apache-2.0
- Created: 2017-05-17T08:18:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-13T11:22:10.000Z (over 6 years ago)
- Last Synced: 2024-10-03T12:39:28.174Z (about 1 month ago)
- Language: Java
- Size: 151 KB
- Stars: 33
- Watchers: 2
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PhoneMask
PhoneMask is lightweight android library for EditText formatting. Easy way for add phone readability in your project.[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-PhoneMask-green.svg?style=true)](https://android-arsenal.com/details/1/5770)
## How to use it
In Kotlin Just use PhoneMaskManager class
```kotlin
PhoneMaskManager()
.withMask(" (###) ###-##-##")
.withRegion("+7")
.withValueListener(object : ValueListener{
override fun onPhoneChanged(phone: String) {
}
})
.bindTo((findViewById(R.id.text_edit_text) as EditText))
```You can also use this in Java,
```java
new PhoneMaskManager()
.withMask(" (###) ###-##")
.withRegion("+255")
.bindTo((EditText)findViewById(R.id.text_edit_text))
```### About methods
#### Init methods
- **withMask**
(required field)
Init your mask format. Use `#` symbol by default- **withMaskSymbol**
(optional field)
Changing default symbol mask- **withRegion**
(optional field)
Init your region- **withValueListener**
(optional field)
If you want to receive callback from EditText just add ValueListener, and you receive phone string in clear format
(For example: +70009199191)- **withOnFocusChangeListener**
(optional field)
If you want to set OnFocusChangeListener for EditText use this method- **bindTo**
(required calling)
Afrer setup just call this method for binding to `EditText`#### Get methods
- **getPhone**
Return phone in clear format (For example: +70009199191)### Download
```xml
com.github.vacxe
phonemask
1.0.5
pom```
or Gradle:
```groovyrepositories {
jcenter()
}dependencies {
compile 'com.github.vacxe:phonemask:1.0.5'
}
```