Coder Social home page Coder Social logo

android-edittext-validator's Introduction

Hi there yo

Linkedin Badge Gmail Badge StackOverflow Badge

I'm Andrea, a backend developer with a solid foundation in TypeScript and Node.js, specializing in creating efficient, scalable solutions. My approach to problem-solving is extremely rational, allowing me to navigate complex challenges with clarity and precision. My technical expertise and methodical thinking enable me to deliver high-quality results in every project I undertake. Passionate about coding and continuous improvement, I thrive on turning intricate problems into seamlessly functioning backend systems.

android-edittext-validator's People

Contributors

bryant1410 avatar ercanpinar avatar jamiecruwys avatar kazaky avatar kodamirmo avatar leoheo avatar mahermeg17 avatar mikeringrose avatar moddus avatar ninjachen avatar samerzmd avatar sash0k avatar suelthedev avatar tasomaniac avatar vekexasia avatar viktoschi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-edittext-validator's Issues

Error inflating class com.andreabaccega.widget.FormEditText

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) 

Special Char

Hi, I receive problem with alphaNumeric type. Germany chars, detect like special chars.
device-2016-02-11-090718

min number of characters?

How about only allowing success if there are atleast 5 characters in the edittext?

How would that be facilitied?

thanks!

Maven dependency help

Maven Config:

com.andreabaccega
android-form-edittext
1.0.5
aar

Error:

already added: Lcom/andreabaccega/widget/DefaultEditTextValidator$1;

Any suggestions?

set optional field

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 ?

two column of one has filled validation

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?

Error string/exclamation mark not showing on validation fail

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>

Specific pattern of check

I want check the next: in field user can input characters, numbers or empty field. How I can implement that ?? #

Possible bug in onFocus not always being called when multiple EditText on screen and click on a second

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.

How to.....Exclude certain words?

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!!

nocheck

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

error string internationalisation

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,

Failed to resolve: com.andreabaccega:android-edittext-validator:1.3.0

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' }
    }
}

Consider renaming the library to get more visibility

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!

Infotext is above Actionbar

when a infotext is showing and the FormEditText is in a scrollview it happens that the overlay is on top of the actionbar when scrolling
device-2013-05-07-170458

ClassCastException

java.lang.ClassCastException
com.android.internal.view.menu.ListMenuItemView cannot be cast to android.widget.TextView

Custom colors

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!

requestFocus() doesn't work

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.