Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation "com.github.qkopy:richlinkpreview:[version]"
}
In XML
<com.qkopy.richlink.RichLinkViewQkopy
android:id="@+id/richLink"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
In Your Activity
richLink.setLink("your-url",this@MainActivity, object : ViewListener {
override fun onSuccess(status: Boolean) {
}
override fun onError(e: Exception) {
}
})
Setting a Custom Click listener
richLink.setDefaultClickListener(false)
richLink.setClickListener(object : RichLinkListener {
override fun onClicked(view: View, meta: MetaData?) {
TODO("Not yet implemented")
}
})
Set Link Cache size with
richLink.setDBCacheLimit(NO_OF_LINKS_TO_CACHE_INT)
