mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 10:51:52 +01:00
parent
18d385d5ac
commit
962247b2f4
@ -154,7 +154,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
|
||||
Coil.imageLoader(context)
|
||||
.execute(request).drawable?.let { drawable ->
|
||||
setLargeIcon((drawable as BitmapDrawable).bitmap)
|
||||
setLargeIcon((drawable as? BitmapDrawable)?.bitmap)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import android.animation.ValueAnimator
|
||||
import android.app.Dialog
|
||||
import android.graphics.Color
|
||||
import android.graphics.Rect
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import android.view.LayoutInflater
|
||||
@ -12,6 +13,7 @@ import android.view.View
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.animation.addListener
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.transition.ChangeBounds
|
||||
import androidx.transition.ChangeImageTransform
|
||||
import androidx.transition.TransitionManager
|
||||
@ -25,7 +27,7 @@ import eu.kanade.tachiyomi.util.view.animateBlur
|
||||
import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class FullCoverDialog(val controller: MangaDetailsController, drawable: Drawable, val thumbView: View) :
|
||||
class FullCoverDialog(val controller: MangaDetailsController, drawable: Drawable, private val thumbView: View) :
|
||||
Dialog(controller.activity!!, R.style.FullCoverDialogTheme) {
|
||||
|
||||
val activity = controller.activity
|
||||
@ -64,6 +66,9 @@ class FullCoverDialog(val controller: MangaDetailsController, drawable: Drawable
|
||||
.build()
|
||||
|
||||
expandedImageView.setImageDrawable(drawable)
|
||||
if (drawable !is BitmapDrawable) {
|
||||
binding.buttonContainer.isVisible = false
|
||||
}
|
||||
|
||||
val rect = Rect()
|
||||
thumbView.getGlobalVisibleRect(rect)
|
||||
|
@ -355,23 +355,26 @@ class MangaDetailsController :
|
||||
val request = ImageRequest.Builder(view.context).data(presenter.manga).allowHardware(false).memoryCacheKey(presenter.manga.key())
|
||||
.target(
|
||||
onSuccess = { drawable ->
|
||||
val bitmap = (drawable as BitmapDrawable).bitmap
|
||||
val bitmap = (drawable as? BitmapDrawable)?.bitmap
|
||||
// Generate the Palette on a background thread.
|
||||
Palette.from(bitmap).generate {
|
||||
if (it == null) return@generate
|
||||
val colorBack = view.context.getResourceColor(
|
||||
android.R.attr.colorBackground
|
||||
)
|
||||
// this makes the color more consistent regardless of theme
|
||||
val backDropColor =
|
||||
ColorUtils.blendARGB(it.getVibrantColor(colorBack), colorBack, .35f)
|
||||
if (bitmap != null) {
|
||||
Palette.from(bitmap).generate {
|
||||
if (it == null) return@generate
|
||||
val colorBack = view.context.getResourceColor(
|
||||
android.R.attr.colorBackground
|
||||
)
|
||||
// this makes the color more consistent regardless of theme
|
||||
val backDropColor =
|
||||
ColorUtils.blendARGB(it.getVibrantColor(colorBack), colorBack, .35f)
|
||||
|
||||
coverColor = backDropColor
|
||||
getHeader()?.setBackDrop(backDropColor)
|
||||
if (toolbarIsColored) {
|
||||
val translucentColor = ColorUtils.setAlphaComponent(backDropColor, 175)
|
||||
activityBinding?.toolbar?.setBackgroundColor(translucentColor)
|
||||
activity?.window?.statusBarColor = translucentColor
|
||||
coverColor = backDropColor
|
||||
getHeader()?.setBackDrop(backDropColor)
|
||||
if (toolbarIsColored) {
|
||||
val translucentColor =
|
||||
ColorUtils.setAlphaComponent(backDropColor, 175)
|
||||
activityBinding?.toolbar?.setBackgroundColor(translucentColor)
|
||||
activity?.window?.statusBarColor = translucentColor
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.mangaCoverFull.setImageDrawable(drawable)
|
||||
@ -1379,11 +1382,12 @@ class MangaDetailsController :
|
||||
|
||||
override fun zoomImageFromThumb(thumbView: View) {
|
||||
if (fullCoverActive) return
|
||||
val drawable = binding.mangaCoverFull.drawable ?: return
|
||||
fullCoverActive = true
|
||||
val expandedImageView = binding.mangaCoverFull
|
||||
drawable.alpha = 255
|
||||
val fullCoverDialog = FullCoverDialog(
|
||||
this,
|
||||
expandedImageView.drawable,
|
||||
drawable,
|
||||
thumbView
|
||||
)
|
||||
fullCoverDialog.setOnDismissListener {
|
||||
@ -1393,7 +1397,6 @@ class MangaDetailsController :
|
||||
fullCoverActive = false
|
||||
}
|
||||
fullCoverDialog.show()
|
||||
return
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -73,7 +73,7 @@
|
||||
android:layout_height="match_parent"
|
||||
app:fastScrollerBubbleEnabled="true" />
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/manga_cover_full"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
Loading…
Reference in New Issue
Block a user