mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-09-10 20:43:14 +02:00
parent
5ea683b686
commit
c745ac7350
@ -203,6 +203,20 @@ class DownloadManager(val context: Context) {
|
||||
* @param source the source of the chapters.
|
||||
*/
|
||||
fun deleteChapters(chapters: List<Chapter>, manga: Manga, source: Source) {
|
||||
val wasPaused = isPaused()
|
||||
if (chapters.isEmpty()) {
|
||||
DownloadService.stop(context)
|
||||
downloader.queue.clear()
|
||||
return
|
||||
}
|
||||
downloader.pause()
|
||||
downloader.queue.remove(chapters)
|
||||
if(!wasPaused && downloader.queue.isNotEmpty()){
|
||||
downloader.start()
|
||||
}
|
||||
else if (downloader.queue.isEmpty()) {
|
||||
DownloadService.stop(context)
|
||||
}
|
||||
queue.remove(chapters)
|
||||
val chapterDirs = provider.findChapterDirs(chapters, manga, source) + provider.findTempChapterDirs(chapters, manga, source)
|
||||
chapterDirs.forEach { it.delete() }
|
||||
|
@ -112,6 +112,7 @@ internal class DownloadNotifier(private val context: Context) {
|
||||
setContentTitle("$title - $chapter".chop(30))
|
||||
setContentText(context.getString(R.string.chapter_downloading_progress)
|
||||
.format(download.downloadedImages, download.pages!!.size))
|
||||
setStyle(null)
|
||||
setProgress(download.pages!!.size, download.downloadedImages, false)
|
||||
}
|
||||
// Displays the progress bar on notification
|
||||
|
@ -128,7 +128,8 @@ class Downloader(
|
||||
} else {
|
||||
if (notifier.paused) {
|
||||
notifier.paused = false
|
||||
notifier.onDownloadPaused()
|
||||
if (queue.isEmpty()) notifier.dismiss()
|
||||
else notifier.onDownloadPaused()
|
||||
} else if (notifier.isSingleChapter && !notifier.errorThrown) {
|
||||
notifier.isSingleChapter = false
|
||||
} else {
|
||||
|
@ -14,7 +14,7 @@
|
||||
android:visible="false"
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
<item android:title="@string/action_clear"
|
||||
<item android:title="@string/action_cancel_all"
|
||||
android:id="@+id/clear_queue"
|
||||
android:visible="false"
|
||||
app:showAsAction="never"/>
|
||||
|
Loading…
Reference in New Issue
Block a user