An open API service indexing awesome lists of open source software.

https://github.com/techery/viewvalidators


https://github.com/techery/viewvalidators

Last synced: 10 months ago
JSON representation

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'
...
}
```