Move cover card outline clipping code from item to holder classes

This commit is contained in:
arkon 2020-05-16 16:32:14 -04:00
parent e810b343cf
commit 471d5d62d5
4 changed files with 8 additions and 6 deletions

View File

@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.data.glide.toMangaThumbnail
import eu.kanade.tachiyomi.widget.StateImageViewTarget
import kotlinx.android.synthetic.main.source_grid_item.card
import kotlinx.android.synthetic.main.source_grid_item.progress
import kotlinx.android.synthetic.main.source_grid_item.thumbnail
import kotlinx.android.synthetic.main.source_grid_item.title
@ -39,6 +40,9 @@ class SourceGridHolder(private val view: View, private val adapter: FlexibleAdap
}
override fun setImage(manga: Manga) {
// Setting this via XML doesn't work
card.clipToOutline = true
GlideApp.with(view.context).clear(thumbnail)
if (!manga.thumbnail_url.isNullOrEmpty()) {
GlideApp.with(view.context)

View File

@ -34,9 +34,6 @@ class SourceItem(val manga: Manga, private val catalogueAsList: Preference<Boole
val parent = adapter.recyclerView
return if (parent is AutofitRecyclerView) {
view.apply {
// Setting this via XML doesn't work
card.clipToOutline = true
card.layoutParams = FrameLayout.LayoutParams(
MATCH_PARENT, parent.itemWidth / 3 * 4
)

View File

@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.data.glide.toMangaThumbnail
import eu.kanade.tachiyomi.util.isLocal
import eu.kanade.tachiyomi.util.view.visibleIf
import kotlinx.android.synthetic.main.source_grid_item.card
import kotlinx.android.synthetic.main.source_grid_item.download_text
import kotlinx.android.synthetic.main.source_grid_item.local_text
import kotlinx.android.synthetic.main.source_grid_item.thumbnail
@ -50,6 +51,9 @@ class LibraryGridHolder(
// set local visibility if its local manga
local_text.visibleIf { item.manga.isLocal() }
// Setting this via XML doesn't work
card.clipToOutline = true
// Update the cover.
GlideApp.with(view.context).clear(thumbnail)
GlideApp.with(view.context)

View File

@ -39,9 +39,6 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference
val parent = adapter.recyclerView
return if (parent is AutofitRecyclerView) {
view.apply {
// Setting this via XML doesn't work
card.clipToOutline = true
val coverHeight = parent.itemWidth / 3 * 4
card.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, coverHeight)
gradient.layoutParams = FrameLayout.LayoutParams(