Modified EditText


Source link: https://github.com/sagarnayak/ModifiedEditText

ModifiedEditText

This is a more modified version of edittext. in conventional EditText in android we get the default functionalities. but one of the most important functionality is missing in the default EditText. as we know we must have to validate the data before taking it as an input in edittext. so this functionality is provided in this mod.

Functionality Avilable

Normal Validations

  1. Number of Characters limit Validation
  2. First BlankSpace Validation
  3. Intermediate BlankSpace Validation
  4. SQL Injaction Character Validation
  5. Take Letters Only
  6. Take Numbers Only
  7. Receive Validation Failed and Success Broadcast
  8. Set Custom Error Message

Specific Validation

  1. Phone Number Validation
  2. Email Validation
  3. Name Validation

How To Use

Add it in your root build.gradle at the end of repositories:

appprojects {

  repositories {

maven {

 url "https://jitpack.io"

}

  
}
 
}
 

Add the dependency

dependencies {

  compile 'com.github.sagarnayak:ModifiedEditText:1.2' 
}
 

To Use In Layout

<com.csmpl.androidlib.edittextmod.EditTextMod xmlns:edittextmod="http://schemas.android.com/apk/res-auto"
  android:id="@+id/edittextmod_demo"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  edittextmod:FailBroadcast="FAILED"
  edittextmod:ValidationType="PHONENUMBER" /> 

1. Number of Characters limit Validation

Number of Characters limit Validation can be applied when yoou want to limit the number of characters that you want the user to enter. if you want only 10 characters to be entered then just meke a limit of 10.

How To Use Number of Characters limit Validation

edittextmod:LimitInput="4" 

2. First BlankSpace Validation

Setting this value as true will not allow a blank space to be entered at first place.

How To Use First BlankSpace Validation

edittextmod:BlockFirstSpace="true" 

3. Intermediate BlankSpace Validation

Setting this value as true will not allow a blank space to be entered at any position.

How To Use Intermediate BlankSpace Validation

edittextmod:BlockIntermediateSpace="true" 

4. SQL Injaction Character Validation

Setting this value as true will not allow a sql injection characters ( < , > , = , ~ , # , ^ , | , $ , % , " , & , * , ! , ' ) to be entered at any position.

How To Use SQL Injaction Character Validation

edittextmod:BlockSqlInjection="true" 

5. Take Letters Only

Setting this value as true will not allow characters other then letters at any position.

How To Use Take Letters Only Validation

edittextmod:TakeOnlyLetters="true" 

6. Take Numbers Only

Setting this value as true will not allow characters other then numbers at any position.

How To Use Take Numbers Only Validation

edittextmod:TakeOnlyNumbers="true" 

7. Receive Validation Failed and Success Broadcast

This parameter will require you to provide a string. this string will be broadcasted whenever there is a success or a fail in validtion as per what you have used this for. Register for broadcast with this name you have provided in the activity to receive a failed or success broadcast.

How To Use Receive Validation Failed and Success Broadcast

edittextmod:FailBroadcast="FAILED_BORADCAST" edittextmod:SuccessBroadcast="SUCCESS_BROADCAST" 

8. Set Custom Error Message

This parameter will require you to provide a error message as string. this is optional. if you dont want to provide a custom error message then it will show a default error message while validating.

How To Use Set Custom Error Message

edittextmod:error_message="Please enter correct data" 

9. Phone Number Validation

If you are aiming for a specific phone number validation then use this validation. this will take only numbers and the default number of characters are 10. if you want you can change it by applying a " Number of Characters limit Validation". by default the number keyboard will be opened. this includes a first blankspace and inermediate blannk space validation also, including the sql injection.

How To Use Phone Number Validation

edittextmod:ValidationType="PHONENUMBER" 

10. Email Validation

If you are aiming for a specific email address validation then use this validation. this will validate a proper email and will return a error message if you a proper email address is not entered.this includes a first blankspace and inermediate blannk space validation also, including the sql injection.

How To Use Email Validation

edittextmod:ValidationType="EMAILADDRESS" 

11. Name Validation

If you are aiming for a specific name validation then use this validation. this will take a name and if any other character is entered then this will show an error message.this includes a first blankspace validation also, including the sql injection.

How To Use Name Validation

edittextmod:ValidationType="NAME" 

At any point if the focus is changed and the validation is not successfull the edittext will not loose the focus. it will regain focus and request the user to enter a proper data by showing a proper error message.

Resources

Android Library for checking the current uploaded version on the Google Play.

ProperDroid is a gradle plugin and an Android library that simplifies the way that config different variant on your project.

A polite way to ask for ratings.

The api which Android SDK exposes to retrieve the data from a 'returning system call' (camera, gallery, email...) just does not give a shit about Don't break the chain leitmotiv. Indeed, the OnActivityResult approach will broke entirely your observable chaining.

A simple tool that can be used to quickly add informative debug logs to the code during investigation without typing much.

A library allows to add header and footer views for RecyclerView.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes