{"id":13491472,"url":"https://github.com/ragunathjawahar/android-saripaar","last_synced_at":"2025-03-28T08:33:14.474Z","repository":{"id":4585943,"uuid":"5728045","full_name":"ragunathjawahar/android-saripaar","owner":"ragunathjawahar","description":"UI form validation library for Android","archived":false,"fork":false,"pushed_at":"2020-12-03T16:41:19.000Z","size":3124,"stargazers_count":3221,"open_issues_count":62,"forks_count":460,"subscribers_count":99,"default_branch":"master","last_synced_at":"2024-10-31T05:34:47.707Z","etag":null,"topics":["android","java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ragunathjawahar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-08T11:52:30.000Z","updated_at":"2024-10-24T09:13:09.000Z","dependencies_parsed_at":"2022-08-06T17:00:52.010Z","dependency_job_id":null,"html_url":"https://github.com/ragunathjawahar/android-saripaar","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragunathjawahar%2Fandroid-saripaar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragunathjawahar%2Fandroid-saripaar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragunathjawahar%2Fandroid-saripaar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragunathjawahar%2Fandroid-saripaar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ragunathjawahar","download_url":"https://codeload.github.com/ragunathjawahar/android-saripaar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245996706,"owners_count":20707298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","java"],"created_at":"2024-07-31T19:00:57.318Z","updated_at":"2025-03-28T08:33:14.040Z","avatar_url":"https://github.com/ragunathjawahar.png","language":"Java","funding_links":[],"categories":["Java","表单","Uncategorized","Libs","Validation"],"sub_categories":["Uncategorized","\u003cA NAME=\"Validation\"\u003e\u003c/A\u003eValidation"],"readme":"Android Saripaar v2 [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Android%20Saripaar-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/526)\n===================\n![Logo](logo.png)\n\n**சரிபார்** - sari-paar (Tamil for \"to check\", \"verify\" or \"validate\")\n\nAndroid Saripaar is a simple, feature-rich and powerful rule-based UI form validation library for Android.\nIt is the **SIMPLEST** UI validation library available for Android.\n\nWhy Android Saripaar?\n---------------------\n\n - Built on top of [Apache Commons Validator], a validation framework with proven track record on the web, desktop and mobile platforms.\n - Declarative style validation using **Annotations**.\n - **Extensible**, now allows Custom Annotations.\n - **Synchronous** and **Asynchronous** validations, you don't have to worry about threading.\n - Supports both BURST and IMMEDIATE modes.\n - Works with **Stock Android Widgets**, no custom view dependencies.\n - Isolates validation logic using rules.\n - Compatible with other annotation-based libraries and frameworks such as [ButterKnife], [AndroidAnnotations], [RoboGuice], etc.,\n\nQuick Start\n-----------\n**Step 1 - Annotate your widgets using [Saripaar Annotations]**\n```java\n@NotEmpty\n@Email\nprivate EditText emailEditText;\n\n@Password(min = 6, scheme = Password.Scheme.ALPHA_NUMERIC_MIXED_CASE_SYMBOLS)\nprivate EditText passwordEditText;\n\n@ConfirmPassword\nprivate EditText confirmPasswordEditText;\n\n@Checked(message = \"You must agree to the terms.\")\nprivate CheckBox iAgreeCheckBox;\n```\n\nThe annotations are self-explanatory. The `@Order` annotation is required ONLY when performing ordered validations using\n`Validator.validateTill(View)` and `Validator.validateBefore(View)` or in `IMMEDIATE` mode.\n\n**Step 2 - Instantiate a new [Validator]**\n```java\n@Override\npublic void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n    // Code…\n\n    validator = new Validator(this);\n    validator.setValidationListener(this);\n\n    // More code…\n}\n```\nYou will need a `Validator` and a `ValidationListener` for receiving callbacks on validation events.\n\n**Step 3 - Implement a [ValidationListener]**\n```java\npublic class RegistrationActivity extends Activity implements ValidationListener {\n\n    // Code…\n\n    @Override\n    public void onValidationSucceeded() {\n        Toast.makeText(this, \"Yay! we got it right!\", Toast.LENGTH_SHORT).show();\n    }\n\n    @Override\n    public void onValidationFailed(List\u003cValidationError\u003e errors) {\n        for (ValidationError error : errors) {\n            View view = error.getView();\n            String message = error.getCollatedErrorMessage(this);\n\n            // Display error messages ;)\n            if (view instanceof EditText) {\n                ((EditText) view).setError(message);\n            } else {\n                Toast.makeText(this, message, Toast.LENGTH_LONG).show();\n            }\n        }\n    }\n}\n```\n - `onValidationSucceeded()` - Called when all your views pass all validations.\n - `onValidationFailed(List\u003cValidationError\u003e errors)` - Called when there are validation error(s).\n\n**Step 4 - Validate**\n```java\nregisterButton.setOnClickListener(new OnClickListener() {\n\n    @Override\n    public void onClick(View v) {\n        validator.validate();\n    }\n});\n```\nThe `Validator.validate()` call runs the validations and returns the result via appropriate callbacks on the `ValidationListener`. You can run validations on a background `AsyncTask` by calling the `Validator.validate(true)` method.\n\nSaripaar X\n---------------------\nIf you are looking for country-specific annotations, checkout the [Saripaar X] project. The extensions project is in its early stages and needs contributors. Feel free to contribute.\n\nMaven\n---------------------\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.mobsandgeeks\u003c/groupId\u003e\n        \u003cartifactId\u003eandroid-saripaar\u003c/artifactId\u003e\n        \u003cversion\u003e(latest version)\u003c/version\u003e\n    \u003c/dependency\u003e\n\nGradle\n---------------------\n    dependencies {\n        compile 'com.mobsandgeeks:android-saripaar:(latest version)'\n    }\n\nSnapshots\n---------------------\nIn your `{project_base}/build.gradle` file, include the following.\n\n    allprojects {\n        repositories {\n            jcenter()\n            maven {\n                url \"https://oss.sonatype.org/content/repositories/snapshots/\"\n            }\n        }\n    }\n\nProGuard\n---------------------\nExclude Saripaar classes from obfuscation and minification. Add the following rules to your `proguard-rules.pro` file.\n\n    -keep class com.mobsandgeeks.saripaar.** {*;}\n    -keep @com.mobsandgeeks.saripaar.annotation.ValidateUsing class * {*;}\n\nEvolution\n---------------------\nFor those interested in finding out how v2 evolved from v1, watch this (~20 second) [video].\n\nUsing Saripaar?\n---------------------\n[Tweet] me with your Google Play URL and I'll add your app to the list :)\n\nIcon         | App           | Icon         | App           | Icon         | App\n------------ | ------------- | ------------ | ------------- | ------------ | -------------\n\u003cimg src=\"https://lh3.ggpht.com/qhpfFQFd5YuLzT5d9jUCI69dMeLlW6XewLsgZ0l06D92M0SmvsMKSMd_YY1Xc9K1GyU=w300-rw\" width=\"48\" height=\"48\" /\u003e | [Wikipedia] | \u003cimg src=\"https://lh6.ggpht.com/i_pxbaojay2K2xb2RDC2W7eOnNlpGRgILoACaEDhaKz87JSg3nEJHV3Vz3wmS3L3e4M=w300-rw\" width=\"48\" height=\"48\" /\u003e | [Wikipedia Beta] | \u003cimg src=\"https://lh3.ggpht.com/o2lhzbRnq6U1oPxyqY6LDJIc2PO_tm1_sIbX-fMLpG2Sxk94QW2gQaDw8ewam1dPQrdz=w300-rw\" width=\"48\" height=\"48\" /\u003e | [Mizuno Baton]\n\u003cimg src=\"https://lh6.ggpht.com/t-WYlpXlwhLL0unTDChiVi24b4LP0kNsJQnRwFaMHd0NGqxgQ2LupQ1Dl7M1ztj8Vg8=w300-rw\" width=\"48\" height=\"48\" /\u003e | [Fetch] | \u003cimg src=\"https://lh3.ggpht.com/J3bMDphmzsPFQeMfWR-LH70g5vSGrTVggPzXQdUafKM2KmpWS3THIcSHQaTVbCQ_hjw=w300-rw\" width=\"48\" height=\"48\" /\u003e | [HealtheMinder] | \u003cimg src=\"https://lh3.ggpht.com/EhidzByoyUY1OPVcsjOmtOcRwoxphRCy1-a_qKLYKHwsS0DuHIC9cHIDEPLVKO-oTw=w300-rw\" width=\"48\" height=\"48\" /\u003e | [MomMe]\n\u003cimg src=\"https://lh5.ggpht.com/h6T-az0ip_OqNtSh__Kc5-0ZPpT7sYxSn4kFPOjrNI7o-LN9bPbovoiYDfswL-B5XQ=w300-rw\" width=\"48\" height=\"48\" /\u003e | [Feelknit] | \u003cimg src=\"https://lh4.ggpht.com/k5zFS5VheJKt1yBHKC-wBgJTwOQ4Q_Aa2XbG6Ea_-HvP8nXjYeSnO_227j1wVno1JZY=w300-rw\" width=\"48\" height=\"48\" /\u003e | [StreetBarz] | \u003cimg src=\"https://lh3.googleusercontent.com/4fO6lwPVZ7ncBsvfVpfME9xm9Nn6ggtEffCrNDFbqZ9LXBkYxSbdALWmNxQLwkhv3p6G=w300-rw\" width=\"48\" height=\"48\" /\u003e | [Roast Me]\n\u003cimg src=\"https://lh3.googleusercontent.com/Mtr7AqEN4WGJVih1rAjvvzl4rN5gYT2EwWxpVwczZXfRmixaQJBFnm-WBr8TkhGzpOA=w300-rw\" width=\"48\" height=\"48\" /\u003e | [Pipe] | \u003cimg src=\"https://lh3.googleusercontent.com/0fEpTqHqbVJ_0z7rdsG9wks5KiiaBjyA4MScLf19HSMhy8BR3vSX6agZ0NucyPMyow=w300-rw\" width=\"48\" height=\"48\" /\u003e | [Snagajob] | \u003cimg src=\"https://lh3.googleusercontent.com/SrowFwOEDERCrVqk7SaBwifZslMoqTk5iZ9gMKOafvD1KvlyYYLxvbNJXiiUjBSsLjk=w300-rw\" width=\"48\" height=\"48\" /\u003e | [Tatva Moksh Lakshya]\n\nWiki\n---------------------\nPlease visit the [wiki] for a complete guide on Android Saripaar.\n\nLicense\n---------------------\n\n    Copyright 2012 - 2015 Mobs \u0026 Geeks\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n\u003csub\u003eSaripaar Logo © 2013 - 2015, Mobs \u0026amp; Geeks.\u003csub\u003e\n\n  [jar]: http://search.maven.org/#search%7Cga%7C1%7Candroid%20saripaar\n  [Apache Commons Validator]: http://commons.apache.org/proper/commons-validator/\n  [ButterKnife]: https://github.com/JakeWharton/butterknife\n  [AndroidAnnotations]: https://github.com/excilys/androidannotations\n  [RoboGuice]: https://github.com/roboguice/roboguice/\n  [Saripaar Annotations]: https://github.com/ragunathjawahar/android-saripaar/tree/master/saripaar/src/main/java/com/mobsandgeeks/saripaar/annotation\n  [Validator]: https://github.com/ragunathjawahar/android-saripaar/blob/master/saripaar/src/main/java/com/mobsandgeeks/saripaar/Validator.java\n  [ValidationListener]: https://github.com/ragunathjawahar/android-saripaar/blob/master/saripaar/src/main/java/com/mobsandgeeks/saripaar/Validator.java\n  [Saripaar X]: https://github.com/ragunathjawahar/saripaar-x\n  [video]: https://youtu.be/6Os9RxVK76A?t=23\n  [Tweet]: https://twitter.com/ragunathjawahar\n  [Wikipedia]: https://play.google.com/store/apps/details?id=org.wikipedia\n  [Wikipedia Beta]: https://play.google.com/store/apps/details?id=org.wikipedia.beta\n  [Fetch]: https://play.google.com/store/apps/details?id=com.buywithfetch.android\n  [Mizuno Baton]: https://play.google.com/store/apps/details?id=com.mizuno.baton\n  [MomMe]: https://play.google.com/store/apps/details?id=org.harthosp.momme\n  [HealtheMinder]: https://play.google.com/store/apps/details?id=org.hartfordhealthcare.healtheminder\n  [Feelknit]: https://play.google.com/store/apps/details?id=com.qubittech.feelknit.app\n  [StreetBarz]: https://play.google.com/store/apps/details?id=com.diofeher.StreetBarz\n  [Roast Me]: https://play.google.com/store/apps/details?id=com.marsvard.roastcam\n  [Pipe]: https://play.google.com/store/apps/details?id=com.pipeapp.pipe\n  [Snagajob]: https://play.google.com/store/apps/details?id=com.snagajob.jobseeker\n  [Tatva Moksh Lakshya]: https://play.google.com/store/apps/details?id=siesgst.edu.in.tml16\n  [wiki]: https://github.com/ragunathjawahar/android-saripaar/wiki\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragunathjawahar%2Fandroid-saripaar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fragunathjawahar%2Fandroid-saripaar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragunathjawahar%2Fandroid-saripaar/lists"}