{"id":16933023,"url":"https://github.com/saket/better-link-movement-method","last_synced_at":"2025-04-12T22:36:20.790Z","repository":{"id":47845374,"uuid":"68443703","full_name":"saket/Better-Link-Movement-Method","owner":"saket","description":"Attempts to improve how clickable links are detected, highlighted and handled in TextView","archived":false,"fork":false,"pushed_at":"2024-03-17T15:50:38.000Z","size":973,"stargazers_count":778,"open_issues_count":9,"forks_count":78,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-05-22T06:12:33.810Z","etag":null,"topics":["android","link-movement","textview","url"],"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/saket.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":"2016-09-17T09:34:55.000Z","updated_at":"2024-06-15T05:42:13.483Z","dependencies_parsed_at":"2024-06-15T05:42:10.191Z","dependency_job_id":"933b9079-d644-4fe9-8379-5505594a5ec1","html_url":"https://github.com/saket/Better-Link-Movement-Method","commit_stats":null,"previous_names":["saketme/betterlinkmovementmethod"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saket%2FBetter-Link-Movement-Method","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saket%2FBetter-Link-Movement-Method/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saket%2FBetter-Link-Movement-Method/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saket%2FBetter-Link-Movement-Method/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saket","download_url":"https://codeload.github.com/saket/Better-Link-Movement-Method/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248642810,"owners_count":21138352,"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","link-movement","textview","url"],"created_at":"2024-10-13T20:48:20.148Z","updated_at":"2025-04-12T22:36:20.771Z","avatar_url":"https://github.com/saket.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BetterLinkMovementMethod\n\n![Better-Link-Movement-Method](https://github.com/Saketme/Better-Link-Movement-Method/blob/master/EXAMPLE.gif)\n\nWhen `android:autoLink` or `Linkify.addLinks` is used to add links to a TextView, Android uses a class known as `LinkMovementMethod` for highlighting links when they're focused and dispatching Intents when they're clicked.\n\nBetterLinkMovementMethod improves over `LinkMovementMethod`, by fixing some of its flaws:\n\n* No support for custom click listeners. For e.g., phone numbers always show up in the dialer when clicked and there's no way to change that.\n* Incorrect calculation of touch areas for links, resulting in ghost touch areas ([video](http://saket.me/wp-content/uploads/2016/09/Incorrect-touch-areas.mp4)).\n* Unreliable highlighting of links ([video](http://saket.me/wp-content/uploads/2016/09/Unreliable-highlighting.mp4)).\n\nA detailed explanation of why (and when) you should use `BetterLinkMovementMethod` can be read here: http://saket.me/better-url-handler-textview-android/\n\n## Usage\n`BetterLinkMovementMethod` is designed to be a drop-in replacement for `LinkMovementMethod`:\n```gradle\ndependencies {\n  implementation 'me.saket:better-link-movement-method:2.2.0'\n}\n```\n\n```kotlin\nval textView = findViewById(...)\nLinkify.addLinks(textView, Linkify.ALL)\ntextView.movementMethod = BetterLinkMovementMethod.getInstance()\n```\n\nClick listeners can be registered by creating a unique instance of `BetterLinkMovementMethod` for each `TextView`:\n\n```kotlin\ntextView.movementMethod = BetterLinkMovementMethod.newInstance().apply {\n  setOnLinkClickListener { textView, url -\u003e\n    // Handle click or return false to let the framework handle this link.\n    true\n  }\n  setOnLinkLongClickListener { textView, url -\u003e\n    // Handle long-click or return false to let the framework handle this link.\n    true\n  }\n```\n\n## License\n\n```\nCopyright 2018 Saket Narayan.\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaket%2Fbetter-link-movement-method","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaket%2Fbetter-link-movement-method","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaket%2Fbetter-link-movement-method/lists"}