mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 19:31:49 +01:00
parent
36dfb2484a
commit
242c556346
@ -42,7 +42,7 @@ abstract class LibraryHolder(
|
||||
}
|
||||
|
||||
fun setReadingButton(item: LibraryItem) {
|
||||
play_layout.visibility = if (item.manga.unread > 0 && item.unreadType > 0 && !item.hideReadingButton)
|
||||
play_layout?.visibility = if (item.manga.unread > 0 && item.unreadType > 0 && !item.hideReadingButton)
|
||||
View.VISIBLE else View.GONE
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import eu.kanade.tachiyomi.util.system.dpToPx
|
||||
import eu.kanade.tachiyomi.util.view.gone
|
||||
import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
||||
import eu.kanade.tachiyomi.util.view.visible
|
||||
import eu.kanade.tachiyomi.util.view.visibleIf
|
||||
import kotlinx.android.synthetic.main.manga_list_item.*
|
||||
import kotlinx.android.synthetic.main.manga_list_item.view.*
|
||||
import kotlinx.android.synthetic.main.unread_download_badge.*
|
||||
@ -33,7 +34,6 @@ class LibraryListHolder(
|
||||
) : LibraryHolder(view, adapter) {
|
||||
|
||||
init {
|
||||
play_layout.setOnClickListener { playButtonClicked() }
|
||||
badge_view?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
marginEnd = (if (padEnd) 22 else 12).dpToPx
|
||||
}
|
||||
@ -59,7 +59,6 @@ class LibraryListHolder(
|
||||
title.textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||
card.gone()
|
||||
badge_view.gone()
|
||||
play_layout.gone()
|
||||
padding.gone()
|
||||
subtitle.gone()
|
||||
return
|
||||
@ -73,29 +72,21 @@ class LibraryListHolder(
|
||||
setUnreadBadge(badge_view, item)
|
||||
|
||||
subtitle.text = item.manga.author?.trim()
|
||||
subtitle.visibility = if (!item.manga.author.isNullOrBlank()) View.VISIBLE
|
||||
else View.GONE
|
||||
|
||||
setReadingButton(item)
|
||||
subtitle.visibleIf(!item.manga.author.isNullOrBlank())
|
||||
|
||||
// Update the cover.
|
||||
if (item.manga.thumbnail_url == null) Glide.with(view.context).clear(cover_thumbnail)
|
||||
else {
|
||||
val id = item.manga.id ?: return
|
||||
val height = itemView.context.resources.getDimensionPixelSize(R.dimen
|
||||
.material_component_lists_single_line_with_avatar_height)
|
||||
|
||||
GlideApp.with(view.context).load(item.manga)
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||
.signature(ObjectKey(MangaImpl.getLastCoverFetch(id).toString()))
|
||||
.override(height)
|
||||
.centerCrop()
|
||||
.into(cover_thumbnail)
|
||||
}
|
||||
}
|
||||
|
||||
private fun playButtonClicked() {
|
||||
adapter.libraryListener.startReading(adapterPosition)
|
||||
}
|
||||
|
||||
override fun onActionStateChanged(position: Int, actionState: Int) {
|
||||
super.onActionStateChanged(position, actionState)
|
||||
if (actionState == 2) {
|
||||
|
@ -8,10 +8,12 @@ import eu.davidea.flexibleadapter.items.IFlexible
|
||||
import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
||||
import kotlinx.android.synthetic.main.manga_list_item.*
|
||||
import kotlinx.android.synthetic.main.manga_list_item.subtitle
|
||||
import kotlinx.android.synthetic.main.manga_list_item.title
|
||||
|
||||
class MangaHolder(
|
||||
private val view: View,
|
||||
private val adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
|
||||
view: View,
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
|
||||
) : BaseFlexibleViewHolder(view, adapter) {
|
||||
|
||||
fun bind(item: MangaItem) {
|
||||
|
@ -2,15 +2,11 @@ package eu.kanade.tachiyomi.ui.source.browse
|
||||
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
import eu.davidea.flexibleadapter.items.IFlexible
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.widget.StateImageViewTarget
|
||||
import kotlinx.android.synthetic.main.manga_list_item.*
|
||||
|
||||
/**
|
||||
@ -42,16 +38,5 @@ class BrowseSourceListHolder(private val view: View, adapter: FlexibleAdapter<IF
|
||||
}
|
||||
|
||||
override fun setImage(manga: Manga) {
|
||||
if (manga.thumbnail_url.isNullOrEmpty()) {
|
||||
GlideApp.with(view.context).clear(contentView)
|
||||
} else {
|
||||
GlideApp.with(view.context)
|
||||
.load(manga)
|
||||
.diskCacheStrategy(DiskCacheStrategy.DATA)
|
||||
.dontAnimate()
|
||||
.placeholder(android.R.color.transparent)
|
||||
.transition(DrawableTransitionOptions.withCrossFade())
|
||||
.into(StateImageViewTarget(cover_thumbnail, progress))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,17 +6,18 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/constraint_layout"
|
||||
android:background="@drawable/list_item_selector"
|
||||
android:minHeight="@dimen/material_component_lists_single_line_with_avatar_height">
|
||||
android:background="@drawable/list_item_selector">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/card"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/material_layout_avatar"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="@color/background"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0">
|
||||
@ -24,11 +25,10 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cover_thumbnail"
|
||||
android:layout_width="@dimen/material_component_lists_single_line_with_avatar_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="@dimen/material_layout_avatar"
|
||||
android:layout_height="@dimen/material_layout_avatar"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="?android:attr/colorBackground"
|
||||
android:maxHeight="150dp"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@ -38,29 +38,6 @@
|
||||
tools:ignore="ContentDescription"
|
||||
tools:src="@mipmap/ic_launcher" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/play_layout"
|
||||
android:layout_width="@dimen/material_component_lists_single_line_with_avatar_height"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/play_button"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/round_play_background"
|
||||
android:contentDescription="@string/start_reading"
|
||||
android:padding="6dp"
|
||||
android:src="@drawable/ic_start_reading_white_24dp"
|
||||
android:tint="@android:color/white" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
@ -81,7 +58,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="3"
|
||||
@ -100,7 +77,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
|
Loading…
Reference in New Issue
Block a user