{"id":13989430,"url":"https://github.com/danylovolokh/HashTagHelper","last_synced_at":"2025-07-22T10:32:28.456Z","repository":{"id":39618003,"uuid":"48558596","full_name":"danylovolokh/HashTagHelper","owner":"danylovolokh","description":"This is a library designed for highlighting hashtags (\"#example\") and catching click on them.","archived":false,"fork":false,"pushed_at":"2020-10-11T20:00:10.000Z","size":99,"stargazers_count":592,"open_issues_count":15,"forks_count":71,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-11-21T04:43:43.069Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/danylovolokh.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}},"created_at":"2015-12-24T22:44:20.000Z","updated_at":"2024-04-11T09:38:50.000Z","dependencies_parsed_at":"2022-09-16T11:32:15.627Z","dependency_job_id":null,"html_url":"https://github.com/danylovolokh/HashTagHelper","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/danylovolokh%2FHashTagHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danylovolokh%2FHashTagHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danylovolokh%2FHashTagHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danylovolokh%2FHashTagHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danylovolokh","download_url":"https://codeload.github.com/danylovolokh/HashTagHelper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227079364,"owners_count":17727996,"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-09T13:01:38.912Z","updated_at":"2024-11-29T08:31:22.220Z","avatar_url":"https://github.com/danylovolokh.png","language":"Java","funding_links":[],"categories":["Java","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"readme":"# HashTagHelper\nThis is a library designed for highlighting hashtags (\"#example\") and catching click on them.\n\n[![Android_weekly](https://img.shields.io/badge/Android%20Weekly-HashTagHelper-green.svg)](http://androidweekly.net/issues/issue-185)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-HashTagHelper-green.svg?style=true)](https://android-arsenal.com/details/1/2953) \n\n#Usage\nAdd this snippet to your project build.gradle file:\n```\nbuildscript {\n    repositories {\n        jcenter()\n    }\n}\n```\nAdd this snippet to your module build.gradle file:\n\n```\ndependencies {\n    compile 'com.github.danylovolokh:hashtag-helper:1.1.0'\n}\n```\nGetting click events and highligthing hashtags.\n```\nprivate HashTagHelper mTextHashTagHelper;\n\nprivate TextView mHashTagText;\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n\n  mHashTagText = (TextView) findViewById(R.id.text);\n  mTextHashTagHelper = HashTagHelper.Creator.create(getResources().getColor(R.color.colorPrimary), new HashTagHelper.OnHashTagClickListener() {\n    @Override\n    public void onHashTagClicked(String hashTag) {\n        \n    }\n  });\n        \n  // pass a TextView or any descendant of it (incliding EditText) here.\n  // Hash tags that are in the text will be hightlighed with a color passed to HasTagHelper\n  mTextHashTagHelper.handle(mHashTagText);\n}\n```\nHighlighting without click events.\nJust set \"null\" instead of HashTagHelper.OnHashTagClickListener;\n```\nmTextHashTagHelper = HashTagHelper.Creator.create(getResources().getColor(R.color.colorPrimary), null);\nmTextHashTagHelper.handle(mHashTagText);\n```\nBy default only digits and letters are valid symbols for hashtag\nTo add support of custom symbols like '_' or '-' you need to specify another parameter when creating HashTagHelper\n```\nchar[] additionalSymbols = new char[]{\n                '_',\n                '$'\n        };\n// If you set additional symbols not only letters and digits will be a valid symbols for hashtag\n// Example: \"hash_tag_with_underscore_and$dolar$sign$is$also$valid_hashtag\"\nmTextHashTagHelper = HashTagHelper.Creator.create(getResources().getColor(R.color.colorPrimary), null, additionalSymbols);\nmTextHashTagHelper.handle(mHashTagText);\n\n```\nTo get all hashtags from text.\n```\n// get all hashtags with \"#\", example: \"#blueeyes\"\nList\u003cString\u003e allHashTags = mTextHashTagHelper.getAllHashTags(true);\n\n// get all hashtags without \"#\", example: \"blueeyes\"\nList\u003cString\u003e allHashTags = mTextHashTagHelper.getAllHashTags(false);\n```\n#Demo\n![alt tag](https://cloud.githubusercontent.com/assets/2686355/11998408/e6aa1f62-aaa6-11e5-911a-c598b6853862.gif) ![alt tag](https://cloud.githubusercontent.com/assets/2686355/11998409/e6aa3ed4-aaa6-11e5-9797-100a024659cc.gif)\n\n# License\n\nCopyright 2015 Danylo Volokh\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanylovolokh%2FHashTagHelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanylovolokh%2FHashTagHelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanylovolokh%2FHashTagHelper/lists"}