mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 03:39:19 +01:00
Option to cancel all downloads for a series in dl/queue
This commit is contained in:
parent
f1c624fe16
commit
abb69921a2
@ -68,4 +68,8 @@ class DownloadBottomPresenter(val sheet: DownloadBottomSheet) {
|
||||
fun cancelDownload(download: Download) {
|
||||
downloadManager.deletePendingDownloads(download)
|
||||
}
|
||||
|
||||
fun cancelDownloads(downloads: List<Download>) {
|
||||
downloadManager.deletePendingDownloads(*downloads.toTypedArray())
|
||||
}
|
||||
}
|
||||
|
@ -283,6 +283,15 @@ class DownloadBottomSheet @JvmOverloads constructor(
|
||||
val downloads = items.mapNotNull { it.download }
|
||||
presenter.reorder(downloads)
|
||||
}
|
||||
R.id.cancel_series -> {
|
||||
val download = adapter?.getItem(position)?.download ?: return
|
||||
val allDownloadsForSeries = adapter?.currentItems
|
||||
?.filter { download.manga.id == it.download.manga.id }
|
||||
?.map(DownloadItem::download)
|
||||
if (!allDownloadsForSeries.isNullOrEmpty()) {
|
||||
presenter.cancelDownloads(allDownloadsForSeries)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,6 @@ class DownloadHolder(private val view: View, val adapter: DownloadAdapter) :
|
||||
notifyDownloadedPages()
|
||||
}
|
||||
|
||||
binding.downloadMenu.isVisible = flexibleAdapterPosition != 0 || flexibleAdapterPosition != adapter.itemCount - 1
|
||||
binding.downloadMenu.setVectorCompat(
|
||||
R.drawable.ic_more_vert_24dp,
|
||||
view.context
|
||||
|
@ -5,4 +5,7 @@
|
||||
|
||||
<item android:id="@+id/move_to_bottom"
|
||||
android:title="@string/move_to_bottom" />
|
||||
|
||||
<item android:id="@+id/cancel_series"
|
||||
android:title="@string/cancel_all_for_series" />
|
||||
</menu>
|
@ -763,6 +763,7 @@
|
||||
<string name="download_queue">Download queue</string>
|
||||
<string name="downloading_">Downloading: %1$s</string>
|
||||
<string name="cancel_all">Cancel all</string>
|
||||
<string name="cancel_all_for_series">Cancel all for this series</string>
|
||||
<string name="downloaded">Downloaded</string>
|
||||
<string name="not_downloaded">Not downloaded</string>
|
||||
<string name="downloading">Downloading</string>
|
||||
|
Loading…
Reference in New Issue
Block a user