mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2025-01-11 11:19:09 +01:00
Fix crash on recents when using grouped
This commit is contained in:
parent
2e563d7d0c
commit
cd2b348719
@ -0,0 +1,24 @@
|
||||
package eu.kanade.tachiyomi.ui.recents
|
||||
|
||||
import android.view.View
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.databinding.RecentsFooterItemBinding
|
||||
import eu.kanade.tachiyomi.ui.manga.chapter.BaseChapterHolder
|
||||
|
||||
class RecentMangaFooterHolder(
|
||||
view: View,
|
||||
val adapter: RecentMangaAdapter
|
||||
) : BaseChapterHolder(view, adapter) {
|
||||
private val binding = RecentsFooterItemBinding.bind(view)
|
||||
|
||||
fun bind(recentsType: Int) {
|
||||
when (recentsType) {
|
||||
RecentMangaHeaderItem.CONTINUE_READING -> {
|
||||
binding.title.setText(R.string.view_history)
|
||||
}
|
||||
RecentMangaHeaderItem.NEW_CHAPTERS -> {
|
||||
binding.title.setText(R.string.view_all_updates)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -23,17 +23,6 @@ class RecentMangaHolder(
|
||||
binding.cardLayout.setOnClickListener { adapter.delegate.onCoverClick(flexibleAdapterPosition) }
|
||||
}
|
||||
|
||||
fun bind(recentsType: Int) {
|
||||
when (recentsType) {
|
||||
RecentMangaHeaderItem.CONTINUE_READING -> {
|
||||
binding.title.setText(R.string.view_history)
|
||||
}
|
||||
RecentMangaHeaderItem.NEW_CHAPTERS -> {
|
||||
binding.title.setText(R.string.view_all_updates)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun bind(item: RecentMangaItem) {
|
||||
binding.downloadButton.downloadButton.visibleIf(item.mch.manga.source != LocalSource.ID)
|
||||
|
||||
|
@ -9,6 +9,7 @@ import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.database.models.Chapter
|
||||
import eu.kanade.tachiyomi.data.database.models.ChapterImpl
|
||||
import eu.kanade.tachiyomi.data.database.models.MangaChapterHistory
|
||||
import eu.kanade.tachiyomi.ui.manga.chapter.BaseChapterHolder
|
||||
import eu.kanade.tachiyomi.ui.manga.chapter.BaseChapterItem
|
||||
|
||||
class RecentMangaItem(
|
||||
@ -16,7 +17,7 @@ class RecentMangaItem(
|
||||
chapter: Chapter = ChapterImpl(),
|
||||
header: AbstractHeaderItem<*>?
|
||||
) :
|
||||
BaseChapterItem<RecentMangaHolder, AbstractHeaderItem<*>>(chapter, header) {
|
||||
BaseChapterItem<BaseChapterHolder, AbstractHeaderItem<*>>(chapter, header) {
|
||||
|
||||
override fun getLayoutRes(): Int {
|
||||
return if (mch.manga.id == null) R.layout.recents_footer_item
|
||||
@ -26,8 +27,9 @@ class RecentMangaItem(
|
||||
override fun createViewHolder(
|
||||
view: View,
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
|
||||
): RecentMangaHolder {
|
||||
return RecentMangaHolder(view, adapter as RecentMangaAdapter)
|
||||
): BaseChapterHolder {
|
||||
return if (mch.manga.id == null) RecentMangaFooterHolder(view, adapter as RecentMangaAdapter)
|
||||
else RecentMangaHolder(view, adapter as RecentMangaAdapter)
|
||||
}
|
||||
|
||||
override fun isSwipeable(): Boolean {
|
||||
@ -51,11 +53,11 @@ class RecentMangaItem(
|
||||
|
||||
override fun bindViewHolder(
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: RecentMangaHolder,
|
||||
holder: BaseChapterHolder,
|
||||
position: Int,
|
||||
payloads: MutableList<Any?>?
|
||||
) {
|
||||
if (mch.manga.id == null) holder.bind((header as? RecentMangaHeaderItem)?.recentsType ?: 0)
|
||||
else holder.bind(this)
|
||||
if (mch.manga.id == null) (holder as? RecentMangaFooterHolder)?.bind((header as? RecentMangaHeaderItem)?.recentsType ?: 0)
|
||||
else (holder as? RecentMangaHolder)?.bind(this)
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_arrow_forward_24dp"
|
||||
android:tint="?colorAccent"
|
||||
app:tint="?colorAccent"
|
||||
android:layout_marginStart="12dp"
|
||||
app:layout_constraintTop_toTopOf="@id/title"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
|
Loading…
x
Reference in New Issue
Block a user