Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Latest commit

 

History

History
67 lines (55 loc) · 1.91 KB

README.md

File metadata and controls

67 lines (55 loc) · 1.91 KB

Deprecated

This was an early attempt to get SVG to load with Glide, while it does work it does not support image tinting and probably some other things that I have not noticed yet.

I have since found a better library that does support tinting etc: Glide SVG. ()

I will no longer be maintaining this library.


GlideForSVG

Android Library for adding a Glide SVG module to your Android project

https://jitpack.io/#projectdelta6/GlideForSVG

Add it to your module/build.gradle with:

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

and:

dependencies {
    // add Glide to your project
    implementation ("com.github.bumptech.glide:glide:4.11.0")
    kapt 'com.github.bumptech.glide:compiler:4.11.0'

    //GlideForSVG
    compile 'com.github.projectdelta6:GlideForSVG:{latest version}'
}
//apply kotlin annotation processor for kotlin
apply plugin 'kotlin-kapt'

To be able to load SVG and other(png, jpeg, etc.) in your project:

Add a 'normal' AppGlideModule in your project, eg:

import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.module.AppGlideModule

@GlideModule
class YourGlideModuleNameHere: AppGlideModule() {
    // add your Glide customisation here...
}

And Use in your code like this:

lateinit var glideRqBuilder: GlideRequests

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    //...
    // init your GlideRequests object
    glideRqBuilder = GlideApp.with(this)
    //...
    // Load an image into an ImageView(standard Glide process): 
    glideHelper
        .load(yourImageUri)
        .into(yourImageView)
}