{"id":20758221,"url":"https://github.com/swapnil1104/passcodetext","last_synced_at":"2025-06-24T13:36:41.141Z","repository":{"id":53516624,"uuid":"185453933","full_name":"swapnil1104/PassCodeText","owner":"swapnil1104","description":"A customised EditText view serving the purpose of taking numeric One Time Password from a user. With stunning animation, and high customizability.","archived":false,"fork":false,"pushed_at":"2021-03-26T12:56:34.000Z","size":1158,"stargazers_count":112,"open_issues_count":2,"forks_count":21,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-31T15:58:43.323Z","etag":null,"topics":["android","custom-view","java","jitpack","library","otp","otpedittext","passcode","passcodetext"],"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/swapnil1104.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-07T18:04:49.000Z","updated_at":"2024-12-23T02:57:36.000Z","dependencies_parsed_at":"2022-09-12T10:42:02.833Z","dependency_job_id":null,"html_url":"https://github.com/swapnil1104/PassCodeText","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/swapnil1104/PassCodeText","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapnil1104%2FPassCodeText","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapnil1104%2FPassCodeText/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapnil1104%2FPassCodeText/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapnil1104%2FPassCodeText/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swapnil1104","download_url":"https://codeload.github.com/swapnil1104/PassCodeText/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapnil1104%2FPassCodeText/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261686326,"owners_count":23194266,"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","custom-view","java","jitpack","library","otp","otpedittext","passcode","passcodetext"],"created_at":"2024-11-17T09:49:39.193Z","updated_at":"2025-06-24T13:36:41.114Z","avatar_url":"https://github.com/swapnil1104.png","language":"Java","readme":"# PassCodeText\n\n[![](https://jitpack.io/v/swapnil1104/OtpEditText.svg)](https://jitpack.io/#swapnil1104/OtpEditText)\n[![](https://jitpack.io/v/swapnil1104/OtpEditText/month.svg)](https://jitpack.io/#swapnil1104/OtpEditText)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-OtpEditText-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/7666)\n\nA customised EditText view serving the purpose of taking numeric **One Time Password** from a user. \nWith stunning animation, and high customizability.\n\n![Demo with underline](images/demo2.gif)\n![Dark theme demo](images/dark_theme_demo.gif)\n![Error animation](images/err_anim.gif)\n![Hint usage](images/hint.gif)\n\n## Packed with features\n\n- Add custom character limit.\n- Animation supported on wrong input\n- Use your own color scheme.\n- Do not allow user changing cursor position for smooth functioning.\n- Hint is supported!\n\n## How to integrate the library in your app?\nStep 1: Add it in your root build.gradle at the end of repositories:\n\n```\nallprojects {\n    repositories {\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\nStep 2. Add the dependency\n\n```\ndependencies {\n    implementation 'com.github.swapnil1104:OtpEditText:{current_lib_ver}'\n}\n```\nStep 3. Add OtpEditText to your layout file\n\n```\n\u003ccom.broooapps.otpedittext2.OtpEditText\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:clickable=\"false\"\n    android:cursorVisible=\"false\"\n    android:digits=\"0123456789\"\n    android:inputType=\"number\"\n    android:maxLength=\"6\"\n    android:padding=\"8dp\"\n    android:textSize=\"30sp\"\n    app:oev_primary_color=\"@color/red\"\n    app:oev_secondary_color=\"@color/light_gray\"\n    /\u003e\n```\n\n## Usage\n\n### GetOtpValue() method usage\n```\nString otpValue = otpEditText.getOtpValue();\nif (otpValue != null) {\n    textDisplay.setText(\"Entered Value: \" + otpEditText.getOtpValue());\n}\n```\nThis method when invoked, will either return the OTP value, in case this is invoked before the user inputs the desired length of characters, a shake animation will be triggered implicitly.\n\n\n## How to customize the view.\n\n### Trigger Error Animation\nTo trigger error animation for incorrect input, or any other use case, use.\n```\nOtpEditText otpEditText;\n....\notpEditText = findViewById(R.id.oev_view);\n....\n//Invalid input, animation triggered\notpEditText.triggerErrorAnimation();\n```\n\n### Setting desired length for the OTP(One time password code)\n\nTo set custom length of the OtpEditText, use \n\n```android:maxLength=\"{your length}\"```\n\nThis will automatically generate the right amount of boxes for user to input the code in.\n\n### Setting primary custom color\nThe primary color signifies the boundary of the box that requires input from user.\nTo change that use,\n\n```app:oev_primary_color=\"@color/{your_color}\"```\n\n\n### Setting secondary custom color\nThe secondary color signifies the boundary of the boxes that do not require input from user.\nTo change that use,\n\n```app:oev_secondary_color=\"@color/{your_color}\"```\n\n###  Using multiple style options.\nThere are 4 style options that are available within the library for now.\n- rounded box\n- square box\n- underline\n- rounded underline\n\nTo use any of these styles, please add ```app:oev_box_style=\"@string\\{box_style_input}\"```\nattribue.\nI have provided string resources for simpler usage.\n```\n    \u003cstring name=\"style_square\"\u003esquare_box\u003c/string\u003e\n    \u003cstring name=\"style_rounded\"\u003erounded_box\u003c/string\u003e\n    \u003cstring name=\"style_underline\"\u003eunderline\u003c/string\u003e\n    \u003cstring name=\"style_rounded_underline\"\u003erounded_underline\u003c/string\u003e\n```\nSuppose you want the rounded underline option to be displayed. Then, please add:\n`app:oev_box_style=\"@string/style_rounded_underline\" ` in the OtpEditText xml code.\n\n### Masking input characters with Asterisk.\nFunctionality to mask the input with any special character has been introduced. \nTo mask the input;\n```\napp:oev_mask_input=\"true\" \n```\nxml property must be introduced in the XML layout file.\n\n#### Masking with any other special character.\nTo mask input with any character other than `*` you can do the following;\n```\napp:oev_mask_character=\"ø\"\n```\n\nP.S. Please note that, in case of masking with a special character other than `*`, specify string with length one, otherwise the input string will be truncated to length 1.\n\n### OnComplete callback for the View\nTo implement an OnComplete callback, use `setOnCompleteListener` setter method and pass on an interface implementation.\neg:\n```\neditText.setOnCompleteListener(new OnCompleteListener() {\n        @Override\n        public void onComplete(String value) {\n            Toast.makeText(MainActivity.this, \"Completed \" + value, Toast.LENGTH_SHORT).show();\n        }\n    });\n```\n\nThis callback will be triggered when the number of characters is equal to the `android:maxLength` value.\n\n## For optimum usage; Please note.\n* Specify `android:textSize` according to your needs.\n* Specify `android:padding` according to your needs, there are no paddings drawn by default.\n* Specify `android:layout_height` according to the `textSize` you've provided. The view will try to center the text with a vertical biasing of `0.6f`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswapnil1104%2Fpasscodetext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswapnil1104%2Fpasscodetext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswapnil1104%2Fpasscodetext/lists"}