mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
18 lines
694 B
Kotlin
18 lines
694 B
Kotlin
package com.simplemobiletools.gallery.pro.svg
|
|
|
|
import android.graphics.drawable.PictureDrawable
|
|
import com.bumptech.glide.load.Options
|
|
import com.bumptech.glide.load.engine.Resource
|
|
import com.bumptech.glide.load.resource.SimpleResource
|
|
import com.bumptech.glide.load.resource.transcode.ResourceTranscoder
|
|
import com.caverock.androidsvg.SVG
|
|
|
|
class SvgDrawableTranscoder : ResourceTranscoder<SVG, PictureDrawable> {
|
|
override fun transcode(toTranscode: Resource<SVG>, options: Options): Resource<PictureDrawable>? {
|
|
val svg = toTranscode.get()
|
|
val picture = svg.renderToPicture()
|
|
val drawable = PictureDrawable(picture)
|
|
return SimpleResource(drawable)
|
|
}
|
|
}
|