Horis 1 год назад
Родитель
Сommit
a13cb2ab24

+ 5 - 2
app/src/main/java/io/legado/app/model/ReadBook.kt

@@ -135,7 +135,7 @@ object ReadBook : CoroutineScope by MainScope() {
         } else {
             chapterSize
         }
-        if (durChapterIndex != book.durChapterIndex || tocChanged) {
+        if (durChapterIndex != book.durChapterIndex) {
             durChapterIndex = book.durChapterIndex
             durChapterPos = book.durChapterPos
             clearTextChapter()
@@ -925,7 +925,10 @@ object ReadBook : CoroutineScope by MainScope() {
             if (simulatedChapterSize > 0 && durChapterIndex > simulatedChapterSize - 1) {
                 durChapterIndex = simulatedChapterSize - 1
             }
-            callBack ?: clearTextChapter()
+            clearTextChapter()
+            if (callBack != null) {
+                loadContent(false)
+            }
         }
     }
 

+ 5 - 2
app/src/main/java/io/legado/app/model/ReadManga.kt

@@ -98,7 +98,7 @@ object ReadManga : CoroutineScope by MainScope() {
             chapterSize
         }
 
-        if (durChapterIndex != book.durChapterIndex || tocChanged) {
+        if (durChapterIndex != book.durChapterIndex) {
             durChapterIndex = book.durChapterIndex
             durChapterPos = book.durChapterPos
             clearMangaChapter()
@@ -546,7 +546,10 @@ object ReadManga : CoroutineScope by MainScope() {
             if (simulatedChapterSize > 0 && durChapterIndex > simulatedChapterSize - 1) {
                 durChapterIndex = simulatedChapterSize - 1
             }
-            mCallback ?: clearMangaChapter()
+            clearMangaChapter()
+            if (mCallback != null) {
+                loadContent()
+            }
         }
     }
 

+ 2 - 5
app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt

@@ -143,7 +143,6 @@ class BookInfoActivity :
             viewModel.refreshBook(book)
         }
     }
-    private var tocChanged = false
     private var chapterChanged = false
     private val waitDialog by lazy { WaitDialog(this) }
     private var editMenuItem: MenuItem? = null
@@ -256,7 +255,6 @@ class BookInfoActivity :
             R.id.menu_log -> showDialogFragment<AppLogDialog>()
             R.id.menu_split_long_chapter -> {
                 upLoading(true)
-                tocChanged = true
                 viewModel.getBook()?.let {
                     it.setSplitLongChapter(!item.isChecked)
                     viewModel.loadBookInfo(it, false)
@@ -697,15 +695,14 @@ class BookInfoActivity :
             else -> readBookResult.launch(
                 Intent(
                     this,
-                    if (book.isImage&&AppConfig.showMangaUi) ReadMangaActivity::class.java else ReadBookActivity::class.java
+                    if (book.isImage && AppConfig.showMangaUi) ReadMangaActivity::class.java
+                    else ReadBookActivity::class.java
                 )
                     .putExtra("bookUrl", book.bookUrl)
                     .putExtra("inBookshelf", viewModel.inBookshelf)
-                    .putExtra("tocChanged", tocChanged)
                     .putExtra("chapterChanged", chapterChanged)
             )
         }
-        tocChanged = false
     }
 
     override val oldBook: Book?

+ 0 - 1
app/src/main/java/io/legado/app/ui/book/manga/ReadMangaViewModel.kt

@@ -42,7 +42,6 @@ class ReadMangaViewModel(application: Application) : BaseViewModel(application)
     fun initData(intent: Intent, success: (() -> Unit)? = null) {
         execute {
             ReadManga.inBookshelf = intent.getBooleanExtra("inBookshelf", true)
-            ReadManga.tocChanged = intent.getBooleanExtra("tocChanged", false)
             val bookUrl = intent.getStringExtra("bookUrl")
             val book = when {
                 bookUrl.isNullOrEmpty() -> appDb.bookDao.lastReadBook

+ 0 - 1
app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt

@@ -82,7 +82,6 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
     fun initData(intent: Intent, success: (() -> Unit)? = null) {
         execute {
             ReadBook.inBookshelf = intent.getBooleanExtra("inBookshelf", true)
-            ReadBook.tocChanged = intent.getBooleanExtra("tocChanged", false)
             ReadBook.chapterChanged = intent.getBooleanExtra("chapterChanged", false)
             val bookUrl = intent.getStringExtra("bookUrl")
             val book = when {