vekexasia / android-edittext-validator Goto Github PK
View Code? Open in Web Editor NEWAndroid form edit text is an extension of EditText that brings data validation facilities to the edittext.
License: MIT License
Android form edit text is an extension of EditText that brings data validation facilities to the edittext.
License: MIT License
can you make an option that allows blanks. for example sometimes i have a field and its an optional field , so it can be blank. how to set an optional field that can either have data or not ?
Maven Config:
com.andreabaccega
android-form-edittext
1.0.5
aar
Error:
already added: Lcom/andreabaccega/widget/DefaultEditTextValidator$1;
Any suggestions?
Hi, I was looking for where can I change the color and I couldn't find the file. Is possible change the red color?. Thanks for the library. It's awesome!
not sure why you put whatever for the name space.
Library symbols are not resolved when I use
compile 'com.andreabaccega:android-form-edittext:1.0.5'
but things are working with no problems when I use version 1.0.4
compile 'com.andreabaccega:android-form-edittext:1.0.4'
Hi
I was looking for best practices validating EditText and found your library by chance when was reading the comments on Donn Felker's blog post.
Only now I noticed that when googling for Android EditText Validation
, your library appears on the 6th result. In my opinion this could be improved if you include the word Validation
in the library name.
Great work, cheers!
Please create ValidatingEditTextPreference for android.support.v7.preference.EditTextPreference
java.lang.ClassCastException
com.android.internal.view.menu.ListMenuItemView cannot be cast to android.widget.TextView
Restart android studio didn't help, i integrate this useful widget by gradle.
Hi,
I need to show error msg for Arabic users which not supported (https://github.com/vekexasia/android-edittext-validator/tree/09a1a466e687e9afb4eef0daf3f179cdae8b967f/library/res)
So I use [whatever:emptyErrorString="@string/msg_invalid_data_empty"] into my layout xml file.
But it only shows fr msg which is the default language of the phone. Even I force my app to use Arabic language (all other UI are correctly in Arabic).
And when I use a Validator from java like this
MultiValidator tmpValidator = new AndValidator(); tmpValidator.enqueue(new FormAlphaNumericValidator(getResources().getString(R.string.msg_invalid_data_format))); tmpValidator.enqueue(new EmptyValidator(getResources().getString(R.string.msg_invalid_data_empty))); mScannedDocNumber.addValidator(tmpValidator);
My FormAlphaNumericValidator extends AlphaNumericValidator show correctly the error msg in Arabic. But not the EmptyValidator.
Are there a better way to show error msg in Arabic, or should I extends all needed Validators ?
Thanks,
What option is there for supporting decimal values validation within the ranges?
I added it as a library but still not working
In Alpha Edit Text widget user shouldn't be able to type "/".
android:background not working on form edittext
I know I'm cheating but hey #YOLO...
thanks for the lib btw!
So, If I want to exclude certain words from being entered/accepted in the edittext,
what shall i do?
for example, if a app member types, vase, I want to tell them sorry but that word can't be submitted.
Thanks!!
HI,
It would be good if it support iso-8859-1 or more.
Thanks.
Hi and thanks for this lib :)
When I want to put it on my project, I have this error :
Failed to resolve: com.andreabaccega:android-edittext-validator:1.3.0 Show in File Show in Project Structure dialog
This is my Gradle :
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
defaultConfig {
applicationId "hey.hey"
minSdkVersion 19
targetSdkVersion 27
versionCode 11
versionName "2.1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
kapt {
arguments {
arg("room.schemaLocation", "$projectDir/schemas".toString())
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.25.2'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:27.1.0'
compile "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
kapt "android.arch.persistence.room:compiler:1.0.0"
compile "org.jetbrains.anko:anko-commons:0.10.4"
compile "org.jetbrains.anko:anko-design:0.10.4"
compile "com.chibatching.kotpref:kotpref:2.4.0"
compile "com.chibatching.kotpref:initializer:2.4.0"
compile('io.socket:socket.io-client:1.0.0') { exclude group: 'org.json', module: 'json' }
compile 'com.github.anastr:speedviewlib:1.1.7'
compile 'com.andreabaccega:android-edittext-validator:1.3.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') { transitive = true }
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
thanks for the beautiful library
i have a small issue the docs says this:
nocheck: It does not check anything except the emptiness
of the field.
i tried nocheck but it doesn't check for empty text
i didn't want to make a pull request before i talk the approval
hi
floatNumericRange allows only int values as min/max
How to add testtype, customRegexp, inputType in for dynamic generated formedittext .
how can I show the error icon on the left of a FormEditText??
I just write
public class HasOneFilledValidator extends Validator {
private final EditText otherEditText;
public HasOneFilledValidator(EditText otherEditText, String errorMessage) {
super(errorMessage);
this.otherEditText = otherEditText;
}
@Override
public boolean isValid(EditText editText) {
return (TextUtils.getTrimmedLength(editText.getText()) > 0 || TextUtils.getTrimmedLength(otherEditText.getText())) > 0;
}
}
and use AA.addValidator(new HasOneFilledValidator(BB, "test"));
but it doen't run isValid...
What did I missed?
Inflating not working on API 19 more down.
Exception:
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/edit_text.xml from drawable resource ID #0x7f0200a4
at android.content.res.Resources.loadDrawable(Resources.java:1953)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.(View.java:3330)
at android.widget.TextView.(TextView.java:583)
at android.widget.EditText.(EditText.java:60)
at android.widget.EditText.(EditText.java:56)
at com.andreabaccega.widget.FormEditText.(FormEditText.java:30)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at br.com.rensoftware.sbox.activity.LoginActivity.onCreate(LoginActivity.java:57)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:463)
at android.graphics.drawable.GradientDrawable.inflate(GradientDrawable.java:991)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885)
at android.graphics.drawable.LayerDrawable.inflate(LayerDrawable.java:165)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:183)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822)
at android.content.res.Resources.loadDrawable(Resources.java:1950)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.(View.java:3330)
at android.widget.TextView.(TextView.java:583)
at android.widget.EditText.(EditText.java:60)
at android.widget.EditText.(EditText.java:56)
at com.andreabaccega.widget.FormEditText.(FormEditText.java:30)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at br.com.rensoftware.sbox.activity.LoginActivity.onCreate(LoginActivity.java:57)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
First off, I created a fork of the library at: https://github.com/RoundSparrow/android-edittext-validator -- my fork's purpose is to use your work to add a feature I had desired for screen space conservation. A TextView hides each EditText until a user touches the TextView - then they edit appears. You are welcome to absorb this new feature - I added it as a different name - so the library user can have your original FormEditText view. The only real change to your code was to expose a few variables for subclass support...
In the development and testing of my fork - I found something:
The onFocus used in this library is not being called in certain touch-transitions away from the EditText field. I assume the validation doesn't always fire due to this bug.
My fork made it more obvious - because there is a visual change on focus loss... IF YOU WANTED to save time and not bother with my fork - a suggest is to just add one line to set background color on the FormEditText onFocusChanged - and then play around with shifting in and out of the control to see if the color change always appears.
I want check the next: in field user can input characters, numbers or empty field. How I can implement that ?? #
I have the FormEditText wrapped in the TextInputLayout class if that matters.
Whenever I test the validation, the error or the exclamation mark don't show. I have to manually focus the culprit field to get the error string shown.
This causes a lot of issues as the user doesn't know what the problem is.
Here's the xml:
<android.support.design.widget.TextInputLayout
android:id="@+id/til_tradingName"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:hint="@string/trading_name">
<com.andreabaccega.widget.FormEditText
android:id="@+id/tradingName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapWords"
app:testType="nocheck"/>
</android.support.design.widget.TextInputLayout>
Hi,
I can't request focus on the FormEditText by adding in the xml.
the programmatically way doesn't work too:
FormEditText form=(FormEditText)findViewById(R.id.editText1);
form.setFocusableInTouchMode(true);
form.requestFocus();
Have you an idea how to fix this? thanks
Hi,
can the validator be used with AutoCompleteTextView?
if so, how?
Best regards,
How can i compare two fields to have same data? like email and confirm email? password and confirm password
How about only allowing success if there are atleast 5 characters in the edittext?
How would that be facilitied?
thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.