mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-24 13:48:55 +03:00
Set expanded cover dimension ratio from the source image (#5721)
Avoids cropping.
This commit is contained in:
parent
63053b9940
commit
84d546b724
1 changed files with 12 additions and 2 deletions
|
@ -6,6 +6,7 @@ import android.view.ViewGroup
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import coil.loadAny
|
import coil.loadAny
|
||||||
|
import coil.target.ImageViewTarget
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
|
@ -262,8 +263,17 @@ class MangaInfoHeaderAdapter(
|
||||||
setFavoriteButtonState(manga.favorite)
|
setFavoriteButtonState(manga.favorite)
|
||||||
|
|
||||||
// Set cover if changed.
|
// Set cover if changed.
|
||||||
listOfNotNull(binding.mangaCover, binding.backdrop).forEach {
|
binding.backdrop.loadAny(manga)
|
||||||
it.loadAny(manga)
|
binding.mangaCover.loadAny(manga) {
|
||||||
|
listener(
|
||||||
|
onSuccess = { request, _ ->
|
||||||
|
(request.target as? ImageViewTarget)?.drawable?.let { drawable ->
|
||||||
|
val ratio = drawable.minimumWidth / drawable.minimumHeight.toFloat()
|
||||||
|
binding.root.getConstraintSet(R.id.end)
|
||||||
|
?.setDimensionRatio(R.id.manga_cover, ratio.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manga info section
|
// Manga info section
|
||||||
|
|
Loading…
Reference in a new issue