{"id":21944157,"url":"https://github.com/cottacush/currencyedittext","last_synced_at":"2025-04-06T16:12:20.164Z","repository":{"id":35039035,"uuid":"194828548","full_name":"CottaCush/CurrencyEditText","owner":"CottaCush","description":"💰 A library to dynamically format your EditTexts to take currency inputs","archived":false,"fork":false,"pushed_at":"2024-05-21T19:48:42.000Z","size":8657,"stargazers_count":131,"open_issues_count":13,"forks_count":28,"subscribers_count":12,"default_branch":"develop","last_synced_at":"2024-05-29T07:17:50.420Z","etag":null,"topics":["android-library","currency-formatter","currencyedittext","edittext","kotlin","textwatcher"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/CottaCush.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2019-07-02T09:06:54.000Z","updated_at":"2024-06-01T00:29:05.503Z","dependencies_parsed_at":"2023-01-16T23:15:41.634Z","dependency_job_id":"78e88339-b19f-4b06-9af6-e65c20ad27d8","html_url":"https://github.com/CottaCush/CurrencyEditText","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CottaCush%2FCurrencyEditText","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CottaCush%2FCurrencyEditText/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CottaCush%2FCurrencyEditText/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CottaCush%2FCurrencyEditText/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CottaCush","download_url":"https://codeload.github.com/CottaCush/CurrencyEditText/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247509232,"owners_count":20950232,"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-library","currency-formatter","currencyedittext","edittext","kotlin","textwatcher"],"created_at":"2024-11-29T04:13:56.926Z","updated_at":"2025-04-06T16:12:20.138Z","avatar_url":"https://github.com/CottaCush.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CurrencyEditText \n\nA library to dynamically format your `EditTexts` to take currency inputs.\n\n[![ci](https://github.com/CottaCush/CurrencyEditText/actions/workflows/ci.yml/badge.svg)](https://github.com/CottaCush/CurrencyEditText/actions/workflows/ci.yml)\n[![Maven Central](https://img.shields.io/maven-central/v/com.cottacush/CurrencyEditText.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.cottacush%22%20AND%20a:%22CurrencyEditText%22)\n\n\u003cimg src=\"https://raw.githubusercontent.com/cottacush/currencyEditText/master/sample.gif\" width=\"280\" /\u003e\n\n\n## Gradle Dependency\n\nAdd the dependency to your app's `build.gradle`:\n\n```groovy\nimplementation 'com.cottacush:CurrencyEditText:\u003cinsert-latest-version-here\u003e'\n```\nFor versions, kindly head over to the [releases page](https://github.com/CottaCush/CurrencyEditText/releases)\n\n## Usage\n\nAdd the `CurrencyEditText` to your layout. \n```xml\n   \u003ccom.cottacush.android.currencyedittext.CurrencyEditText\n            ...\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"60dp\"\n            android:ems=\"10\"\n            android:id=\"@+id/editText\"/\u003e\n```\nThat's all for basic setup. Your `editText` should automatically format currency inputs.\n \n \n## Customisation\n\n### Currency Symbol\nYou can specify the currency symbol using the  `currencySymbol` and `useCurrencySymbolAsHint` attributes in xml. \nThe formatted currency value will be prepended with the `currencySymbol` value. The `currencySymbol` value can also \nbe used as hint, as described by the `useCurrencySymbolAsHint` attribute.\n \n```xml\n   \u003ccom.cottacush.android.currencyedittext.CurrencyEditText\n            ...\n            app:currencySymbol=\"₦\"\n            app:useCurrencySymbolAsHint=\"true\"/\u003e\n```\nor programmatically:\n```kotlin\n   currencyEditText.setCurrencySymbol(\"₦\", useCurrencySymbolAsHint = true)\n```\n\n### Locale \nThe `CurrencyEditText` uses the default `Locale` if no locale is specified. `Locale` can be specified programmatically via\n```kotlin\n   currencyEditText.setLocale(locale)\n```\n Locales can also be specified using locale-tags. The locale tag method requires API 21 and above. Instructions on how to construct\n valid `Locale` and locale-tags can be found [here](https://docs.oracle.com/javase/tutorial/i18n/locale/create.html#factory).\n  \n ```xml\n    \u003ccom.cottacush.android.currencyedittext.CurrencyEditText\n             ...\n             app:localeTag=\"en-NG\"/\u003e\n ```\n or programmatically via \n \n ```kotlin\n    currencyEditText.setLocale(\"en-NG\") //Requires API level 21 and above.\n ```\n \n### Decimal Places\nThe maximum number of decimal digits can be specified using the `maxNumberOfDecimalDigits` attributes in the xml, requiring\na minimum value of 1. It has a default value of 2.\n\n```xml\n   \u003ccom.cottacush.android.currencyedittext.CurrencyEditText\n            ...\n            app:maxNumberOfDecimalDigits=\"3\" /\u003e\n```\nor programmatically:\n```kotlin\n   currencyEditText.setMaxNumberOfDecimalDigits(3)\n```\n        \n## Getting the input value\n\nNumeric values for the editText can be gotten as shown below. \n ```kotlin\n    currencyEditText.getNumericValue()\n ```\nIf you need a `BigDecimal` to continue your monetary calculations right away, you can get it by  \n ```kotlin\n    currencyEditText.getNumericValueBigDecimal()\n ```\n\n## Using the formatter directly\nIf you'd like to use the library with any `EditText` widget, you can attach your `EditText` with the `CurrencyInputWatcher` class:\n  \n ```kotlin\n    editText.addTextChangedListener(CurrencyInputWatcher(editText,\"₦\", Locale.getDefault()))\n ```\n \n##  License\n\n    Copyright (c) 2019 Cotta \u0026 Cush Limited.\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcottacush%2Fcurrencyedittext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcottacush%2Fcurrencyedittext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcottacush%2Fcurrencyedittext/lists"}