thyrlian/AwesomeValidation

Individual Validation On Losing Focus

RayyanTahir opened this issue · 2 comments

Hi, thank you for this awesome library. I wanted to know if there was a way to validate individual edittexts when their focus is lost.

Thank you.

Actually you have a quite special use case. But it should be achievable by using CustomValidation. Something like below:

mAwesomeValidation.addValidation(activity, R.id.your_edittext, new CustomValidation() {
    @Override
    public boolean compare(ValidationHolder validationHolder) {
        if ( validationHolder.getView().getId() == activity.getCurrentFocus().getId() ) {
            return true;
        } else {
            return false;
        }
    }
}, new CustomValidationCallback() {
    @Override
    public void execute(ValidationHolder validationHolder) {
        // your custom validation callback
    }
}, new CustomErrorReset() {
    @Override
    public void reset(ValidationHolder validationHolder) {
        // your custom error reset
    }
}, R.string.err_msg_for_edittext);

Just give a try and let me know if it works or not.

Hi @RayyanTahir, any news?