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