feat: Blur toggle
This commit is contained in:
parent
07662a91f4
commit
8fb6357fb5
7 changed files with 128 additions and 30 deletions
|
@ -1104,13 +1104,19 @@ suspend fun View.pop() {
|
|||
|
||||
fun blurImage(imageView: ImageView, banner: String?){
|
||||
if (banner != null) {
|
||||
val context = imageView.context
|
||||
if (!(context as Activity).isDestroyed)
|
||||
Glide.with(context as Context)
|
||||
.load(GlideUrl(banner))
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL).override(400)
|
||||
.apply(RequestOptions.bitmapTransform(BlurTransformation(2, 2)))
|
||||
.into(imageView)
|
||||
val radius = PrefManager.getVal<Float>(PrefName.BlurRadius).toInt()
|
||||
val sampling = PrefManager.getVal<Float>(PrefName.BlurSampling).toInt()
|
||||
if (PrefManager.getVal(PrefName.BlurBanners)){
|
||||
val context = imageView.context
|
||||
if (!(context as Activity).isDestroyed)
|
||||
Glide.with(context as Context)
|
||||
.load(GlideUrl(banner))
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL).override(400)
|
||||
.apply(RequestOptions.bitmapTransform(BlurTransformation(radius, sampling)))
|
||||
.into(imageView)
|
||||
}else{
|
||||
imageView.loadImage(banner)
|
||||
}
|
||||
} else {
|
||||
imageView.setImageResource(R.drawable.linear_gradient_bg)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue