This repository was archived by the owner on Nov 5, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
library/src/main/java/br/com/ilhasoft/support/validation/rule Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public CpfTypeRule(TextView view, String errorMessage) {
1616 @ Override
1717 protected boolean isValid (TextView view ) {
1818 final String rawCpf = view .getText ().toString ().trim ().replaceAll ("[^\\ d]" , "" );
19- return rawCpf .length () == 11
19+ return rawCpf .length () == 11 && ! onBlackList ( rawCpf )
2020 && (cpfDv (rawCpf , 1 ) == Character .getNumericValue (rawCpf .charAt (9 ))
2121 && cpfDv (rawCpf , 2 ) == Character .getNumericValue (rawCpf .charAt (10 )));
2222 }
@@ -42,6 +42,17 @@ private int cpfSum(final String rawCPF, final int step) {
4242 return sum ;
4343 }
4444
45+ // Reference: https://github.com/concretesolutions/canarinho/blob/master/canarinho/src/main/java/br/com/concretesolutions/canarinho/validator/ValidadorCPF.java
46+ private boolean onBlackList (String rawCpf ) {
47+ boolean equal = true ;
48+ for (int i = 1 ; i < 11 && equal ; i ++) {
49+ if (rawCpf .charAt (i ) != rawCpf .charAt (0 )) {
50+ equal = false ;
51+ }
52+ }
53+ return equal || rawCpf .equals ("12345678909" );
54+ }
55+
4556 @ Override
4657 protected void onValidationSucceeded (TextView view ) {
4758 super .onValidationSucceeded (view );
You can’t perform that action at this time.
0 commit comments