{"id":13537689,"url":"https://github.com/JMPergar/AwesomeText","last_synced_at":"2025-04-02T04:31:17.991Z","repository":{"id":27185463,"uuid":"30655452","full_name":"JMPergar/AwesomeText","owner":"JMPergar","description":"A tool that facilitates working with Spans on TextViews or any extension of them (EditTexts, Buttons...).","archived":false,"fork":false,"pushed_at":"2015-11-03T14:34:12.000Z","size":515,"stargazers_count":674,"open_issues_count":8,"forks_count":74,"subscribers_count":28,"default_branch":"master","last_synced_at":"2024-05-21T16:09:47.247Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JMPergar.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-02-11T15:51:35.000Z","updated_at":"2024-02-29T21:57:15.000Z","dependencies_parsed_at":"2022-08-17T17:10:48.627Z","dependency_job_id":null,"html_url":"https://github.com/JMPergar/AwesomeText","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/JMPergar%2FAwesomeText","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JMPergar%2FAwesomeText/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JMPergar%2FAwesomeText/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JMPergar%2FAwesomeText/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JMPergar","download_url":"https://codeload.github.com/JMPergar/AwesomeText/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246757189,"owners_count":20828850,"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-01T09:01:02.167Z","updated_at":"2025-04-02T04:31:12.982Z","avatar_url":"https://github.com/JMPergar.png","language":"Java","funding_links":[],"categories":["Java","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"readme":"# AwesomeText\n\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AwesomeText-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1554) [![](https://img.shields.io/badge/AndroidWeekly-%23141-blue.svg)](http://androidweekly.net/issues/issue-141) \n\n[![Hex.pm](https://img.shields.io/hexpm/l/plug.svg)](http://www.apache.org/licenses/LICENSE-2.0) [![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html)\n\n[![Download](https://api.bintray.com/packages/jmpergar/maven/AwesomeText/images/download.svg) ](https://bintray.com/jmpergar/maven/AwesomeText/_latestVersion)\n\nWorking with Spans is ugly and difficult to manage, it's like working with a goblin of Moria. Don't understand the Spans? With AwesomeText you will only have to work with the classic Adapter Pattern. All the ease and potential of a pattern you already know how to use.\n\nScreenshots\n-----------\n\n![Demo Screenshot][1]\n\nDownload\n--------\n\nDownload via Gradle:\n\n```groovy\n    dependencies {\n        compile 'com.jmpergar:AwesomeText:1.0.0'\n    }\n```\n\nOr via Maven:\n\n```xml\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.jmpergar\u003c/groupId\u003e\n        \u003cartifactId\u003eAwesomeText\u003c/artifactId\u003e\n        \u003cversion\u003e1.0.0\u003c/version\u003e\n        \u003ctype\u003eaar\u003c/type\u003e\n    \u003c/dependency\u003e\n```\n\nUsage\n-----\n\nOn the same way that you working with ListAdapter, you must implement an interface to delegate the creation of the view, in this case AwesomeTextHandler.ViewSpanRenderer interface. The method getView is the responsible of this.\n\n```java\n    public class HashtagsSpanRenderer implements AwesomeTextHandler.ViewSpanRenderer {\n\n        @Override\n        public View getView(String text, Context context) {\n            LayoutInflater inflater = LayoutInflater.from(context);\n            TextView hashtagView = inflater.inflate(R.layout.hashtag);\n            hashtagView.setText(text);\n            return hashtagView;\n        }\n    }\n```\n\nIf you want to manage click events only must to implement AwesomeTextHandler.ViewSpanClickListener.\n\n```java\n    public class MentionSpanRenderer implements AwesomeTextHandler.ViewSpanRenderer, AwesomeTextHandler.ViewSpanClickListener {\n\n        @Override\n        public View getView(String text, Context context) {\n            LayoutInflater inflater = LayoutInflater.from(context);\n            TextView mentionView = inflater.inflate(R.layout.mention);\n            mentionView.setText(text);\n            return mentionView;\n        }\n\n        @Override\n        public void onClick(String text, Context context) {\n            Toast.makeText(context, \"Hello \" + text, Toast.LENGTH_SHORT).show();\n        }\n    }\n```\n\nAnd finally you configure AwesomeTextHandler to view the changes. Now, when you call AwesomeTextHandler.setText the change will be rendered automatically.\n\n```java\n    public class MainActivity extends ActionBarActivity {\n    \n        private static final String HASHTAG_PATTERN = \"(#[\\\\p{L}0-9-_]+)\";\n        private static final String MENTION_PATTERN = \"(@[\\\\p{L}0-9-_]+)\";\n\n        @Override\n        protected void onCreate(Bundle savedInstanceState) {\n            super.onCreate(savedInstanceState);\n            setContentView(R.layout.activity_main);\n\n            TextView textView = (TextView) findViewById(R.id.textview);\n            EditText editText = (EditText) findViewById(R.id.editText);\n\n            AwesomeTextHandler awesomeTextViewHandler = new AwesomeTextHandler();\n            awesomeTextViewHandler\n                .addViewSpanRenderer(HASHTAG_PATTERN, new HashtagsSpanRenderer())\n                .addViewSpanRenderer(MENTION_PATTERN, new MentionSpanRenderer())\n                .setView(textView);\n\n            AwesomeTextHandler awesomeEditTextHandler = new AwesomeTextHandler();\n            awesomeEditTextHandler\n                .addViewSpanRenderer(HASHTAG_PATTERN, new HashtagsSpanRenderer())\n                .addViewSpanRenderer(MENTION_PATTERN, new MentionSpanRenderer())\n                .setView(editText);\n        }\n    }\n```\n\n\nDeveloped By\n------------\n\n* José Manuel Pereira García - \u003cjm.pereira.g@gmail.com\u003e\n\n\u003ca href=\"https://twitter.com/jmpergar\"\u003e\n  \u003cimg alt=\"Follow me on Twitter\" src=\"http://imageshack.us/a/img812/3923/smallth.png\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"http://www.linkedin.com/in/jmpergar\"\u003e\n  \u003cimg alt=\"Add me to Linkedin\" src=\"http://imageshack.us/a/img41/7877/smallld.png\" /\u003e\n\u003c/a\u003e\n\nWho's using it\n--------------\n\n* [Redbooth][2]\n\n*Does your app use AwesomeText? If you want to be featured on this list drop me a line.*\n\nContributors\n------------\n\n* [José Manuel Pereira García][3]\n\nLicense\n-------\n\n    Copyright 2015 José Manuel Pereira García\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\n\n[1]: https://raw.githubusercontent.com/JMPergar/AwesomeText/master/Screenshot.png\n[2]: https://redbooth.com\n[3]: https://github.com/JMPergar\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJMPergar%2FAwesomeText","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJMPergar%2FAwesomeText","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJMPergar%2FAwesomeText/lists"}