|
@@ -42,6 +42,30 @@ object ReadBook : CoroutineScope by MainScope() {
|
|
|
private val loadingChapters = arrayListOf<Int>()
|
|
private val loadingChapters = arrayListOf<Int>()
|
|
|
private val readRecord = ReadRecord()
|
|
private val readRecord = ReadRecord()
|
|
|
var readStartTime: Long = System.currentTimeMillis()
|
|
var readStartTime: Long = System.currentTimeMillis()
|
|
|
|
|
+ /* 跳转历史记录 */
|
|
|
|
|
+ var bookProgressHistory: List<BookProgress>? = null
|
|
|
|
|
+ /* 跳转进度前进度记录 */
|
|
|
|
|
+ var lastBookPress: BookProgress? = null
|
|
|
|
|
+
|
|
|
|
|
+ //暂时保存跳转前进度
|
|
|
|
|
+ fun saveCurrentBookProcess() {
|
|
|
|
|
+ lastBookPress = book?.let { BookProgress(it) }
|
|
|
|
|
+ }
|
|
|
|
|
+ //恢复跳转前进度
|
|
|
|
|
+ fun restoreLastBookProcess() {
|
|
|
|
|
+ lastBookPress?.let {
|
|
|
|
|
+ durChapterPos = it.durChapterPos
|
|
|
|
|
+ if (durChapterIndex != it.durChapterIndex) {
|
|
|
|
|
+ clearTextChapter()
|
|
|
|
|
+ durChapterIndex = it.durChapterIndex
|
|
|
|
|
+ }
|
|
|
|
|
+ callBack?.upContent()
|
|
|
|
|
+ saveRead()
|
|
|
|
|
+ loadContent(resetPageOffset = true) {
|
|
|
|
|
+ lastBookPress = null
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
fun resetData(book: Book) {
|
|
fun resetData(book: Book) {
|
|
|
ReadBook.book = book
|
|
ReadBook.book = book
|
|
@@ -55,6 +79,7 @@ object ReadBook : CoroutineScope by MainScope() {
|
|
|
callBack?.upMenuView()
|
|
callBack?.upMenuView()
|
|
|
callBack?.upPageAnim()
|
|
callBack?.upPageAnim()
|
|
|
upWebBook(book)
|
|
upWebBook(book)
|
|
|
|
|
+ lastBookPress = null
|
|
|
synchronized(this) {
|
|
synchronized(this) {
|
|
|
loadingChapters.clear()
|
|
loadingChapters.clear()
|
|
|
}
|
|
}
|