Skip to content
Preview URL for Android
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea init library Dec 2, 2018
app restructure project Dec 2, 2018
gradle/wrapper init library Dec 2, 2018
screenshots add screenshot Dec 2, 2018
urlembeddedview update version to 1.0.2 Dec 2, 2018
.gitignore update .gitignore Dec 2, 2018
LICENSE Update LICENSE Nov 28, 2018
README.md Update README.md Aug 5, 2019
build.gradle init library Dec 2, 2018
gradle.properties init library Dec 2, 2018
gradlew init library Dec 2, 2018
gradlew.bat init library Dec 2, 2018
settings.gradle init library Dec 2, 2018

README.md

URLEmbeddedView

Build Status

URLEmbeddedView is a Android library which allows you show preview data of your URL.

You can also:

Pass URL to view and you can load some data of this URL to preview.
And of course URLEmbeddedView itself is open source forever.

Requirements

  • OS: Android
  • minSdkVersion: 15

Installation

Just add the dependency to your build.gradle:

dependencies {
    implementation 'com.github.nguyencse:urlembeddedview:1.0.2'
}

And DO NOT forget to add internet permission in manifest if already not present

    <uses-permission android:name="android.permission.INTERNET" />

Usage

In xml file:

   <com.nguyencse.URLEmbeddedView
        android:id="@+id/uev"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:title="Title"
        app:description="Description"
        app:host="abc.com"
        app:favor="@drawable/ic_url"
        app:thumbnail="@drawable/ic_url"/>

In code:

   URLEmbeddedView urlEmbeddedView = findViewById(R.id.uev);
   
   urlEmbeddedView.setURL("stackoverflow.com", new URLEmbeddedView.OnLoadURLListener() {
       @Override
       public void onLoadURLCompleted(URLEmbeddedData data) {
           urlEmbeddedView.title(data.getTitle());
           urlEmbeddedView.description(data.getDescription());
           urlEmbeddedView.host(data.getHost());
           urlEmbeddedView.thumbnail(data.getThumbnailURL());
           urlEmbeddedView.favor(data.getFavorURL());
       }
   });

Or you can use your layout to custom it:

   URLEmbeddedTask urlTask = new URLEmbeddedTask(new URLEmbeddedTask.OnLoadURLListener() {
       @Override
       public void onLoadURLCompleted(URLEmbeddedData data) {
           // handle your code here
       }
   });
   urlTask.execute(url);

Demo

You can’t perform that action at this time.