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 @@ -32,7 +32,7 @@ public CpfTypeRule(TextView view, String errorMessage) {
3232 @ Override
3333 protected boolean isValid (TextView view ) {
3434 final String rawCpf = view .getText ().toString ().trim ().replaceAll ("[^\\ d]" , "" );
35- return rawCpf .length () == 11
35+ return rawCpf .length () == 11 && ! onBlackList ( rawCpf )
3636 && (cpfDv (rawCpf , 1 ) == Character .getNumericValue (rawCpf .charAt (9 ))
3737 && cpfDv (rawCpf , 2 ) == Character .getNumericValue (rawCpf .charAt (10 )));
3838 }
@@ -58,6 +58,17 @@ private int cpfSum(final String rawCPF, final int step) {
5858 return sum ;
5959 }
6060
61+ // Reference: https://github.com/concretesolutions/canarinho/blob/master/canarinho/src/main/java/br/com/concretesolutions/canarinho/validator/ValidadorCPF.java
62+ private boolean onBlackList (String rawCpf ) {
63+ boolean equal = true ;
64+ for (int i = 1 ; i < 11 && equal ; i ++) {
65+ if (rawCpf .charAt (i ) != rawCpf .charAt (0 )) {
66+ equal = false ;
67+ }
68+ }
69+ return equal || rawCpf .equals ("12345678909" );
70+ }
71+
6172 @ Override
6273 protected void onValidationSucceeded (TextView view ) {
6374 super .onValidationSucceeded (view );
You can’t perform that action at this time.
0 commit comments