-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fbea5e6
commit 622c3b6
Showing
13 changed files
with
268 additions
and
84 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
convalida-annotations/src/main/java/convalida/annotations/ConfirmEmailValidation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package convalida.annotations; | ||
|
||
import android.support.annotation.StringRes; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.RetentionPolicy.CLASS; | ||
|
||
/** | ||
* @author Wellington Costa on 07/02/18. | ||
*/ | ||
@Target(FIELD) | ||
@Retention(CLASS) | ||
public @interface ConfirmEmailValidation { | ||
|
||
@StringRes int value(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
convalida-validators/src/main/java/convalida/validators/ConfirmEmailValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package convalida.validators; | ||
|
||
import android.support.design.widget.TextInputLayout; | ||
import android.widget.EditText; | ||
|
||
/** | ||
* @author Wellington Costa on 07/02/18. | ||
*/ | ||
public class ConfirmEmailValidator extends AbstractValidator { | ||
|
||
private EditText emailField; | ||
private String email; | ||
|
||
ConfirmEmailValidator(String email) { | ||
this.email = email; | ||
} | ||
|
||
public ConfirmEmailValidator(TextInputLayout emailLayout, TextInputLayout confirmEmailLayout, String errorMessage) { | ||
super(confirmEmailLayout, errorMessage); | ||
this.emailField = emailLayout.getEditText(); | ||
} | ||
|
||
public ConfirmEmailValidator(EditText emailField, EditText confirmEmailField, String errorMessage) { | ||
super(confirmEmailField, errorMessage); | ||
this.emailField = emailField; | ||
} | ||
|
||
@Override | ||
boolean isNotValid(String value) { | ||
if (emailField != null) { | ||
email = emailField.getText().toString(); | ||
} | ||
|
||
return !email.equals(value); | ||
} | ||
|
||
} |
27 changes: 0 additions & 27 deletions
27
convalida-validators/src/main/java/convalida/validators/ConvalidaValidator.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.