feat: 优化代码

pull/121/head
kunfei 5 years ago
parent 51c0ac8f1b
commit a17cd1fb7b
  1. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 1
      app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt
  3. 5
      app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt
  4. 4
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt

@ -691,7 +691,7 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
upScreenTimeOut()
}
observeEvent<Boolean>(PreferKey.textSelectAble) {
page_view.upSelectAble(it)
page_view.curPage.upSelectAble(it)
}
}

@ -197,6 +197,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
y: Float,
select: (relativePage: Int, lineIndex: Int, charIndex: Int) -> Unit
) {
if (!selectAble) return
if (!visibleRect.contains(x, y)) return
var relativeOffset = relativeOffset(0)
for ((lineIndex, textLine) in textPage.textLines.withIndex()) {

@ -132,11 +132,6 @@ class PageView(context: Context, attrs: AttributeSet) :
}
}
fun upSelectAble(selectAble: Boolean) {
pageDelegate?.upSelectAble(selectAble)
curPage.upSelectAble(selectAble)
}
fun upStyle() {
ChapterProvider.upStyle()
curPage.upStyle()

@ -101,10 +101,6 @@ abstract class PageDelegate(protected val pageView: PageView) :
onScroll()
}
fun upSelectAble(selectAble: Boolean) {
detector.setIsLongpressEnabled(selectAble)
}
open fun fling(
startX: Int, startY: Int, velocityX: Int, velocityY: Int,
minX: Int, maxX: Int, minY: Int, maxY: Int

Loading…
Cancel
Save