{"id":13644475,"url":"https://github.com/broakenmedia/CharCountTextView","last_synced_at":"2025-04-21T10:33:25.313Z","repository":{"id":143546782,"uuid":"82869253","full_name":"broakenmedia/CharCountTextView","owner":"broakenmedia","description":"A Twitter style post length counter which can be bound to an EditText and provide callbacks when hitting a max character count.","archived":false,"fork":false,"pushed_at":"2017-08-23T22:06:53.000Z","size":98,"stargazers_count":122,"open_issues_count":0,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-22T06:12:38.649Z","etag":null,"topics":[],"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/broakenmedia.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}},"created_at":"2017-02-23T01:12:48.000Z","updated_at":"2023-08-13T11:33:15.000Z","dependencies_parsed_at":"2024-01-14T11:18:27.761Z","dependency_job_id":"31f2959b-d708-44c7-842f-0b3e2e4b39fe","html_url":"https://github.com/broakenmedia/CharCountTextView","commit_stats":null,"previous_names":["xbroak/charcounttextview"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/broakenmedia%2FCharCountTextView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/broakenmedia%2FCharCountTextView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/broakenmedia%2FCharCountTextView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/broakenmedia%2FCharCountTextView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/broakenmedia","download_url":"https://codeload.github.com/broakenmedia/CharCountTextView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250040461,"owners_count":21365109,"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":[],"created_at":"2024-08-02T01:02:05.620Z","updated_at":"2025-04-21T10:33:24.815Z","avatar_url":"https://github.com/broakenmedia.png","language":"Java","readme":"# CharCountTextView\n\n[![](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)\n\u003ca target=\"_blank\" href=\"https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#ICE_CREAM_SANDWICH\"\u003e\u003cimg src=\"https://img.shields.io/badge/API-14%2B-blue.svg?style=flat\" alt=\"API\" /\u003e\u003c/a\u003e \n\nA Twitter style post length counter which can be bound to an EditText and provide callbacks when hitting a max character count.\n\nOnce bound to an EditText the characters remaining will go down as the user types. If the user goes over the max limit\nyou will get notified and the view will show how much they are over (-5 etc.) where you can disable UI accordingly.\n\n**Note:** When the user has 10% or less characters remaining the text color will change to use the \"exceededTextColor\" \nbelow (Default: RED)\n\nNormal             |  Count Exceeded\n:-------------------------:|:-------------------------:\n![](http://i.imgur.com/VgpFwfy.png)  |  ![](http://i.imgur.com/A3NK4wC.png)\n\n\n##Install\n\nAdd this to your project build.gradle\n``` gradle\nallprojects {\n    repositories {\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\n\nAdd this to your module build.gradle\n\n``` gradle\ndependencies {\n    compile 'com.github.broakenmedia:CharCountTextView:v1.0'\n}\n```\n###Usage\n\nAdd the following xml to your layout xml\n\n```  xml\n\u003ccom.wafflecopter.charcounttextview.CharCountTextView\n    android:id=\"@+id/tvTextCounter\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    app:maxCharacters=\"150\" //Optional - Defaults to 150 (Twitter Emulation)\n    app:exceededTextColor=\"#ff0000\" //Optional - Defaults to RED\n/\u003e \n```\n\nThen in your activity/fragment:\n\n```java\nCharCountTextView tvCharCount = (CharCountTextView) findViewById(R.id.tvTextCounter);\ntvCharCount.setEditText(EDITTEXT_I_WISH_TO_COUNT_FOR);\ntvCharCount.setCharCountChangedListener(new CharCountTextView.CharCountChangedListener() {\n    @Override\n    public void onCountChanged(int countRemaining, boolean hasExceededLimit) {\n        //Enable disable tweet button for example\n    }\n});\n```\n\n### Additonal Methods\nTo set the max no. of characters and character count exceeded text color dynamically:\n\n```java\n - setMaxCharacters(int maxCharacters); \n - setExceededTextColor(int colorRes); //Font color will change to this when count has 10% or less remaining\n```\n\n\n## License\n\n```\nCopyright (c) BroakenMedia 2016-2017\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","funding_links":[],"categories":["TextView"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbroakenmedia%2FCharCountTextView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbroakenmedia%2FCharCountTextView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbroakenmedia%2FCharCountTextView/lists"}