{"id":13613705,"url":"https://github.com/rizmaulana/SheenValidator","last_synced_at":"2025-04-13T15:33:48.880Z","repository":{"id":123774936,"uuid":"198403755","full_name":"rizmaulana/SheenValidator","owner":"rizmaulana","description":"Android library to make form validation easier","archived":false,"fork":false,"pushed_at":"2019-08-30T03:53:00.000Z","size":164,"stargazers_count":30,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-02T20:45:44.202Z","etag":null,"topics":["androidforms","edittext","input","ui","validator"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rizmaulana.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-07-23T10:01:32.000Z","updated_at":"2024-05-23T05:39:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"c6116c80-8865-4f02-b99a-51f318a25a92","html_url":"https://github.com/rizmaulana/SheenValidator","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/rizmaulana%2FSheenValidator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rizmaulana%2FSheenValidator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rizmaulana%2FSheenValidator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rizmaulana%2FSheenValidator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rizmaulana","download_url":"https://codeload.github.com/rizmaulana/SheenValidator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223592707,"owners_count":17170548,"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":["androidforms","edittext","input","ui","validator"],"created_at":"2024-08-01T20:00:52.848Z","updated_at":"2024-11-07T21:31:31.224Z","avatar_url":"https://github.com/rizmaulana.png","language":"Kotlin","funding_links":[],"categories":["Android"],"sub_categories":[],"readme":"# SheenValidator\n\n[![](https://jitpack.io/v/rizmaulana/SheenValidator.svg)](https://jitpack.io/#rizmaulana/SheenValidator)\n\nAndroid library to make form validation easier, it is simple and lightweight library 100% write in Kotlin\n\n![alt text](https://i.pinimg.com/originals/1b/ef/f1/1beff152fc029b96028374dd2ab69010.png)\n\n## Installation\n\n```bash\nallprojects {\n    repositories {\n\t...\n\tmaven { url 'https://jitpack.io' }\n\t}\n}\n```\nAdd depedency\n```bash\ndependencies {\n\timplementation 'com.github.rizmaulana:SheenValidator:0.2.3'\n}\n```\n## Validation Support\n1. Required / Not Empty\n2. Email\n3. Phone\n4. Website\n5. Max Char Length\n6. Min Char Length\n\n## Usage\n### General Usage\n\n```kotlin\n    private lateinit var sheenValidator: SheenValidator\n    ...\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        ...\n        sheenValidator = SheenValidator(this)\n        sheenValidator.setOnValidatorListener {\n            Toast.makeText(this@SheenValidatorActivity, \"Registration form is valid, good job!\", Toast.LENGTH_SHORT)\n                .show()\n        }\n        sheenValidator.registerAsRequired(txt_email)\n        sheenValidator.registerAsEmail(txt_email)\n        sheenValidator.registerAsRequired(txt_phone)\n        sheenValidator.registerAsPhone(txt_phone)\n        sheenValidator.registerAsRequired(txt_website)\n        sheenValidator.registerAsWebsite(txt_website)\n        sheenValidator.registerHasMin(txt_website, 5)\n\n        btn_register.setOnClickListener {\n            sheenValidator.validate()\n        }\n    }\n```\nYou can register validation on any view which extends **TextView component**. SheenValidator has default error message like Email is required, email is not valid, etc if you dont use errorListener, but if you want to custom error message you can do it like this ...\n\n### Usage with Error Listener to custom Error\n\n```kotlin\nsheenValidator.setOnErrorValidatorListener { list -\u003e\n    list.forEach {\n         when(it.id){\n             R.id.txt_username -\u003e til_username.error = \"Oops!... looks like your username is not valid\"\n             R.id.txt_password -\u003e til_password.error = \"Hmm... password is required\"\n                }\n            }\n        }\n```\n\n### Usage with Annotation\n```kotlin \n   lateinit var sheenValidator: SheenValidator\n\n   @RegisterValidation(ValidationType.REQUIRED, \n   ValidationType.EMAIL)\n   lateinit var txtUsername: TextInputEditText\n   @RegisterValidation(ValidationType.REQUIRED)\n   lateinit var txtPassword: TextInputEditText\n   ...\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        ...\n        txtUsername = findViewById(R.id.txt_email)\n        txtPassword = findViewById(R.id.txt_password)\n\n        sheenValidator = SheenValidator(this)\n        sheenValidator.setOnValidatorListener {\n            til_email.error = \"\"\n            til_password.error = \"\"\n            Toast.makeText(this@SheenValidatorAnnotationActivity, \"Your form is valid, good job!\", Toast.LENGTH_SHORT)\n                .show()\n        }\n        ValidationBinder.bindValidator(sheenValidator, this)\n        btn_login.setOnClickListener { sheenValidator.validate() }\n\n }\n\n```\n\n## Contributing\nPull requests are welcome. we need more contributor for **validation** rule and default error language, in this version **only support English** as default error message\n\n## License\n```bash\n   MIT License\n\nCopyright (c) 2019 rizmaulana\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frizmaulana%2FSheenValidator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frizmaulana%2FSheenValidator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frizmaulana%2FSheenValidator/lists"}