优化
This commit is contained in:
@@ -135,7 +135,7 @@ object ReadBook : CoroutineScope by MainScope() {
|
|||||||
} else {
|
} else {
|
||||||
chapterSize
|
chapterSize
|
||||||
}
|
}
|
||||||
if (durChapterIndex != book.durChapterIndex || tocChanged) {
|
if (durChapterIndex != book.durChapterIndex) {
|
||||||
durChapterIndex = book.durChapterIndex
|
durChapterIndex = book.durChapterIndex
|
||||||
durChapterPos = book.durChapterPos
|
durChapterPos = book.durChapterPos
|
||||||
clearTextChapter()
|
clearTextChapter()
|
||||||
@@ -925,7 +925,10 @@ object ReadBook : CoroutineScope by MainScope() {
|
|||||||
if (simulatedChapterSize > 0 && durChapterIndex > simulatedChapterSize - 1) {
|
if (simulatedChapterSize > 0 && durChapterIndex > simulatedChapterSize - 1) {
|
||||||
durChapterIndex = simulatedChapterSize - 1
|
durChapterIndex = simulatedChapterSize - 1
|
||||||
}
|
}
|
||||||
callBack ?: clearTextChapter()
|
clearTextChapter()
|
||||||
|
if (callBack != null) {
|
||||||
|
loadContent(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ object ReadManga : CoroutineScope by MainScope() {
|
|||||||
chapterSize
|
chapterSize
|
||||||
}
|
}
|
||||||
|
|
||||||
if (durChapterIndex != book.durChapterIndex || tocChanged) {
|
if (durChapterIndex != book.durChapterIndex) {
|
||||||
durChapterIndex = book.durChapterIndex
|
durChapterIndex = book.durChapterIndex
|
||||||
durChapterPos = book.durChapterPos
|
durChapterPos = book.durChapterPos
|
||||||
clearMangaChapter()
|
clearMangaChapter()
|
||||||
@@ -546,7 +546,10 @@ object ReadManga : CoroutineScope by MainScope() {
|
|||||||
if (simulatedChapterSize > 0 && durChapterIndex > simulatedChapterSize - 1) {
|
if (simulatedChapterSize > 0 && durChapterIndex > simulatedChapterSize - 1) {
|
||||||
durChapterIndex = simulatedChapterSize - 1
|
durChapterIndex = simulatedChapterSize - 1
|
||||||
}
|
}
|
||||||
mCallback ?: clearMangaChapter()
|
clearMangaChapter()
|
||||||
|
if (mCallback != null) {
|
||||||
|
loadContent()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,6 @@ class BookInfoActivity :
|
|||||||
viewModel.refreshBook(book)
|
viewModel.refreshBook(book)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private var tocChanged = false
|
|
||||||
private var chapterChanged = false
|
private var chapterChanged = false
|
||||||
private val waitDialog by lazy { WaitDialog(this) }
|
private val waitDialog by lazy { WaitDialog(this) }
|
||||||
private var editMenuItem: MenuItem? = null
|
private var editMenuItem: MenuItem? = null
|
||||||
@@ -256,7 +255,6 @@ class BookInfoActivity :
|
|||||||
R.id.menu_log -> showDialogFragment<AppLogDialog>()
|
R.id.menu_log -> showDialogFragment<AppLogDialog>()
|
||||||
R.id.menu_split_long_chapter -> {
|
R.id.menu_split_long_chapter -> {
|
||||||
upLoading(true)
|
upLoading(true)
|
||||||
tocChanged = true
|
|
||||||
viewModel.getBook()?.let {
|
viewModel.getBook()?.let {
|
||||||
it.setSplitLongChapter(!item.isChecked)
|
it.setSplitLongChapter(!item.isChecked)
|
||||||
viewModel.loadBookInfo(it, false)
|
viewModel.loadBookInfo(it, false)
|
||||||
@@ -697,15 +695,14 @@ class BookInfoActivity :
|
|||||||
else -> readBookResult.launch(
|
else -> readBookResult.launch(
|
||||||
Intent(
|
Intent(
|
||||||
this,
|
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("bookUrl", book.bookUrl)
|
||||||
.putExtra("inBookshelf", viewModel.inBookshelf)
|
.putExtra("inBookshelf", viewModel.inBookshelf)
|
||||||
.putExtra("tocChanged", tocChanged)
|
|
||||||
.putExtra("chapterChanged", chapterChanged)
|
.putExtra("chapterChanged", chapterChanged)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
tocChanged = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override val oldBook: Book?
|
override val oldBook: Book?
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ class ReadMangaViewModel(application: Application) : BaseViewModel(application)
|
|||||||
fun initData(intent: Intent, success: (() -> Unit)? = null) {
|
fun initData(intent: Intent, success: (() -> Unit)? = null) {
|
||||||
execute {
|
execute {
|
||||||
ReadManga.inBookshelf = intent.getBooleanExtra("inBookshelf", true)
|
ReadManga.inBookshelf = intent.getBooleanExtra("inBookshelf", true)
|
||||||
ReadManga.tocChanged = intent.getBooleanExtra("tocChanged", false)
|
|
||||||
val bookUrl = intent.getStringExtra("bookUrl")
|
val bookUrl = intent.getStringExtra("bookUrl")
|
||||||
val book = when {
|
val book = when {
|
||||||
bookUrl.isNullOrEmpty() -> appDb.bookDao.lastReadBook
|
bookUrl.isNullOrEmpty() -> appDb.bookDao.lastReadBook
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
fun initData(intent: Intent, success: (() -> Unit)? = null) {
|
fun initData(intent: Intent, success: (() -> Unit)? = null) {
|
||||||
execute {
|
execute {
|
||||||
ReadBook.inBookshelf = intent.getBooleanExtra("inBookshelf", true)
|
ReadBook.inBookshelf = intent.getBooleanExtra("inBookshelf", true)
|
||||||
ReadBook.tocChanged = intent.getBooleanExtra("tocChanged", false)
|
|
||||||
ReadBook.chapterChanged = intent.getBooleanExtra("chapterChanged", false)
|
ReadBook.chapterChanged = intent.getBooleanExtra("chapterChanged", false)
|
||||||
val bookUrl = intent.getStringExtra("bookUrl")
|
val bookUrl = intent.getStringExtra("bookUrl")
|
||||||
val book = when {
|
val book = when {
|
||||||
|
|||||||
Reference in New Issue
Block a user