Giter Club home page Giter Club logo

Comments (24)

ragunathjawahar avatar ragunathjawahar commented on August 14, 2024

This is indeed essential and valid.

from android-saripaar.

lwloon avatar lwloon commented on August 14, 2024

would be great if added this feature, plus one.

from android-saripaar.

raghunathj avatar raghunathj commented on August 14, 2024

A

from android-saripaar.

raghunathj avatar raghunathj commented on August 14, 2024

N

from android-saripaar.

raghunathj avatar raghunathj commented on August 14, 2024

Y

from android-saripaar.

ceokin avatar ceokin commented on August 14, 2024

Does anyone know if that fixes? Any way to add custom rules prioritizing

from android-saripaar.

ragunathjawahar avatar ragunathjawahar commented on August 14, 2024

@ceokin I am working on Saripaar v2, this and a lot of other issues will be addressed in the upcoming version. Plus a lot of new features :)

from android-saripaar.

FabianShallari avatar FabianShallari commented on August 14, 2024

If this is any help, for everyone that wants custom rules ordering, a quick fix would be to define a rule using a Regex.

from android-saripaar.

ceokin avatar ceokin commented on August 14, 2024

ragunathjawahar: I think the library is very good. I would like to know when you are going to update the library. Thank you.

from android-saripaar.

ragunathjawahar avatar ragunathjawahar commented on August 14, 2024

@ceokin I am experimenting with a few API designs, should be up in a week or two.

from android-saripaar.

ceokin avatar ceokin commented on August 14, 2024

@ragunathjawahar Thank you! I'll be waiting

from android-saripaar.

jhonvidal avatar jhonvidal commented on August 14, 2024

Thanks eagerly awaiting !!

from android-saripaar.

ragunathjawahar avatar ragunathjawahar commented on August 14, 2024

@almozavr @lwloon @raghunathj @ceokin @FabianShallari @jhonvidal Available in v2. Check out the v2 branch.

from android-saripaar.

gmarques33 avatar gmarques33 commented on August 14, 2024

Hi,

it`s possible to define the validation order with v2? If yes, how?

from android-saripaar.

ragunathjawahar avatar ragunathjawahar commented on August 14, 2024

@gmarques33, Just add the @Order annotation on all your views and add a quick rule to a view using validator.put(View, QuickRule...)

from android-saripaar.

jhonvidal avatar jhonvidal commented on August 14, 2024

before : validator.put(editText, Rules.required(Messages.ES_REQUERID_FIELD, true));
after : validator.put(View, QuickRule...) ??? :|

from android-saripaar.

jhonvidal avatar jhonvidal commented on August 14, 2024

public class V_RadioGroupButton extends Rule {

/**
 * Creates a new validation Rule.
 *
 * @param failureMessage The failure message associated with the Rule.
 */
public V_RadioGroupButton(String failureMessage) {
    super(failureMessage);
}

@Override
public boolean isValid(RadioGroup view) {
    view.setBackgroundColor(Color.WHITE);
    return view.getCheckedRadioButtonId() > 0;
}

}

How to QuickRule? :( documentation please

from android-saripaar.

ragunathjawahar avatar ragunathjawahar commented on August 14, 2024

@jhonvidal You need to use v2 of the library to use ordering with QuickRules.

from android-saripaar.

jhonvidal avatar jhonvidal commented on August 14, 2024

Thanks for responding, I'm using the v2, the problem is how to interpret the rules programming code

from android-saripaar.

ragunathjawahar avatar ragunathjawahar commented on August 14, 2024
@NotEmpty(sequence = 1)
@Email(sequence = 2)
// We are going to add a new QuickRule with a sequence number '3'
@Order(1)
private EditText mEmailEditText;

@Password
@Order(2)
private EditText mPassword;

@ConfirmPassword
@Order(3)
private EditText mConfirmPassword;

// ----------------------------------------------------------------------------------------------------------
// Possibly inside your onCreate(Bundle) method....
validator.put(mEmailEditText, new AllowMyDomainOnlyQuickRule(3));

// ----------------------------------------------------------------------------------------------------------
// This is your quick rule, you can also instantiate an anonymous one
static class AllowMyDomainOnlyQuickRule extends QuickRule {
    // Code ...
}

Please check this comment for a complete idea. Ordering and sequenceing is different in v2 from v1's order attribute.

from android-saripaar.

jhonvidal avatar jhonvidal commented on August 14, 2024

Great help, thank you very much !!! @ragunathjawahar

from android-saripaar.

ragunathjawahar avatar ragunathjawahar commented on August 14, 2024

@jhonvidal You're welcome :)

from android-saripaar.

jhonvidal avatar jhonvidal commented on August 14, 2024

a detail :
these lines :

@notempty(sequence = 1)
@Email(sequence = 2)
@order(1)
private EditText mEmailEditText;

How is interpreted programming in code? please an example of native rules

example in V1 :
validator.put(editText, Rules.checked(Messages.ES_REQUERID_FIELD, true));

in V2 : Rules.checked ???

EditText editText = new EditText(this);
..............

:) Thank

from android-saripaar.

jhonvidal avatar jhonvidal commented on August 14, 2024

I did this for required field :

public class AllowRequiredQuickRule extends QuickRule {

    private static AllowRequiredQuickRule instance = null;

    public static AllowRequiredQuickRule getInstance(int i) {
        if (instance == null) {
            instance = new AllowRequiredQuickRule(i);
        }
        return instance;
    }

    public AllowRequiredQuickRule(int i) {
        super(i);
    }

    @Override
    public boolean isValid(View view) {
        return false;
    }

    @Override
    public boolean isValid(Object o) {
        EditText editText = (EditText) o;
        return !editText.getText().toString().isEmpty();
    }

    @Override
    public String getMessage(Context context) {
        return Messages.ES_REQUERID_FIELD;
    }
}

👍

from android-saripaar.

Related Issues (20)

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.