From 0e26abf7a63e7d9a9e719ae9e25483c5a6d9b21f Mon Sep 17 00:00:00 2001 From: arkon Date: Tue, 31 Aug 2021 22:35:52 -0400 Subject: [PATCH] Use ShapeableImageView for rounded thumbnails instead of Coil transformations --- .../ui/browse/migration/manga/MigrationMangaHolder.kt | 9 ++------- .../ui/browse/source/browse/SourceListHolder.kt | 3 --- .../eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt | 9 ++------- .../kanade/tachiyomi/ui/manga/track/TrackSearchHolder.kt | 6 +----- .../kanade/tachiyomi/ui/recent/history/HistoryHolder.kt | 6 +----- .../kanade/tachiyomi/ui/recent/updates/UpdatesHolder.kt | 7 +------ app/src/main/res/layout/history_item.xml | 3 ++- app/src/main/res/layout/source_list_item.xml | 3 ++- app/src/main/res/layout/track_search_item.xml | 3 ++- app/src/main/res/layout/updates_item.xml | 5 +++-- app/src/main/res/values/styles.xml | 5 +++++ 11 files changed, 21 insertions(+), 38 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaHolder.kt index af63f683ca..b74c4fece0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaHolder.kt @@ -3,9 +3,7 @@ package eu.kanade.tachiyomi.ui.browse.migration.manga import android.view.View import coil.clear import coil.loadAny -import coil.transform.RoundedCornersTransformation import eu.davidea.viewholders.FlexibleViewHolder -import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.databinding.SourceListItemBinding class MigrationMangaHolder( @@ -24,11 +22,8 @@ class MigrationMangaHolder( fun bind(item: MigrationMangaItem) { binding.title.text = item.manga.title - // Update the cover. - val radius = itemView.context.resources.getDimension(R.dimen.card_radius) + // Update the cover binding.thumbnail.clear() - binding.thumbnail.loadAny(item.manga) { - transformations(RoundedCornersTransformation(radius)) - } + binding.thumbnail.loadAny(item.manga) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceListHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceListHolder.kt index c6d020fe83..e12b963510 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceListHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceListHolder.kt @@ -4,7 +4,6 @@ import android.view.View import androidx.core.view.isVisible import coil.clear import coil.loadAny -import coil.transform.RoundedCornersTransformation import eu.davidea.flexibleadapter.FlexibleAdapter import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.coil.MangaCoverFetcher @@ -53,10 +52,8 @@ class SourceListHolder(private val view: View, adapter: FlexibleAdapter<*>) : override fun setImage(manga: Manga) { binding.thumbnail.clear() if (!manga.thumbnail_url.isNullOrEmpty()) { - val radius = view.context.resources.getDimension(R.dimen.card_radius) binding.thumbnail.loadAny(manga) { setParameter(MangaCoverFetcher.USE_CUSTOM_COVER, false) - transformations(RoundedCornersTransformation(radius)) } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt index 22e8deef1b..9de429c259 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt @@ -4,9 +4,7 @@ import android.view.View import androidx.core.view.isVisible import coil.clear import coil.loadAny -import coil.transform.RoundedCornersTransformation import eu.davidea.flexibleadapter.FlexibleAdapter -import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.databinding.SourceListItemBinding /** @@ -57,11 +55,8 @@ class LibraryListHolder( onLongClick(itemView) } - // Update the cover. - val radius = view.context.resources.getDimension(R.dimen.card_radius) + // Update the cover binding.thumbnail.clear() - binding.thumbnail.loadAny(item.manga) { - transformations(RoundedCornersTransformation(radius)) - } + binding.thumbnail.loadAny(item.manga) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchHolder.kt index c7d253aa18..4183a93ea3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchHolder.kt @@ -4,10 +4,8 @@ import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView import coil.clear import coil.loadAny -import coil.transform.RoundedCornersTransformation import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.databinding.TrackSearchItemBinding -import eu.kanade.tachiyomi.util.system.dpToPx import java.util.Locale class TrackSearchHolder( @@ -24,9 +22,7 @@ class TrackSearchHolder( binding.trackSearchTitle.text = track.title binding.trackSearchCover.clear() if (track.cover_url.isNotEmpty()) { - binding.trackSearchCover.loadAny(track.cover_url) { - transformations(RoundedCornersTransformation(6.dpToPx.toFloat())) - } + binding.trackSearchCover.loadAny(track.cover_url) } val hasStatus = track.publishing_status.isNotBlank() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryHolder.kt index 8661cb845e..a3ac1dea35 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryHolder.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.recent.history import android.view.View import coil.clear import coil.loadAny -import coil.transform.RoundedCornersTransformation import eu.davidea.viewholders.FlexibleViewHolder import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.MangaChapterHistory @@ -66,10 +65,7 @@ class HistoryHolder( } // Set cover - val radius = itemView.context.resources.getDimension(R.dimen.card_radius) binding.cover.clear() - binding.cover.loadAny(item.manga) { - transformations(RoundedCornersTransformation(radius)) - } + binding.cover.loadAny(item.manga) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesHolder.kt index e3226de05b..5ba0c7dfb5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesHolder.kt @@ -4,8 +4,6 @@ import android.view.View import androidx.core.view.isVisible import coil.clear import coil.loadAny -import coil.transform.RoundedCornersTransformation -import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.databinding.UpdatesItemBinding import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.ui.manga.chapter.base.BaseChapterHolder @@ -55,10 +53,7 @@ class UpdatesHolder(private val view: View, private val adapter: UpdatesAdapter) binding.download.setState(item.status, item.progress) // Set cover - val radius = itemView.context.resources.getDimension(R.dimen.card_radius) binding.mangaCover.clear() - binding.mangaCover.loadAny(item.manga) { - transformations(RoundedCornersTransformation(radius)) - } + binding.mangaCover.loadAny(item.manga) } } diff --git a/app/src/main/res/layout/history_item.xml b/app/src/main/res/layout/history_item.xml index bdd77bc56e..f56f47f7bc 100644 --- a/app/src/main/res/layout/history_item.xml +++ b/app/src/main/res/layout/history_item.xml @@ -12,7 +12,7 @@ android:background="?attr/selectableItemBackground" android:orientation="horizontal"> - - - - 8dp + +