mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 05:29:18 +01:00
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:
parent
5c0ccde9fa
commit
95e52e0d2e
@ -2,16 +2,19 @@ package eu.kanade.tachiyomi.ui.manga
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
|
import android.graphics.Bitmap
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.graphics.RenderEffect
|
import android.graphics.RenderEffect
|
||||||
import android.graphics.Shader
|
import android.graphics.Shader
|
||||||
|
import android.graphics.drawable.BitmapDrawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
|
import androidx.core.graphics.drawable.toDrawable
|
||||||
import androidx.core.view.isInvisible
|
import androidx.core.view.isInvisible
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import coil.request.CachePolicy
|
import coil.request.CachePolicy
|
||||||
@ -128,10 +131,11 @@ class MangaHeaderHolder(
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
|
backdrop.alpha = 0.2f
|
||||||
backdrop.setRenderEffect(
|
backdrop.setRenderEffect(
|
||||||
RenderEffect.createBlurEffect(
|
RenderEffect.createBlurEffect(
|
||||||
10f,
|
20f,
|
||||||
10f,
|
20f,
|
||||||
Shader.TileMode.MIRROR
|
Shader.TileMode.MIRROR
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -466,6 +470,21 @@ class MangaHeaderHolder(
|
|||||||
error(drawable)
|
error(drawable)
|
||||||
if (manga.favorite) networkCachePolicy(CachePolicy.READ_ONLY)
|
if (manga.favorite) networkCachePolicy(CachePolicy.READ_ONLY)
|
||||||
diskCachePolicy(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)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user