Created
February 18, 2020 04:51
-
-
Save rahulkhatri19/77e31930664fdb83a6dce958f07d0ac9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// package com.example. | |
import android.graphics.drawable.Drawable | |
import android.graphics.drawable.PictureDrawable | |
import android.widget.ImageView | |
import com.bumptech.glide.RequestBuilder | |
import com.bumptech.glide.load.DataSource | |
import com.bumptech.glide.load.engine.GlideException | |
import com.bumptech.glide.request.RequestListener | |
import com.bumptech.glide.request.target.ImageViewTarget | |
import com.bumptech.glide.request.target.Target | |
class SvgSoftwareLayerSetter : RequestListener<PictureDrawable> { | |
override fun onLoadFailed( | |
e: GlideException?, | |
model: Any?, | |
target: Target<PictureDrawable>?, | |
isFirstResource: Boolean | |
): Boolean { | |
val view:ImageView = (target as ImageViewTarget<*>).view | |
view.setLayerType(ImageView.LAYER_TYPE_NONE, null) | |
return false | |
} | |
override fun onResourceReady( | |
resource: PictureDrawable?, | |
model: Any?, | |
target: Target<PictureDrawable>?, | |
dataSource: DataSource?, | |
isFirstResource: Boolean | |
): Boolean { | |
val view:ImageView = (target as ImageViewTarget<*>).view | |
view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null) | |
return false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment