{"id":15646414,"url":"https://github.com/nickm-27/linkpreview","last_synced_at":"2025-04-30T12:22:58.069Z","repository":{"id":40659663,"uuid":"137663166","full_name":"NickM-27/LinkPreview","owner":"NickM-27","description":"An easy to use library for showing a link preview","archived":false,"fork":false,"pushed_at":"2022-03-01T14:09:26.000Z","size":3008,"stargazers_count":49,"open_issues_count":7,"forks_count":12,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T16:06:20.296Z","etag":null,"topics":["android","jetpack-android","kotlin-android","kotlin-coroutines","kotlin-library","linkpreview"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","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/NickM-27.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"NickM-27","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2018-06-17T14:55:46.000Z","updated_at":"2024-07-05T02:32:23.000Z","dependencies_parsed_at":"2022-08-10T00:10:41.828Z","dependency_job_id":null,"html_url":"https://github.com/NickM-27/LinkPreview","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NickM-27%2FLinkPreview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NickM-27%2FLinkPreview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NickM-27%2FLinkPreview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NickM-27%2FLinkPreview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NickM-27","download_url":"https://codeload.github.com/NickM-27/LinkPreview/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251700975,"owners_count":21629847,"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","jetpack-android","kotlin-android","kotlin-coroutines","kotlin-library","linkpreview"],"created_at":"2024-10-03T12:12:48.048Z","updated_at":"2025-04-30T12:22:58.050Z","avatar_url":"https://github.com/NickM-27.png","language":"Kotlin","funding_links":["https://github.com/sponsors/NickM-27","https://paypal.me/nickmowen","https://www.buymeacoffee.com/jTsYwF4mR"],"categories":[],"sub_categories":[],"readme":"# LinkPreview\nA convenient library to show clickable previews of links.\n\n\u003cimg src=\"/sample.png\" width=\"32%\"\u003e\n\n# Features\n\n* Parse entire body of text to automatically find links.\n* Find links from different sources and open them in the appropriate app, falling back to a custom tab if none is found.\n\n# How Do I Use It?\n\n## Setup\n\n### Gradle\n\nThis library is now distributed as part of `mavenCentral()`\n\nOn your module's `build.gradle` file add this statement to the `dependencies` section:\n\n```groovy\ndependencies {\n    implementation 'com.nicknackdevelopment:linkpreview:4.0'\n}\n```\n\nAlso make sure that the `repositories` section includes both jcenter and `maven` section with the `\"google()\"` endpoint. \n\n```groovy\nrepositories {\n    jcenter()\n    google()\n}\n```\n\n# Link Preview\n\n### Add to your layout\n\n```xml\n\u003cLinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\"\u003e\n\n    ...\n\n    \u003ccom.nick.mowen.linkpreview.view.LinkPreview\n        android:id=\"@+id/preview\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\" /\u003e\n\n\u003c/LinearLayout\u003e\n```\n\n### Create And Setup The View\n\n```kotlin\nval preview: LinkPreview = findViewById(R.id.preview)\n...\npreview.parseTextForLink(string) //Use LinkPreview$parseTextForLink if you have a body of text that contains more than just the link\npreview.setLink(linkString) //Use when you have a string that contains only the link\n```\n\n### Customize The View\n\n```kotlin\npreview.articleColor = ContextCompat.getColor(this, R.color.colorPrimary) //Set the color of the custom tab that is launched on link press\n\n//Use the load listener if you want to take extra action when a link error or success occurs\npreview.loadListener = object : LinkListener {\n\n    override fun onError() {\n        Toast.makeText(this@MainActivity, \"Link loading failed\", Toast.LENGTH_SHORT).show()\n    }\n\n    override fun onSuccess(link: String) {\n\n    }\n}\n```\n\n### Advanced Usage\n\nYou can override the LinkPreview clicklistener all together using the click listener\n```kotlin\npreview.clickListener = object : LinkClickListener {\n\n        override fun onLinkClicked(view: View?, url: String) {\n                \n        }\n}\n```\n\n### Data Binding\n\nLinkPreview supports data binding commands so the view can be customized in xml\n```xml\n    \u003ccom.nick.mowen.linkpreview.view.LinkPreview\n        android:id=\"@+id/preview\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\" \n        app:parsedLink=\"@{data.string}\"/\u003e\n```\n\nAppications using LinkPreview\n---\nIcon | Application\n------------ | -------------\n\u003cimg src=\"https://github.com/NickM-27/Texpert/blob/master/app/src/main/res/mipmap-hdpi/ic_launcher.png\" width=\"48\" height=\"48\" /\u003e | [Texpert](https://play.google.com/store/apps/details?id=com.nick.mowen.texpert)\n\nPlease [email](mailto:nick@nicknackdevelopment.com) me or send a pull request if you would like to be added here.\n\nAlso Seen On\n---\n![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-LinkPreview-green.svg?style=flat)\n\nDeveloped By\n---\nNick Mowen - \u003cnick@nicknackdevelopment.com\u003e\n\nContributions\n-------\n\nAny contributions are welcome!\n\n# Donations\nIf you would like to donate / contribute to future development, you can [paypal me here](https://paypal.me/nickmowen)\n\n\u003ca href=\"https://www.buymeacoffee.com/jTsYwF4mR\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" style=\"height: 51px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n\nLicense\n---\n\n    Copyright 2018 Nick Nack Developments\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickm-27%2Flinkpreview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickm-27%2Flinkpreview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickm-27%2Flinkpreview/lists"}