feat: 优化代码

pull/115/head
kunfei 5 years ago
parent 9f78d86a80
commit 3bd20e995e
  1. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 5
      app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt

@ -632,7 +632,7 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
super.onDestroy() super.onDestroy()
mHandler.removeCallbacks(keepScreenRunnable) mHandler.removeCallbacks(keepScreenRunnable)
textActionMenu?.dismiss() textActionMenu?.dismiss()
page_view.pageDelegate?.onDestroy() page_view.onDestroy()
} }
override fun observeLiveBus() { override fun observeLiveBus() {

@ -70,6 +70,11 @@ class PageView(context: Context, attrs: AttributeSet) :
return pageDelegate?.onTouch(event) ?: super.onTouchEvent(event) return pageDelegate?.onTouch(event) ?: super.onTouchEvent(event)
} }
fun onDestroy() {
pageDelegate?.onDestroy()
curPage.cancelSelect()
}
fun fillPage(direction: PageDelegate.Direction) { fun fillPage(direction: PageDelegate.Direction) {
when (direction) { when (direction) {
PageDelegate.Direction.PREV -> { PageDelegate.Direction.PREV -> {

Loading…
Cancel
Save