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 36e33cb2b..6040c3174 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 @@ -11,7 +11,6 @@ import io.legado.app.help.IntentDataHelp import io.legado.app.help.coroutine.Coroutine import io.legado.app.model.WebBook import io.legado.app.service.BaseReadAloudService -import io.legado.app.ui.book.read.ReadBookViewModel import io.legado.app.ui.widget.page.ChapterProvider import io.legado.app.ui.widget.page.TextChapter import kotlinx.coroutines.* @@ -24,7 +23,7 @@ object ReadBook { var book: Book? = null var inBookshelf = false var chapterSize = 0 - var callBack: ReadBookViewModel.CallBack? = null + var callBack: CallBack? = null var durChapterIndex = 0 var durPageIndex = 0 var isLocalBook = true @@ -77,7 +76,7 @@ object ReadBook { } } saveRead() - callBack?.curChapterChanged() + callBack?.upView() curPageChanged() return true } else { @@ -107,7 +106,7 @@ object ReadBook { } } saveRead() - callBack?.curChapterChanged() + callBack?.upView() curPageChanged() return true } else { @@ -226,7 +225,7 @@ object ReadBook { durChapterIndex -> withContext(Main) { curTextChapter = ChapterProvider.getTextChapter(chapter, c, chapterSize) callBack?.upContent() - callBack?.curChapterChanged() + callBack?.upView() curPageChanged() callBack?.contentLoadFinish() } @@ -258,4 +257,11 @@ object ReadBook { } } + interface CallBack { + fun loadContent() + fun upContent(position: Int = 0) + fun upView() + fun upPageProgress() + fun contentLoadFinish() + } } \ No newline at end of file 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 6a8167bb2..579de5b2f 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 @@ -55,7 +55,7 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo ReadMenu.CallBack, ReadAloudDialog.CallBack, ChangeSourceDialog.CallBack, - ReadBookViewModel.CallBack, + ReadBook.CallBack, ColorPickerDialogListener { override val viewModel: ReadBookViewModel get() = getViewModel(ReadBookViewModel::class.java) @@ -274,7 +274,7 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo page_view.upContent(position) } - override fun curChapterChanged() { + override fun upView() { ReadBook.curTextChapter?.let { tv_chapter_name.text = it.title tv_chapter_name.visible() diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt index 01c73dbd5..2e6f127dc 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt @@ -200,11 +200,4 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { } } - interface CallBack { - fun loadContent() - fun upContent(position: Int = 0) - fun curChapterChanged() - fun upPageProgress() - fun contentLoadFinish() - } } \ No newline at end of file