mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-23 13:45:43 +03:00
Fix download status updates not appearing in chapters list (fixes #3358)
This commit is contained in:
parent
3813743e3d
commit
99710b45d1
3 changed files with 6 additions and 10 deletions
|
@ -176,14 +176,14 @@ class DownloadService : Service() {
|
|||
/**
|
||||
* Releases the wake lock if it's held.
|
||||
*/
|
||||
fun PowerManager.WakeLock.releaseIfNeeded() {
|
||||
private fun PowerManager.WakeLock.releaseIfNeeded() {
|
||||
if (isHeld) release()
|
||||
}
|
||||
|
||||
/**
|
||||
* Acquires the wake lock if it's not held.
|
||||
*/
|
||||
fun PowerManager.WakeLock.acquireIfNeeded() {
|
||||
private fun PowerManager.WakeLock.acquireIfNeeded() {
|
||||
if (!isHeld) acquire()
|
||||
}
|
||||
|
||||
|
|
|
@ -231,8 +231,6 @@ class Downloader(
|
|||
val wasEmpty = queue.isEmpty()
|
||||
// Called in background thread, the operation can be slow with SAF.
|
||||
val chaptersWithoutDir = async {
|
||||
val mangaDir = provider.findMangaDir(manga, source)
|
||||
|
||||
chapters
|
||||
// Filter out those already downloaded.
|
||||
.filter { provider.findChapterDir(it, manga, source) == null }
|
||||
|
|
|
@ -49,7 +49,6 @@ import eu.kanade.tachiyomi.ui.library.LibraryController
|
|||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import eu.kanade.tachiyomi.ui.main.offsetAppbarHeight
|
||||
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.ChaptersAdapter
|
||||
import eu.kanade.tachiyomi.ui.manga.chapter.ChaptersSettingsSheet
|
||||
|
@ -685,11 +684,10 @@ class MangaController :
|
|||
}
|
||||
|
||||
fun onChapterStatusChange(download: Download) {
|
||||
getHolder(download.chapter)?.notifyStatus(download.status)
|
||||
}
|
||||
|
||||
private fun getHolder(chapter: Chapter): ChapterHolder? {
|
||||
return binding.recycler.findViewHolderForItemId(chapter.id!!) as? ChapterHolder
|
||||
chaptersAdapter?.currentItems?.find { it.id == download.chapter.id }?.let {
|
||||
chaptersAdapter?.updateItem(it)
|
||||
chaptersAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
fun openChapter(chapter: Chapter, hasAnimation: Boolean = false) {
|
||||
|
|
Loading…
Reference in a new issue