diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt index 19fd69675..b47f6001a 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt @@ -74,7 +74,6 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_rea } setSupportActionBar(toolbar) initView() - page_view.callback = this viewModel.callBack = this viewModel.bookData.observe(this, Observer { title_bar.title = it.name }) viewModel.chapterListFinish.observe(this, Observer { loadContent() }) diff --git a/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt b/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt index e05eb8c31..db51ab9e0 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt @@ -11,12 +11,13 @@ import io.legado.app.ui.widget.page.delegate.CoverPageDelegate import io.legado.app.ui.widget.page.delegate.NoAnimPageDelegate import io.legado.app.ui.widget.page.delegate.PageDelegate import io.legado.app.ui.widget.page.delegate.SlidePageDelegate +import io.legado.app.utils.activity import io.legado.app.utils.getPrefInt class PageView(context: Context, attrs: AttributeSet) : FrameLayout(context, attrs), PageDelegate.PageInterface { - var callback: CallBack? = null + private var callback: CallBack? = null private var pageDelegate: PageDelegate? = null private var pageFactory: TextPageFactory? = null @@ -25,6 +26,7 @@ class PageView(context: Context, attrs: AttributeSet) : FrameLayout(context, att var nextPage: ContentView? = null init { + callback = activity as? CallBack prevPage = ContentView(context) addView(prevPage) nextPage = ContentView(context)