-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from vijayrawatsan/EditTextAndImagePickerBasic…
…Validation Basic validation for image picker and edit text done. …
- Loading branch information
Showing
16 changed files
with
305 additions
and
21 deletions.
There are no files selected for viewing
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
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
30 changes: 30 additions & 0 deletions
30
library/src/main/java/com/vijay/jsonwizard/utils/ValidationStatus.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,30 @@ | ||
package com.vijay.jsonwizard.utils; | ||
|
||
/** | ||
* Created by vijay.rawat01 on 7/21/15. | ||
*/ | ||
public class ValidationStatus { | ||
boolean isValid; | ||
String errorMessage; | ||
|
||
public ValidationStatus(boolean isValid, String errorMessage) { | ||
this.isValid = isValid; | ||
this.errorMessage = errorMessage; | ||
} | ||
|
||
public boolean isValid() { | ||
return isValid; | ||
} | ||
|
||
public void setIsValid(boolean isValid) { | ||
this.isValid = isValid; | ||
} | ||
|
||
public String getErrorMessage() { | ||
return errorMessage; | ||
} | ||
|
||
public void setErrorMessage(String errorMessage) { | ||
this.errorMessage = errorMessage; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
library/src/main/java/com/vijay/jsonwizard/validators/edittext/LengthValidator.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,28 @@ | ||
package com.vijay.jsonwizard.validators.edittext; | ||
|
||
import com.rengwuxian.materialedittext.validation.METValidator; | ||
|
||
/** | ||
* Created by vijay.rawat01 on 7/21/15. | ||
*/ | ||
public class LengthValidator extends METValidator { | ||
|
||
int minLength = 0; | ||
int maxLength = Integer.MAX_VALUE; | ||
|
||
public LengthValidator(String errorMessage, int minLength, int maxLength) { | ||
super(errorMessage); | ||
this.minLength = minLength; | ||
this.maxLength = maxLength; | ||
} | ||
|
||
@Override | ||
public boolean isValid(CharSequence charSequence, boolean isEmpty) { | ||
if(!isEmpty) { | ||
if(charSequence.length() >= minLength && charSequence.length() <= maxLength) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
library/src/main/java/com/vijay/jsonwizard/validators/edittext/MaxLengthValidator.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,13 @@ | ||
package com.vijay.jsonwizard.validators.edittext; | ||
|
||
import com.vijay.jsonwizard.widgets.EditTextFactory; | ||
|
||
/** | ||
* Created by vijay.rawat01 on 7/21/15. | ||
*/ | ||
public class MaxLengthValidator extends LengthValidator { | ||
|
||
public MaxLengthValidator(String errorMessage, int maxLength) { | ||
super(errorMessage, EditTextFactory.MIN_LENGTH, maxLength); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
library/src/main/java/com/vijay/jsonwizard/validators/edittext/MinLengthValidator.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,13 @@ | ||
package com.vijay.jsonwizard.validators.edittext; | ||
|
||
import com.vijay.jsonwizard.widgets.EditTextFactory; | ||
|
||
/** | ||
* Created by vijay.rawat01 on 7/21/15. | ||
*/ | ||
public class MinLengthValidator extends LengthValidator { | ||
|
||
public MinLengthValidator(String errorMessage, int minLength) { | ||
super(errorMessage, minLength, EditTextFactory.MAX_LENGTH); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
library/src/main/java/com/vijay/jsonwizard/validators/edittext/RequiredValidator.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,18 @@ | ||
package com.vijay.jsonwizard.validators.edittext; | ||
|
||
import com.rengwuxian.materialedittext.validation.METValidator; | ||
|
||
/** | ||
* Created by vijay.rawat01 on 7/21/15. | ||
*/ | ||
public class RequiredValidator extends METValidator { | ||
|
||
public RequiredValidator(String errorMessage) { | ||
super(errorMessage); | ||
} | ||
|
||
@Override | ||
public boolean isValid(CharSequence charSequence, boolean isEmpty) { | ||
return !isEmpty; | ||
} | ||
} |
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
Oops, something went wrong.