Coder Social home page Coder Social logo

anderscheow / validator Goto Github PK

View Code? Open in Web Editor NEW
126.0 7.0 12.0 387 KB

A tool to validate text inside TextInputLayout

License: MIT License

Java 0.10% Kotlin 99.90%
edittext validation validator android android-library textinputlayout textinputedittext

validator's People

Contributors

anderscheow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

validator's Issues

Hi , About the Validator.kt

Line 51 code:
val value = (editText?.text ?: validation.textInput).toString()
It should be changed to,
val value = (editText?.text ?: validation.textInput?.text).toString()

Password confirmation validation rule proposal

This is a suggestion to add PasswordMatchRule for "confirm password" behaviours, along with withPasswordConfirmation(...) extensions.

Code follows:

class PasswordMatchRule(private val passwordInput: EditText, errorRes: Int) : BaseRule(errorRes) {

    override fun validate(value: String?): Boolean {
        return passwordInput.text.toString() == value
    }

}

Simple checkbox validation

CheckBox class also has "setError(...)/getError(...)" calls which set error drawable, albeit without text.

We could extend Validation class to support them as many input forms also have checkboxes, e.g., "I accept EULA", "I confirm I'm above 18" or "I agree to sell my kidney".

What do you think?

NotEqualTo Base Rule not Working Correctly

The NotEqualRuleand EqualRule are not working for dynamic texts. For Example

Validation passwordConfirmValidation = new Validation(confirmPasswordWrapper).add(new NotEqualRule(password.getText(),"Passwords Are not equal"));

This Doesn't Work. and If you remove the Custom error, It says: The value is not equal to '' as error text

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.