From a6c06ddb14c6bdb4351b2dc6e4611246861b6521 Mon Sep 17 00:00:00 2001 From: 821938089 <821938089@qq.com> Date: Tue, 16 Aug 2022 20:23:18 +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 --- app/src/main/java/io/legado/app/model/localBook/EpubFile.kt | 3 --- app/src/main/java/io/legado/app/model/localBook/LocalBook.kt | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt b/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt index 15fdd25c4..764c2b0fa 100644 --- a/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt +++ b/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt @@ -257,9 +257,6 @@ class EpubFile(var book: Book) { } else { parseFirstPage(chapterList, refs) parseMenu(chapterList, refs, 0) - val lh = LinkedHashSet(chapterList) - chapterList.clear() - chapterList.addAll(lh) for (i in chapterList.indices) { chapterList[i].index = i } diff --git a/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt b/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt index c7d5b11b3..eae54864f 100644 --- a/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt +++ b/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt @@ -79,6 +79,7 @@ object LocalBook { throw TocEmptyException(appCtx.getString(R.string.chapter_list_empty)) } val lh = LinkedHashSet(chapters) + lh.forEachIndexed { index, bookChapter -> bookChapter.index = index } return ArrayList(lh) }