ar-android/AndroidSvgLoader


Android library for load svg from internet to imageview

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.ar-android:AndroidSvgLoader:1.0.2'
	}
	dependencies {
		implementation("com.github.ar-android:AndroidSvgLoader:1.0.2")
	}
	<dependency>
	    <groupId>com.github.ar-android</groupId>
	    <artifactId>AndroidSvgLoader</artifactId>
	    <version>1.0.2</version>
	</dependency>

                            
    libraryDependencies += "com.github.ar-android" % "AndroidSvgLoader" % "1.0.2"
        
        

                            
    :dependencies [[com.github.ar-android/AndroidSvgLoader "1.0.2"]]
        
        

Readme


AndroidSvgLoader

Android library for load svg from internet to imageview

Installation

build.gradle

allprojects {
  repositories {
   maven { url 'https://jitpack.io' }
  }
 }

app/build.grdle

implementation 'com.github.ar-android:AndroidSvgLoader:1.0.2'

or

compile 'com.github.ar-android:AndroidSvgLoader:1.0.2'

Usage

public class MainActivity extends AppCompatActivity {

    private ImageView image;
    private String url;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        url = "http://www.clker.com/cliparts/u/Z/2/b/a/6/android-toy-h.svg";

        image = (ImageView) findViewById(R.id.image);

        SvgLoader.pluck()
                .with(this)
                .setPlaceHolder(R.mipmap.ic_launcher, R.mipmap.ic_launcher)
                .load(url, image);
    }

    /**
     * Use this if you need to load svg from a specific directory
     */
    private void loadFromUri(){
        Uri uri = Uri.parse("android.resource://com.ahmadrosid.androidsvgloader/" + R.raw.sample);
        SvgLoader.pluck()
                .with(this)
                .setPlaceHolder(R.mipmap.ic_launcher, R.mipmap.ic_launcher)
                .load(uri, image);
    }

    @Override protected void onDestroy() {
        super.onDestroy();
        SvgLoader.pluck().close();
    }
}

License

Licensed under the Apache license 2.0.