mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 07:51:52 +01:00
Square covers in list view (closes #3121)
This commit is contained in:
parent
471d5d62d5
commit
3357e878a5
@ -2,6 +2,9 @@ package eu.kanade.tachiyomi.ui.browse.source.browse
|
|||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||||
|
import com.bumptech.glide.request.RequestOptions
|
||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
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
|
||||||
@ -40,12 +43,14 @@ class SourceListHolder(private val view: View, adapter: FlexibleAdapter<*>) :
|
|||||||
|
|
||||||
override fun setImage(manga: Manga) {
|
override fun setImage(manga: Manga) {
|
||||||
GlideApp.with(view.context).clear(thumbnail)
|
GlideApp.with(view.context).clear(thumbnail)
|
||||||
|
|
||||||
if (!manga.thumbnail_url.isNullOrEmpty()) {
|
if (!manga.thumbnail_url.isNullOrEmpty()) {
|
||||||
|
val radius = view.context.resources.getDimensionPixelSize(R.dimen.card_radius)
|
||||||
|
val requestOptions = RequestOptions().transform(CenterCrop(), RoundedCorners(radius))
|
||||||
GlideApp.with(view.context)
|
GlideApp.with(view.context)
|
||||||
.load(manga.toMangaThumbnail())
|
.load(manga.toMangaThumbnail())
|
||||||
.diskCacheStrategy(DiskCacheStrategy.DATA)
|
.diskCacheStrategy(DiskCacheStrategy.DATA)
|
||||||
.centerCrop()
|
.apply(requestOptions)
|
||||||
.circleCrop()
|
|
||||||
.dontAnimate()
|
.dontAnimate()
|
||||||
.placeholder(android.R.color.transparent)
|
.placeholder(android.R.color.transparent)
|
||||||
.into(thumbnail)
|
.into(thumbnail)
|
||||||
|
@ -60,6 +60,7 @@ class LibraryGridHolder(
|
|||||||
.load(item.manga.toMangaThumbnail())
|
.load(item.manga.toMangaThumbnail())
|
||||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||||
.centerCrop()
|
.centerCrop()
|
||||||
|
.dontAnimate()
|
||||||
.into(thumbnail)
|
.into(thumbnail)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,11 @@ package eu.kanade.tachiyomi.ui.library
|
|||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||||
|
import com.bumptech.glide.request.RequestOptions
|
||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.glide.GlideApp
|
import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||||
import eu.kanade.tachiyomi.data.glide.toMangaThumbnail
|
import eu.kanade.tachiyomi.data.glide.toMangaThumbnail
|
||||||
import eu.kanade.tachiyomi.util.isLocal
|
import eu.kanade.tachiyomi.util.isLocal
|
||||||
@ -59,11 +63,13 @@ class LibraryListHolder(
|
|||||||
|
|
||||||
// Update the cover.
|
// Update the cover.
|
||||||
GlideApp.with(itemView.context).clear(thumbnail)
|
GlideApp.with(itemView.context).clear(thumbnail)
|
||||||
|
|
||||||
|
val radius = view.context.resources.getDimensionPixelSize(R.dimen.card_radius)
|
||||||
|
val requestOptions = RequestOptions().transform(CenterCrop(), RoundedCorners(radius))
|
||||||
GlideApp.with(itemView.context)
|
GlideApp.with(itemView.context)
|
||||||
.load(item.manga.toMangaThumbnail())
|
.load(item.manga.toMangaThumbnail())
|
||||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||||
.centerCrop()
|
.apply(requestOptions)
|
||||||
.circleCrop()
|
|
||||||
.dontAnimate()
|
.dontAnimate()
|
||||||
.into(thumbnail)
|
.into(thumbnail)
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,11 @@ package eu.kanade.tachiyomi.ui.migration
|
|||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||||
|
import com.bumptech.glide.request.RequestOptions
|
||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.glide.GlideApp
|
import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||||
import eu.kanade.tachiyomi.data.glide.toMangaThumbnail
|
import eu.kanade.tachiyomi.data.glide.toMangaThumbnail
|
||||||
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
||||||
@ -26,11 +30,13 @@ class MangaHolder(
|
|||||||
|
|
||||||
// Update the cover.
|
// Update the cover.
|
||||||
GlideApp.with(itemView.context).clear(thumbnail)
|
GlideApp.with(itemView.context).clear(thumbnail)
|
||||||
|
|
||||||
|
val radius = itemView.context.resources.getDimensionPixelSize(R.dimen.card_radius)
|
||||||
|
val requestOptions = RequestOptions().transform(CenterCrop(), RoundedCorners(radius))
|
||||||
GlideApp.with(itemView.context)
|
GlideApp.with(itemView.context)
|
||||||
.load(item.manga.toMangaThumbnail())
|
.load(item.manga.toMangaThumbnail())
|
||||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||||
.centerCrop()
|
.apply(requestOptions)
|
||||||
.circleCrop()
|
|
||||||
.dontAnimate()
|
.dontAnimate()
|
||||||
.into(thumbnail)
|
.into(thumbnail)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,9 @@ package eu.kanade.tachiyomi.ui.recent.updates
|
|||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||||
|
import com.bumptech.glide.request.RequestOptions
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.download.model.Download
|
import eu.kanade.tachiyomi.data.download.model.Download
|
||||||
import eu.kanade.tachiyomi.data.glide.GlideApp
|
import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||||
@ -54,14 +57,6 @@ class UpdatesHolder(private val view: View, private val adapter: UpdatesAdapter)
|
|||||||
// Set manga title
|
// Set manga title
|
||||||
manga_title.text = item.manga.title
|
manga_title.text = item.manga.title
|
||||||
|
|
||||||
// Set cover
|
|
||||||
GlideApp.with(itemView.context).clear(manga_cover)
|
|
||||||
GlideApp.with(itemView.context)
|
|
||||||
.load(item.manga.toMangaThumbnail())
|
|
||||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
|
||||||
.circleCrop()
|
|
||||||
.into(manga_cover)
|
|
||||||
|
|
||||||
// Check if chapter is read and set correct color
|
// Check if chapter is read and set correct color
|
||||||
if (item.chapter.read) {
|
if (item.chapter.read) {
|
||||||
chapter_title.setTextColor(readColor)
|
chapter_title.setTextColor(readColor)
|
||||||
@ -73,6 +68,18 @@ class UpdatesHolder(private val view: View, private val adapter: UpdatesAdapter)
|
|||||||
|
|
||||||
// Set chapter status
|
// Set chapter status
|
||||||
notifyStatus(item.status)
|
notifyStatus(item.status)
|
||||||
|
|
||||||
|
// Set cover
|
||||||
|
GlideApp.with(itemView.context).clear(manga_cover)
|
||||||
|
|
||||||
|
val radius = itemView.context.resources.getDimensionPixelSize(R.dimen.card_radius)
|
||||||
|
val requestOptions = RequestOptions().transform(CenterCrop(), RoundedCorners(radius))
|
||||||
|
GlideApp.with(itemView.context)
|
||||||
|
.load(item.manga.toMangaThumbnail())
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||||
|
.apply(requestOptions)
|
||||||
|
.dontAnimate()
|
||||||
|
.into(manga_cover)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,9 +14,7 @@
|
|||||||
android:layout_width="@dimen/material_component_lists_single_line_with_avatar_height"
|
android:layout_width="@dimen/material_component_lists_single_line_with_avatar_height"
|
||||||
android:layout_height="@dimen/material_component_lists_single_line_with_avatar_height"
|
android:layout_height="@dimen/material_component_lists_single_line_with_avatar_height"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginStart="8dp"
|
android:padding="8dp"
|
||||||
android:paddingTop="8dp"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
@ -12,7 +12,9 @@
|
|||||||
android:layout_width="56dp"
|
android:layout_width="56dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:paddingStart="16dp"
|
android:paddingStart="16dp"
|
||||||
|
android:paddingTop="8dp"
|
||||||
android:paddingEnd="0dp"
|
android:paddingEnd="0dp"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
Loading…
Reference in New Issue
Block a user