{"id":19674942,"url":"https://github.com/devapro/numberwatcher","last_synced_at":"2026-06-17T10:32:06.368Z","repository":{"id":73356314,"uuid":"294455467","full_name":"devapro/NumberWatcher","owner":"devapro","description":"TextWatcher class for constraining and formatting input in EditText","archived":false,"fork":false,"pushed_at":"2020-09-10T21:50:29.000Z","size":144,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T05:44:47.330Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devapro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2020-09-10T15:54:37.000Z","updated_at":"2021-05-31T09:34:19.000Z","dependencies_parsed_at":"2023-05-29T07:00:41.761Z","dependency_job_id":null,"html_url":"https://github.com/devapro/NumberWatcher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devapro/NumberWatcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devapro%2FNumberWatcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devapro%2FNumberWatcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devapro%2FNumberWatcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devapro%2FNumberWatcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devapro","download_url":"https://codeload.github.com/devapro/NumberWatcher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devapro%2FNumberWatcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34445179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-11T17:20:21.405Z","updated_at":"2026-06-17T10:32:06.362Z","avatar_url":"https://github.com/devapro.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TextWatcher for number inputs\n\n - Validate user input\n - Replace \",\" to \".\"\n - Get only valid number string to listener\n - Adjusting numbers after decimal point (set 0 for integer)\n - Adding any string to the input end\n - set max positive value\n - set min negative value\n - enable or disable negative values fo input\n - add text mask (for example ##/##/##)\n \n ## Additional I created some useful extension functions\n \n you can find it in EditTextExtensions.kt\n \n - addTextListener - for easier adding text change listener (don't use with NumberWatcher)\n - setActionDoneListener - for listen \"done\" event\n - setNumberWatcher - for easier adding NumberWatcher\n \n ## How to use NumberWatcher:\n \n You can see more examples in MainActivity.kt or NumberWatcherTest.kt\n \n ### For input only integer values\n ```kotlin\n    val integersInput = findViewById\u003cEditText\u003e(R.id.integersInput)\n    val integersInputWatcherBuilder = NumberWatcher.Builder()\n    integersInputWatcherBuilder.numbersAfterDecimalPoint = 0 // because we need integers\n    integersInputWatcherBuilder.maxValue = 1000f // optional, for example max value 1000\n    integersInput.addTextChangedListener(integersInputWatcherBuilder.build(integersInput){\n        Log.d(\"integersInput\", it)\n    })\n```\n\n### For input float with fixed numbers after decimal point\n```kotlin\n    val floatsInput = findViewById\u003cEditText\u003e(R.id.floatsInput)\n    val floatsInputWatcherBuilder = NumberWatcher.Builder()\n    floatsInputWatcherBuilder.numbersAfterDecimalPoint = 2 // optional, for example we need only to numbers after decimal point\n    floatsInputWatcherBuilder.maxValue = 1000f // optional, for example max value 1000\n    floatsInput.addTextChangedListener(floatsInputWatcherBuilder.build(floatsInput){\n        Log.d(\"floatsInput\", it)\n    })\n```\n\n### For adding a string to the end of the input\n```kotlin\n    val withEndStringInput = findViewById\u003cEditText\u003e(R.id.withEndString)\n    val withEndStringInputWatcherBuilder = NumberWatcher.Builder()\n    withEndStringInputWatcherBuilder.numbersAfterDecimalPoint = 2 // optional, for example we need only to numbers after decimal point\n    withEndStringInputWatcherBuilder.maxValue = 100f // optional, for example max value 100\n    withEndStringInputWatcherBuilder.additional = \"%\" // optional, for example add % to the end of input\n    withEndStringInput.addTextChangedListener(withEndStringInputWatcherBuilder.build(withEndStringInput){\n        Log.d(\"withEndStringInput\", it)\n    })\n```\n\n### If you want to allow users to enter values between -100 and 100\n```kotlin\nval negativeValuesInput = findViewById\u003cEditText\u003e(R.id.negativeValuesInput)\nval negativeValuesInputWatcherBuilder = NumberWatcher.Builder()\n// optional, for example we need only to numbers after decimal point\nnegativeValuesInputWatcherBuilder.numbersAfterDecimalPoint = 2\nnegativeValuesInputWatcherBuilder.maxValue = 100f // optional, for example max value 100\nnegativeValuesInputWatcherBuilder.minValue = -100f // optional, for example min value -100\nnegativeValuesInputWatcherBuilder.allowNegativeValues = true\n// optional, for example add % to the end of input\nnegativeValuesInputWatcherBuilder.additional = \"%\"\nnegativeValuesInput.addTextChangedListener(negativeValuesInputWatcherBuilder.build(negativeValuesInput) {\n        Log.d(\"negativeValuesInput\", it)\n    })\n```\n\n### If you want to add a mask\n```kotlin\nval withMaskInput = findViewById\u003cEditText\u003e(R.id.withMaskInput)\nval withMaskInputWatcherBuilder = NumberWatcher.Builder()\n// optional, for example we need only to numbers after decimal point\nwithMaskInputWatcherBuilder.numbersAfterDecimalPoint = 2\nwithMaskInputWatcherBuilder.maxValue = 1000000f // optional, for example max value 100\nwithMaskInputWatcherBuilder.minValue = -2000000f // optional, for example min value -200\nwithMaskInputWatcherBuilder.allowNegativeValues = true\n// optional, for example add % to the end of input\nwithMaskInputWatcherBuilder.additional = \"%\"\nwithMaskInputWatcherBuilder.inputMask = \"##/##/##\"\nwithMaskInput.addTextChangedListener(withMaskInputWatcherBuilder.build(withMaskInput) {\n        Log.d(\"withMaskInput\", it)\n    })\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevapro%2Fnumberwatcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevapro%2Fnumberwatcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevapro%2Fnumberwatcher/lists"}