Fix large cover
This commit is contained in:
@@ -121,13 +121,7 @@ class ChaptersFragment :
|
|||||||
(activity as? DetailsActivity)?.showChapterMissingDialog(item.chapter.id)
|
(activity as? DetailsActivity)?.showChapterMissingDialog(item.chapter.id)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val options = ActivityOptions.makeScaleUpAnimation(
|
val options = ActivityOptions.makeScaleUpAnimation(view, 0, 0, view.width, view.height)
|
||||||
view,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
view.measuredWidth,
|
|
||||||
view.measuredHeight
|
|
||||||
)
|
|
||||||
startActivity(
|
startActivity(
|
||||||
ReaderActivity.newIntent(
|
ReaderActivity.newIntent(
|
||||||
context = view.context,
|
context = view.context,
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class DetailsFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onItemClick(item: Bookmark, view: View) {
|
override fun onItemClick(item: Bookmark, view: View) {
|
||||||
val options = ActivityOptions.makeScaleUpAnimation(view, 0, 0, view.measuredWidth, view.measuredHeight)
|
val options = ActivityOptions.makeScaleUpAnimation(view, 0, 0, view.width, view.height)
|
||||||
startActivity(ReaderActivity.newIntent(view.context, item), options.toBundle())
|
startActivity(ReaderActivity.newIntent(view.context, item), options.toBundle())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,13 +245,9 @@ class DetailsFragment :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
R.id.imageView_cover -> {
|
R.id.imageView_cover -> {
|
||||||
val options = ActivityOptions.makeSceneTransitionAnimation(
|
val options = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.width, v.height)
|
||||||
requireActivity(),
|
|
||||||
binding.imageViewCover,
|
|
||||||
binding.imageViewCover.transitionName,
|
|
||||||
)
|
|
||||||
startActivity(
|
startActivity(
|
||||||
ImageActivity.newIntent(v.context, manga.largeCoverUrl ?: manga.coverUrl),
|
ImageActivity.newIntent(v.context, manga.largeCoverUrl.ifNullOrEmpty { manga.coverUrl }),
|
||||||
options.toBundle()
|
options.toBundle()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -317,20 +313,20 @@ class DetailsFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun loadCover(manga: Manga) {
|
private fun loadCover(manga: Manga) {
|
||||||
val currentCover = binding.imageViewCover.drawable
|
val imageUrl = manga.largeCoverUrl.ifNullOrEmpty { manga.coverUrl }
|
||||||
|
val lastResult = CoilUtils.result(binding.imageViewCover)
|
||||||
|
if (lastResult?.request?.data == imageUrl) {
|
||||||
|
return
|
||||||
|
}
|
||||||
val request = ImageRequest.Builder(context ?: return)
|
val request = ImageRequest.Builder(context ?: return)
|
||||||
.target(binding.imageViewCover)
|
.target(binding.imageViewCover)
|
||||||
if (currentCover != null) {
|
.data(imageUrl)
|
||||||
request.data(manga.largeCoverUrl ?: return)
|
.crossfade(true)
|
||||||
.placeholderMemoryCacheKey(CoilUtils.result(binding.imageViewCover)?.request?.memoryCacheKey)
|
.referer(manga.publicUrl)
|
||||||
.fallback(currentCover)
|
|
||||||
} else {
|
|
||||||
request.crossfade(true)
|
|
||||||
.data(manga.coverUrl)
|
|
||||||
.fallback(R.drawable.ic_placeholder)
|
|
||||||
}
|
|
||||||
request.referer(manga.publicUrl)
|
|
||||||
.lifecycle(viewLifecycleOwner)
|
.lifecycle(viewLifecycleOwner)
|
||||||
.enqueueWith(coil)
|
lastResult?.drawable?.let {
|
||||||
|
request.fallback(it)
|
||||||
|
} ?: request.fallback(R.drawable.ic_placeholder)
|
||||||
|
request.enqueueWith(coil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@ package org.koitharu.kotatsu.main.ui
|
|||||||
|
|
||||||
import android.app.ActivityOptions
|
import android.app.ActivityOptions
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@@ -318,15 +317,7 @@ class MainActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenReader(manga: Manga) {
|
private fun onOpenReader(manga: Manga) {
|
||||||
val options = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
val options = ActivityOptions.makeScaleUpAnimation(binding.fab, 0, 0, binding.fab.width, binding.fab.height)
|
||||||
ActivityOptions.makeClipRevealAnimation(
|
|
||||||
binding.fab, 0, 0, binding.fab.measuredWidth, binding.fab.measuredHeight
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
ActivityOptions.makeScaleUpAnimation(
|
|
||||||
binding.fab, 0, 0, binding.fab.measuredWidth, binding.fab.measuredHeight
|
|
||||||
)
|
|
||||||
}
|
|
||||||
startActivity(ReaderActivity.newIntent(this, manga), options?.toBundle())
|
startActivity(ReaderActivity.newIntent(this, manga), options?.toBundle())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:foreground="?selectableItemBackground"
|
android:foreground="?selectableItemBackground"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
android:transitionName="cover"
|
|
||||||
app:layout_constraintDimensionRatio="H,13:18"
|
app:layout_constraintDimensionRatio="H,13:18"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0"
|
app:layout_constraintHorizontal_bias="0"
|
||||||
|
|||||||
@@ -7,8 +7,7 @@
|
|||||||
<com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
<com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||||
android:id="@+id/ssiv"
|
android:id="@+id/ssiv"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent" />
|
||||||
android:transitionName="cover" />
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:foreground="?selectableItemBackground"
|
android:foreground="?selectableItemBackground"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
android:transitionName="cover"
|
|
||||||
app:layout_constraintDimensionRatio="H,13:18"
|
app:layout_constraintDimensionRatio="H,13:18"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0"
|
app:layout_constraintHorizontal_bias="0"
|
||||||
|
|||||||
Reference in New Issue
Block a user