mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 09:41:51 +01:00
Make entire history item card clickable
This commit is contained in:
parent
badddcf0de
commit
02207f6cfd
@ -20,10 +20,8 @@ class HistoryAdapter(controller: HistoryController) :
|
||||
val sourceManager by injectLazy<SourceManager>()
|
||||
|
||||
val resumeClickListener: OnResumeClickListener = controller
|
||||
|
||||
val removeClickListener: OnRemoveClickListener = controller
|
||||
|
||||
val coverClickListener: OnCoverClickListener = controller
|
||||
val itemClickListener: OnItemClickListener = controller
|
||||
|
||||
/**
|
||||
* DecimalFormat used to display correct chapter number
|
||||
@ -44,7 +42,7 @@ class HistoryAdapter(controller: HistoryController) :
|
||||
fun onRemoveClick(position: Int)
|
||||
}
|
||||
|
||||
interface OnCoverClickListener {
|
||||
fun onCoverClick(position: Int)
|
||||
interface OnItemClickListener {
|
||||
fun onItemClick(position: Int)
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class HistoryController : NucleusController<HistoryControllerBinding, HistoryPre
|
||||
FlexibleAdapter.OnUpdateListener,
|
||||
HistoryAdapter.OnRemoveClickListener,
|
||||
HistoryAdapter.OnResumeClickListener,
|
||||
HistoryAdapter.OnCoverClickListener,
|
||||
HistoryAdapter.OnItemClickListener,
|
||||
RemoveHistoryDialog.Listener {
|
||||
|
||||
/**
|
||||
@ -105,7 +105,7 @@ class HistoryController : NucleusController<HistoryControllerBinding, HistoryPre
|
||||
RemoveHistoryDialog(this, manga, history).showDialog(router)
|
||||
}
|
||||
|
||||
override fun onCoverClick(position: Int) {
|
||||
override fun onItemClick(position: Int) {
|
||||
val manga = adapter?.getItem(position)?.mch?.manga ?: return
|
||||
router.pushController(MangaController(manga).withFadeTransaction())
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
||||
import eu.kanade.tachiyomi.util.lang.toTimestampString
|
||||
import java.util.Date
|
||||
import kotlinx.android.synthetic.main.history_item.cover
|
||||
import kotlinx.android.synthetic.main.history_item.holder
|
||||
import kotlinx.android.synthetic.main.history_item.manga_subtitle
|
||||
import kotlinx.android.synthetic.main.history_item.manga_title
|
||||
import kotlinx.android.synthetic.main.history_item.remove
|
||||
@ -30,16 +31,16 @@ class HistoryHolder(
|
||||
) : BaseFlexibleViewHolder(view, adapter) {
|
||||
|
||||
init {
|
||||
holder.setOnClickListener {
|
||||
adapter.itemClickListener.onItemClick(bindingAdapterPosition)
|
||||
}
|
||||
|
||||
remove.setOnClickListener {
|
||||
adapter.removeClickListener.onRemoveClick(adapterPosition)
|
||||
adapter.removeClickListener.onRemoveClick(bindingAdapterPosition)
|
||||
}
|
||||
|
||||
resume.setOnClickListener {
|
||||
adapter.resumeClickListener.onResumeClick(adapterPosition)
|
||||
}
|
||||
|
||||
cover.setOnClickListener {
|
||||
adapter.coverClickListener.onCoverClick(adapterPosition)
|
||||
adapter.resumeClickListener.onResumeClick(bindingAdapterPosition)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/holder"
|
||||
style="@style/Theme.Widget.CardView.Item"
|
||||
android:padding="0dp">
|
||||
|
||||
@ -12,9 +13,7 @@
|
||||
android:id="@+id/cover"
|
||||
android:layout_width="85dp"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/description_cover"
|
||||
android:focusable="true"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<RelativeLayout
|
||||
@ -32,6 +31,7 @@
|
||||
android:id="@+id/manga_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:textAppearance="@style/TextAppearance.Medium.Title" />
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user