feat: 优化代码

pull/103/head
kunfei 5 years ago
parent 8d68694c06
commit e451c05a00
  1. 6
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt
  2. 5
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/ScrollPageDelegate.kt

@ -1,6 +1,5 @@
package io.legado.app.ui.book.read.page.delegate package io.legado.app.ui.book.read.page.delegate
import android.text.method.ScrollingMovementMethod
import android.view.MotionEvent import android.view.MotionEvent
import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey
import io.legado.app.ui.book.read.page.PageView import io.legado.app.ui.book.read.page.PageView
@ -53,10 +52,9 @@ abstract class HorizontalPageDelegate(pageView: PageView) : PageDelegate(pageVie
override fun upSelectAble() { override fun upSelectAble() {
pageView.curPage?.contentTextView()?.apply { pageView.curPage?.contentTextView()?.apply {
if (context.getPrefBoolean(PreferKey.selectText)) { if (context.getPrefBoolean(PreferKey.selectText)) {
isSelected = false setTextIsSelectable(true)
} else { } else {
movementMethod = ScrollingMovementMethod.getInstance() setTextIsSelectable(false)
isSelected = true
} }
} }
} }

@ -123,11 +123,10 @@ class ScrollPageDelegate(pageView: PageView) : PageDelegate(pageView) {
override fun upSelectAble() { override fun upSelectAble() {
pageView.curPage?.contentTextView()?.apply { pageView.curPage?.contentTextView()?.apply {
if (context.getPrefBoolean(PreferKey.selectText)) { if (context.getPrefBoolean(PreferKey.selectText)) {
isSelected = false setTextIsSelectable(true)
movementMethod = ScrollingMovementMethod.getInstance()
} else { } else {
setTextIsSelectable(false)
movementMethod = ScrollingMovementMethod.getInstance() movementMethod = ScrollingMovementMethod.getInstance()
isSelected = true
} }
} }
} }

Loading…
Cancel
Save