Fix download status updates not appearing in chapters list (fixes #3358)

This commit is contained in:
arkon 2020-07-30 22:22:37 -04:00
parent 3813743e3d
commit 99710b45d1
3 changed files with 6 additions and 10 deletions

View File

@ -176,14 +176,14 @@ class DownloadService : Service() {
/** /**
* Releases the wake lock if it's held. * Releases the wake lock if it's held.
*/ */
fun PowerManager.WakeLock.releaseIfNeeded() { private fun PowerManager.WakeLock.releaseIfNeeded() {
if (isHeld) release() if (isHeld) release()
} }
/** /**
* Acquires the wake lock if it's not held. * Acquires the wake lock if it's not held.
*/ */
fun PowerManager.WakeLock.acquireIfNeeded() { private fun PowerManager.WakeLock.acquireIfNeeded() {
if (!isHeld) acquire() if (!isHeld) acquire()
} }

View File

@ -231,8 +231,6 @@ class Downloader(
val wasEmpty = queue.isEmpty() val wasEmpty = queue.isEmpty()
// Called in background thread, the operation can be slow with SAF. // Called in background thread, the operation can be slow with SAF.
val chaptersWithoutDir = async { val chaptersWithoutDir = async {
val mangaDir = provider.findMangaDir(manga, source)
chapters chapters
// Filter out those already downloaded. // Filter out those already downloaded.
.filter { provider.findChapterDir(it, manga, source) == null } .filter { provider.findChapterDir(it, manga, source) == null }

View File

@ -49,7 +49,6 @@ import eu.kanade.tachiyomi.ui.library.LibraryController
import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.main.MainActivity
import eu.kanade.tachiyomi.ui.main.offsetAppbarHeight import eu.kanade.tachiyomi.ui.main.offsetAppbarHeight
import eu.kanade.tachiyomi.ui.manga.chapter.ChapterDividerItemDecoration import eu.kanade.tachiyomi.ui.manga.chapter.ChapterDividerItemDecoration
import eu.kanade.tachiyomi.ui.manga.chapter.ChapterHolder
import eu.kanade.tachiyomi.ui.manga.chapter.ChapterItem import eu.kanade.tachiyomi.ui.manga.chapter.ChapterItem
import eu.kanade.tachiyomi.ui.manga.chapter.ChaptersAdapter import eu.kanade.tachiyomi.ui.manga.chapter.ChaptersAdapter
import eu.kanade.tachiyomi.ui.manga.chapter.ChaptersSettingsSheet import eu.kanade.tachiyomi.ui.manga.chapter.ChaptersSettingsSheet
@ -685,11 +684,10 @@ class MangaController :
} }
fun onChapterStatusChange(download: Download) { fun onChapterStatusChange(download: Download) {
getHolder(download.chapter)?.notifyStatus(download.status) chaptersAdapter?.currentItems?.find { it.id == download.chapter.id }?.let {
} chaptersAdapter?.updateItem(it)
chaptersAdapter?.notifyDataSetChanged()
private fun getHolder(chapter: Chapter): ChapterHolder? { }
return binding.recycler.findViewHolderForItemId(chapter.id!!) as? ChapterHolder
} }
fun openChapter(chapter: Chapter, hasAnimation: Boolean = false) { fun openChapter(chapter: Chapter, hasAnimation: Boolean = false) {