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