pull/323/head
gedoor 4 years ago
parent 13e2ce9619
commit e1711cae27
  1. 18
      app/src/main/java/io/legado/app/service/help/ReadBook.kt
  2. 6
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt

@ -7,6 +7,7 @@ import io.legado.app.R
import io.legado.app.constant.BookType import io.legado.app.constant.BookType
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter 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.AppConfig
import io.legado.app.help.BookHelp import io.legado.app.help.BookHelp
import io.legado.app.help.IntentDataHelp import io.legado.app.help.IntentDataHelp
@ -35,6 +36,7 @@ object ReadBook {
var prevTextChapter: TextChapter? = null var prevTextChapter: TextChapter? = null
var curTextChapter: TextChapter? = null var curTextChapter: TextChapter? = null
var nextTextChapter: TextChapter? = null var nextTextChapter: TextChapter? = null
var bookSource: BookSource? = null
var webBook: WebBook? = null var webBook: WebBook? = null
var msg: String? = null var msg: String? = null
private val loadingChapters = arrayListOf<Int>() private val loadingChapters = arrayListOf<Int>()
@ -54,14 +56,16 @@ object ReadBook {
} }
fun upWebBook(book: Book) { fun upWebBook(book: Book) {
webBook = if (book.origin == BookType.local) { if (book.origin == BookType.local) {
null bookSource = null
webBook = null
} else { } else {
val bookSource = App.db.bookSourceDao().getBookSource(book.origin) App.db.bookSourceDao().getBookSource(book.origin)?.let {
if (bookSource != null) { bookSource = it
WebBook(bookSource) webBook = WebBook(it)
} else { } ?: let {
null bookSource = null
webBook = null
} }
} }
} }

@ -632,7 +632,11 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
* 替换 * 替换
*/ */
override fun openReplaceRule() { override fun openReplaceRule() {
startActivityForResult<ReplaceRuleActivity>(requestCodeReplace) startActivityForResult<ReplaceRuleActivity>(
requestCodeReplace,
Pair("bookName", ReadBook.book?.name),
Pair("bookSource", ReadBook.bookSource?.bookSourceUrl)
)
} }
/** /**

Loading…
Cancel
Save