mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-16 14:09:17 +01:00
Add long click action on chapter download button (#7125)
This commit is contained in:
parent
71bb8ed975
commit
5002692bda
@ -25,6 +25,10 @@ class ChapterHolder(
|
||||
binding.download.setOnClickListener {
|
||||
onDownloadClick(it, bindingAdapterPosition)
|
||||
}
|
||||
binding.download.setOnLongClickListener {
|
||||
onDownloadLongClick(bindingAdapterPosition)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
fun bind(item: ChapterItem, manga: Manga) {
|
||||
|
@ -41,4 +41,20 @@ open class BaseChapterHolder(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun onDownloadLongClick(position: Int) {
|
||||
val item = adapter.getItem(position) as? BaseChapterItem<*, *> ?: return
|
||||
when (item.status) {
|
||||
Download.State.NOT_DOWNLOADED, Download.State.ERROR -> {
|
||||
adapter.clickListener.downloadChapter(position)
|
||||
}
|
||||
Download.State.DOWNLOADED, Download.State.DOWNLOADING -> {
|
||||
adapter.clickListener.deleteChapter(position)
|
||||
}
|
||||
// Download.State.QUEUE
|
||||
else -> {
|
||||
adapter.clickListener.startDownloadNow(position)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,10 @@ class UpdatesHolder(private val view: View, private val adapter: UpdatesAdapter)
|
||||
binding.download.setOnClickListener {
|
||||
onDownloadClick(it, bindingAdapterPosition)
|
||||
}
|
||||
binding.download.setOnLongClickListener {
|
||||
onDownloadLongClick(bindingAdapterPosition)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
fun bind(item: UpdatesItem) {
|
||||
|
Loading…
Reference in New Issue
Block a user