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