https://github.com/techery/viewvalidators
https://github.com/techery/viewvalidators
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/techery/viewvalidators
- Owner: techery
- Created: 2015-11-16T13:35:09.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-17T11:57:16.000Z (over 10 years ago)
- Last Synced: 2025-05-07T20:18:53.234Z (about 1 year ago)
- Language: Java
- Size: 104 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ViewValidators
ViewValidators is an useful library based on rxJava for performance validation functional in several steps!
During validation ViewValidations can control the state (enable/disable) of the view by `SimpleEnabledValidationSubscriber`
or check the correctness of the data with time delay (`InputValidatorComposer`)
# Available functional:
1 String Validator
2 Email Validator
3 Phone Validator
4 Length Validator
5 Equality Validator
6 Non Empty Validator
7 Empty Validator
8 Empty Or Validator
9 All Valid Validator
10 First Wrong Validator
11 All Invalid Validator
# Sample
``` groovy
formValidator = new FormValidator();
formValidator
.add(WidgetValidators.emailValidator(RxTextView.textChangeEvents(emailView).skip(1))
.withError("Incorrect email")
.result())
.compose(new InputValidatorComposer())
.compose(this.bindToLifecycle())
.subscribe(new SimpleTextValidationSubscriber());
formValidator
.add(WidgetValidators.lengthValidator(RxTextView.textChangeEvents(passwordView), Validations.GTELengthValidation.of(minLength))
.withError("Incorrect password")
.result())
.compose(new InputValidatorComposer(TIME_DELAY_IN_MILLISECONDS))
.compose(this.bindToLifecycle())
.subscribe(new SimpleTextValidationSubscriber());
formValidator.allCombined(signInButton)
.startWith(ValidationResult.of(ValidationResult.ValidationStatus.ERROR, signInButton))
.subscribe(new SimpleEnabledValidationSubscriber());
```
# Installation
``` groovy
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.3'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
}
}
...
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
...
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.techery:ViewValidators:0.1.2'
...
}
```