mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 14:47:48 +01:00
Use ShapeableImageView for rounded thumbnails instead of Coil transformations
This commit is contained in:
parent
59aef13200
commit
0e26abf7a6
11 changed files with 21 additions and 38 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
android:background="?attr/selectableItemBackground"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/cover"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -22,6 +22,7 @@
|
|||
app:layout_constraintDimensionRatio="h,3:2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:shapeAppearance="@style/ShapeAppearanceOverlay.Cover"
|
||||
tools:src="@mipmap/ic_launcher" />
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
android:background="@drawable/list_item_selector_background"
|
||||
android:paddingHorizontal="8dp">
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/thumbnail"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
|
@ -18,6 +18,7 @@
|
|||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:shapeAppearance="@style/ShapeAppearanceOverlay.Cover"
|
||||
tools:src="@mipmap/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
android:layout_marginBottom="12dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/track_search_cover"
|
||||
android:layout_width="68dp"
|
||||
android:layout_height="95dp"
|
||||
|
@ -26,6 +26,7 @@
|
|||
android:scaleType="centerCrop"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:shapeAppearance="@style/ShapeAppearanceOverlay.Cover"
|
||||
tools:src="@mipmap/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/list_item_selector_background"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="4dp">
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/manga_cover"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:scaleType="centerCrop"
|
||||
|
@ -19,6 +19,7 @@
|
|||
app:layout_constraintDimensionRatio="h,1:1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:shapeAppearance="@style/ShapeAppearanceOverlay.Cover"
|
||||
tools:src="@mipmap/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -327,6 +327,11 @@
|
|||
<item name="cornerSize">8dp</item>
|
||||
</style>
|
||||
|
||||
<style name="ShapeAppearanceOverlay.Cover" parent="">
|
||||
<item name="cornerFamily">rounded</item>
|
||||
<item name="cornerSize">@dimen/card_radius</item>
|
||||
</style>
|
||||
|
||||
<style name="ThemeOverlay.Tachiyomi.Dialog.Fullscreen" parent="ThemeOverlay.MaterialComponents">
|
||||
<item name="android:windowIsFloating">false</item>
|
||||
<item name="android:windowBackground">?android:attr/colorBackground</item>
|
||||
|
|
Loading…
Reference in a new issue