优化
Some checks failed
Test Build / prepare (push) Waiting to run
Test Build / build (app, release) (push) Blocked by required conditions
Test Build / build (app, releaseA) (push) Blocked by required conditions
Test Build / prerelease (push) Blocked by required conditions
Test Build / lanzou (push) Blocked by required conditions
Test Build / test_Branch (push) Blocked by required conditions
Test Build / telegram (push) Blocked by required conditions
Update Cronet / build (push) Has been cancelled

This commit is contained in:
Horis
2025-03-23 19:14:02 +08:00
parent 3d96d51d04
commit 3697bfb96d
5 changed files with 12 additions and 11 deletions

View File

@@ -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)
}
}
}

View File

@@ -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()
}
}
}

View File

@@ -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?

View File

@@ -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

View File

@@ -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 {