{"id":21946838,"url":"https://github.com/rasheedsulayman/animatedcounttextview","last_synced_at":"2025-04-22T22:27:01.040Z","repository":{"id":95607365,"uuid":"223169575","full_name":"rasheedsulayman/AnimatedCountTextView","owner":"rasheedsulayman","description":"🚀 A library that helps you animate change in numeric values in a TextView","archived":false,"fork":false,"pushed_at":"2019-12-02T20:42:14.000Z","size":8510,"stargazers_count":27,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T19:34:24.910Z","etag":null,"topics":["android","animation","count","library","number","percentage","rise","textview"],"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/rasheedsulayman.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-11-21T12:31:06.000Z","updated_at":"2022-11-15T08:52:25.000Z","dependencies_parsed_at":"2023-06-26T01:01:59.240Z","dependency_job_id":null,"html_url":"https://github.com/rasheedsulayman/AnimatedCountTextView","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasheedsulayman%2FAnimatedCountTextView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasheedsulayman%2FAnimatedCountTextView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasheedsulayman%2FAnimatedCountTextView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasheedsulayman%2FAnimatedCountTextView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rasheedsulayman","download_url":"https://codeload.github.com/rasheedsulayman/AnimatedCountTextView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250333291,"owners_count":21413356,"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","animation","count","library","number","percentage","rise","textview"],"created_at":"2024-11-29T04:35:29.842Z","updated_at":"2025-04-22T22:27:01.031Z","avatar_url":"https://github.com/rasheedsulayman.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AnimatedCountTextView\n\nA library that helps you animate change in numeric values in a `TextView`.\n\n[![Build Status](https://travis-ci.com/r4sh33d/AnimatedCountTextView.svg?token=8TPyvGS2YqpBT3ypdxNc\u0026branch=master)](https://travis-ci.com/r4sh33d/AnimatedCountTextView)\n[ ![Download](https://api.bintray.com/packages/r4sh33d/maven/AnimatedCountTextView/images/download.svg) ](https://bintray.com/r4sh33d/maven/AnimatedCountTextView/_latestVersion)\n\n## Gradle Dependency\n\nAdd the dependency to your app's `build.gradle`:\n\n```groovy\nimplementation 'com.r4sh33d:AnimatedCountTextView:0.0.1'\n```\n\n## Usage\n\nAdd the `AnimatedCountTextView` to your layout. \n\n```xml\n\u003ccom.r4sh33d.animatedcounttextview.AnimatedCountTextView\n    app:startWith=\"0\"\n    app:endWith=\"100\"\n    app:duration=\"4000\"\n    app:suffix=\"%\"\n    app:numberType=\"integer\"\n    android:id=\"@+id/textView\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    android:text=\"0\"\n    android:textSize=\"30sp\" /\u003e\n```\n\nThen call the `start()` method to start the count: \n\n```kotlin\ncountTextView.start()\n```\n\nYou can optionally listen for the count end event by setting a `CountEndListener`\n\n```kotlin\ncountTextView.countEndListener(object : CountEndListener {\n      override fun onCountFinish() {\n           // Do something \n      }\n   })\n```\n\nIf required, you can also stop the count at any time by calling the `stop()` method:\n```kotlin\ncountTextView.stop()\n```\n\nThat's all for basic usage. Your `AnimatedCountTextView` should animate form your `startWith` value to `endWith` value within the given time `duration`.\n\n## Customisation\n`AnimatedCountTextView` attempts to use some default values to simplify the usage. The behaviour can be further \ncustomized by setting the following attributes via `xml` or `code`. \n\n### Start and End values\nYou can use the xml attributes `startWith` and the `endWith` values to specify the value to animate from, and value to animate to, respectively.  \n \n```xml\n\u003ccom.r4sh33d.animatedcounttextview.AnimatedCountTextView\n    ...\n    app:startWith=\"0\"\n    app:endWith=\"100\"/\u003e\n```\nor programmatically:\n```kotlin\ncountTextView.startWith(0)\ncountTextView.endWith(100)\n```\n\n### Duration\nYou can specify the duration(in milliseconds) for the count-up or count-down animation using the `duration` attribute in xml.   \n \n```xml\n\u003ccom.r4sh33d.animatedcounttextview.AnimatedCountTextView\n    ...\n    app:duration=\"4000\"/\u003e\n```\nor programmatically:\n```kotlin\ncountTextView.duration(4000)\n```\n\n### Number Type\nYou can use `NumberType` to specify the type of number you want to animate. You can either specify `NumberType.Integer()` or `NumberType.Decimal()`. You can also apply custom formatting to display the animated values. Custom formats can be specified by passing a `DecimalFormat` to `NumberType.Integer()` or `NumberType.Decimal()` constructor. The default `NumberType` is `Integer`.\n \n```xml\n\u003ccom.r4sh33d.animatedcounttextview.AnimatedCountTextView\n    ...\n    app:numberType=\"integer\"/\u003e\n```\nProgrammatically:\n```kotlin\ncountTextView.numberType(NumberType.Decimal(twoDecimalPlacesFormat))\n//or \ncountTextView.numberType(NumberType.Integer())\n```\n### Prefix and Suffix\nYou can specify `prefix` and/or `suffix` to the animated values. This is useful if you want to specify a currency symbol as a `prefix` or the percentage sign as the `suffix`.\n \n```xml\n\u003ccom.r4sh33d.animatedcounttextview.AnimatedCountTextView\n    ...\n    app:suffix=\"%\"\n    app:prefix=\"$\"/\u003e\n```\nor programmatically:\n```kotlin\ncountTextView.prefix(\"$\")\n//or \ncountTextView.suffix(\"%\")\n```\n\n### Interpolator\nYou can specify the [Interpolator](https://developer.android.com/reference/android/view/animation/Interpolator) to use when animating the values. This can only be done programmatically:\n```kotlin\ncountTextView.interpolator(AccelerateDecelerateInterpolator())\n```\n\n##  License\n\n    Copyright (c) 2019 Rasheed Sulayman.\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%2Frasheedsulayman%2Fanimatedcounttextview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frasheedsulayman%2Fanimatedcounttextview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasheedsulayman%2Fanimatedcounttextview/lists"}