Update blur and alpha for manga backdrop

more alpha is applied for a12
more blur in general for a12

cover now uses the top half of the manga cover to target
This commit is contained in:
Jays2Kings 2021-07-20 23:22:48 -04:00
parent 5c0ccde9fa
commit 95e52e0d2e

View File

@ -2,16 +2,19 @@ package eu.kanade.tachiyomi.ui.manga
import android.annotation.SuppressLint
import android.content.res.ColorStateList
import android.graphics.Bitmap
import android.graphics.Color
import android.view.LayoutInflater
import android.graphics.RenderEffect
import android.graphics.Shader
import android.graphics.drawable.BitmapDrawable
import android.os.Build
import android.view.MotionEvent
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.core.graphics.ColorUtils
import androidx.core.graphics.drawable.toDrawable
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import coil.request.CachePolicy
@ -128,10 +131,11 @@ class MangaHeaderHolder(
true
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
backdrop.alpha = 0.2f
backdrop.setRenderEffect(
RenderEffect.createBlurEffect(
10f,
10f,
20f,
20f,
Shader.TileMode.MIRROR
)
)
@ -466,6 +470,21 @@ class MangaHeaderHolder(
error(drawable)
if (manga.favorite) networkCachePolicy(CachePolicy.READ_ONLY)
diskCachePolicy(CachePolicy.READ_ONLY)
target(
onSuccess = {
val bitmap = (it as? BitmapDrawable)?.bitmap
if (bitmap == null) {
binding.backdrop.setImageDrawable(it)
return@target
}
val yOffset = (bitmap.height / 2 * 0.33).toInt()
binding.backdrop.setImageDrawable(
Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height - yOffset)
.toDrawable(itemView.resources)
)
}
)
}
)
}