From ca0613a8a0852bdff5957adf8b85a4e9a6d1c385 Mon Sep 17 00:00:00 2001 From: Horis <8674809+821938089@users.noreply.github.com> Date: Fri, 7 Mar 2025 17:26:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/model/ReadManga.kt | 18 ++++++++++-------- .../app/ui/book/manga/ReadMangaActivity.kt | 7 +++++-- .../ui/book/manga/entities/MangaContentData.kt | 7 +++++++ 3 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 app/src/main/java/io/legado/app/ui/book/manga/entities/MangaContentData.kt diff --git a/app/src/main/java/io/legado/app/model/ReadManga.kt b/app/src/main/java/io/legado/app/model/ReadManga.kt index f3e1fd776..6754db996 100644 --- a/app/src/main/java/io/legado/app/model/ReadManga.kt +++ b/app/src/main/java/io/legado/app/model/ReadManga.kt @@ -22,6 +22,7 @@ import io.legado.app.help.globalExecutor import io.legado.app.model.webBook.WebBook import io.legado.app.ui.book.manga.entities.MangaChapter import io.legado.app.ui.book.manga.entities.MangaContent +import io.legado.app.ui.book.manga.entities.MangaContentData import io.legado.app.ui.book.manga.entities.ReaderLoading import io.legado.app.utils.NetworkUtils import io.legado.app.utils.mapIndexed @@ -99,6 +100,7 @@ object ReadManga : CoroutineScope by MainScope() { if (durChapterIndex != book.durChapterIndex || tocChanged) { durChapterIndex = book.durChapterIndex durChapterPos = book.durChapterPos + clearMangaChapter() } upWebBook(book) synchronized(this) { @@ -201,7 +203,7 @@ object ReadManga : CoroutineScope by MainScope() { if (curMangaChapter == null) { loadContent(durChapterIndex) } else { - mCallback?.upContent(true) + mCallback?.upContent() } if (nextMangaChapter == null) { loadContent(durChapterIndex + 1) @@ -259,7 +261,7 @@ object ReadManga : CoroutineScope by MainScope() { } durChapterImageCount = mangaChapter.imageCount curMangaChapter = mangaChapter - mCallback?.upContent(true) + mCallback?.upContent() } -1, 1 -> { @@ -281,7 +283,7 @@ object ReadManga : CoroutineScope by MainScope() { } } - private fun buildContentList(): Pair> { + private fun buildContentList(): MangaContentData { val list = arrayListOf() var pos = durChapterPos + 1 prevMangaChapter?.let { @@ -294,7 +296,7 @@ object ReadManga : CoroutineScope by MainScope() { nextMangaChapter?.let { list.addAll(it.contents) } - return pos to list + return MangaContentData(pos, list, curMangaChapter != null) } /** @@ -310,7 +312,7 @@ object ReadManga : CoroutineScope by MainScope() { startLoad.invoke() loadContent(durChapterIndex) } else { - mCallback?.upContent(true) + mCallback?.upContent() } loadContent(durChapterIndex + 1) saveRead() @@ -332,7 +334,7 @@ object ReadManga : CoroutineScope by MainScope() { if (curMangaChapter == null) { loadContent(durChapterIndex) } else { - mCallback?.upContent(true) + mCallback?.upContent() } loadContent(durChapterIndex - 1) saveRead() @@ -500,7 +502,7 @@ object ReadManga : CoroutineScope by MainScope() { mCallback?.showLoading() if (progress.durChapterIndex == durChapterIndex) { durChapterPos = progress.durChapterPos - mCallback?.upContent(true) + mCallback?.upContent() } else { durChapterIndex = progress.durChapterIndex durChapterPos = progress.durChapterPos @@ -567,7 +569,7 @@ object ReadManga : CoroutineScope by MainScope() { } interface Callback { - fun upContent(finish: Boolean = false) + fun upContent() fun loadFail(msg: String) fun sureNewProgress(progress: BookProgress) fun showLoading() diff --git a/app/src/main/java/io/legado/app/ui/book/manga/ReadMangaActivity.kt b/app/src/main/java/io/legado/app/ui/book/manga/ReadMangaActivity.kt index 278ad8e6f..d4e43e20f 100644 --- a/app/src/main/java/io/legado/app/ui/book/manga/ReadMangaActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/manga/ReadMangaActivity.kt @@ -255,10 +255,13 @@ class ReadMangaActivity : VMBaseActivity, + val finish: Boolean +)