예제 #1
0
파일: Validator.java 프로젝트: AxellH/docs
  /**
   * Validate a specific EditText.
   *
   * @param editText EditText
   * @param validable Validable
   */
  private void validate(EditText editText, Validable validable) {
    validable.setValidated(true);
    for (ValidatorType validatorType : validable.getValidatorTypes()) {
      if (!validatorType.validate(editText.getEditableText().toString())) {
        if (showErrors) {
          editText.setError(validatorType.getErrorMessage(context));
        }
        validable.setValidated(false);
        break;
      }
    }

    if (validable.isValidated()) {
      editText.setError(null);
    }

    if (onValidationChanged != null) {
      onValidationChanged.onComplete();
    }
  }
예제 #2
0
파일: Validator.java 프로젝트: AxellH/docs
 /**
  * Setter of onValidationChanged.
  *
  * @param onValidationChanged onValidationChanged
  */
 public void setOnValidationChanged(CallbackListener onValidationChanged) {
   this.onValidationChanged = onValidationChanged;
   onValidationChanged.onComplete();
 }