{"id":13832672,"url":"https://github.com/apradanas/simple-linkable-text","last_synced_at":"2025-07-09T19:30:57.011Z","repository":{"id":35842992,"uuid":"40126623","full_name":"apradanas/simple-linkable-text","owner":"apradanas","description":"Simple way to create linked text, such as @username or #hashtag, in Android TextView and EditText","archived":false,"fork":false,"pushed_at":"2015-10-10T03:43:05.000Z","size":2986,"stargazers_count":74,"open_issues_count":10,"forks_count":13,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-04T11:01:17.929Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apradanas.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}},"created_at":"2015-08-03T13:35:51.000Z","updated_at":"2024-03-08T07:46:07.000Z","dependencies_parsed_at":"2022-09-18T01:33:55.468Z","dependency_job_id":null,"html_url":"https://github.com/apradanas/simple-linkable-text","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apradanas%2Fsimple-linkable-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apradanas%2Fsimple-linkable-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apradanas%2Fsimple-linkable-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apradanas%2Fsimple-linkable-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apradanas","download_url":"https://codeload.github.com/apradanas/simple-linkable-text/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225581814,"owners_count":17491792,"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-04T11:00:27.120Z","updated_at":"2024-11-20T15:30:57.728Z","avatar_url":"https://github.com/apradanas.png","language":"Java","funding_links":[],"categories":["\u003ca name=\"android\"\u003e\u003c/a\u003eAndroid","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"readme":"# Simple Linkable Text\n\n [ ![Download](https://api.bintray.com/packages/apradanas/maven/simple-linkable-text/images/download.svg) ](https://bintray.com/apradanas/maven/simple-linkable-text/_latestVersion)\n [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Simple%20Linkable%20Text-green.svg?style=flat)](https://android-arsenal.com/details/1/2242)\n ![](https://img.shields.io/badge/platform-android-green.svg)\n\nSimple way to create link text, such as @username or #hashtag, in Android TextView and EditText\n\n![](https://raw.githubusercontent.com/apradanas/simple-linkable-text/master/screenshots/slt_demo.gif)\n\nInstallation\n------------\n##### Gradle\n\nAdd dependency\n\n```\ncompile 'com.apradanas.simplelinkabletext:library:1.0.3@aar'\n```\n\n\nFeatures\n--------\n\n- Match single strings or regex pattern to set links\n- Change the color of the linked text\n- Set the style of the linked text: **BOLD**, *ITALIC*, or ***BOLD_ITALIC***\n- Set the underlined of the linked text\n- Specify click actions of a specific word\n- OnTextChangedListener listener for LinkableEditText\n\nUsage\n-----\n### In your XML layout\n\n##### LinkableTextView\n\n```\n\u003ccom.apradanas.simplelinkabletext.LinkableTextView\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\" /\u003e\n```\n\n##### LinkableEditText\n\n```\n\u003ccom.apradanas.simplelinkabletext.LinkableEditText\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"/\u003e\n```\n\n### In your Activity / Fragment\n\n```\n/*\n**\tdefine rules\n*/\n\n// find hashtags\nLink linkHashtag = new Link(Pattern.compile(\"(#\\\\w+)\"))\n                \t.setUnderlined(true)\n                \t.setTextStyle(TextStyle.ITALIC)\n                \t.setClickListener(new Link.OnClickListener() {\n                    \t@Override\n                    \tpublic void onClick(String text) {\n                       \t\t// do something\n                    \t}\n                \t});\n\n// find username\nLink linkUsername = new Link(Pattern.compile(\"(@\\\\w+)\"))\n                \t.setUnderlined(false)\n                \t.setTextColor(Color.parseColor(\"#D00000\"))\n                \t.setTextStyle(TextStyle.BOLD)\n                \t.setClickListener(new Link.OnClickListener() {\n                   \t\t@Override\n                    \tpublic void onClick(String text) {\n                       \t\t// do something\n                    \t}\n                \t});\n\n// match string \"string\"\nLink linkAnd = new Link(\"string\")\n               \t\t.setTextColor(Color.BLUE)\n               \t\t.setTextStyle(TextStyle.BOLD_ITALIC)\n                \t.setClickListener(new Link.OnClickListener() {\n                   \t\t@Override\n                    \tpublic void onClick(String text) {\n                       \t\t// do something\n                    \t}\n                \t});\n\nList\u003cLink\u003e links = new ArrayList\u003c\u003e();\nlinks.add(linkHashtag);\nlinks.add(linkUsername);\nlinks.add(linkAnd);\n\n/*\n**\tadd rules to LinkableTextView\n**\tthen build()\n*/\nLinkableTextView textView = (LinkableTextView) findViewById(R.id.textView);\ntextView.setText(\"#test #LinkableTextView: detecting #hashtags and @username\")\n\t\t.addLinks(links)\n\t\t.build();\n\n/*\n**\tadd rules to LinkableEditText\n**\tno need to build()\n*/\nLinkableEditText editText = (LinkableEditText) findViewById(R.id.editText);\neditText.addLinks(links);\n```\n\n\nLicense\n-------\n\n    Copyright 2015 Aditya Pradana Sugiarto\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.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapradanas%2Fsimple-linkable-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapradanas%2Fsimple-linkable-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapradanas%2Fsimple-linkable-text/lists"}