diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt index cc9f007458..613e23dea5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt @@ -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) { } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/FullCoverDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/FullCoverDialog.kt index 2cb136b490..4321e0fab4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/FullCoverDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/FullCoverDialog.kt @@ -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) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt index bb72d573d8..99707c7a19 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt @@ -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 { diff --git a/app/src/main/res/layout/manga_details_controller.xml b/app/src/main/res/layout/manga_details_controller.xml index f706289cec..c6c3233735 100644 --- a/app/src/main/res/layout/manga_details_controller.xml +++ b/app/src/main/res/layout/manga_details_controller.xml @@ -73,7 +73,7 @@ android:layout_height="match_parent" app:fastScrollerBubbleEnabled="true" /> -