diff --git a/app/src/main/java/io/legado/app/service/help/ReadBook.kt b/app/src/main/java/io/legado/app/service/help/ReadBook.kt index 7878cb1c2..afb7702a8 100644 --- a/app/src/main/java/io/legado/app/service/help/ReadBook.kt +++ b/app/src/main/java/io/legado/app/service/help/ReadBook.kt @@ -7,6 +7,7 @@ import io.legado.app.R import io.legado.app.constant.BookType import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter +import io.legado.app.data.entities.BookSource import io.legado.app.help.AppConfig import io.legado.app.help.BookHelp import io.legado.app.help.IntentDataHelp @@ -35,6 +36,7 @@ object ReadBook { var prevTextChapter: TextChapter? = null var curTextChapter: TextChapter? = null var nextTextChapter: TextChapter? = null + var bookSource: BookSource? = null var webBook: WebBook? = null var msg: String? = null private val loadingChapters = arrayListOf() @@ -54,14 +56,16 @@ object ReadBook { } fun upWebBook(book: Book) { - webBook = if (book.origin == BookType.local) { - null + if (book.origin == BookType.local) { + bookSource = null + webBook = null } else { - val bookSource = App.db.bookSourceDao().getBookSource(book.origin) - if (bookSource != null) { - WebBook(bookSource) - } else { - null + App.db.bookSourceDao().getBookSource(book.origin)?.let { + bookSource = it + webBook = WebBook(it) + } ?: let { + bookSource = null + webBook = null } } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 512d22a6f..42f4a45df 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -632,7 +632,11 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo * 替换 */ override fun openReplaceRule() { - startActivityForResult(requestCodeReplace) + startActivityForResult( + requestCodeReplace, + Pair("bookName", ReadBook.book?.name), + Pair("bookSource", ReadBook.bookSource?.bookSourceUrl) + ) } /**