pull/34/head
kunfei 5 years ago
parent a2f49c7c0b
commit 22f25494d6
  1. 5
      app/src/main/java/io/legado/app/ui/widget/page/ContentTextView.kt
  2. 9
      app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt
  3. 5
      app/src/main/java/io/legado/app/ui/widget/page/PageView.kt

@ -98,6 +98,11 @@ class ContentTextView : AppCompatTextView {
mOffsetHeight = mLayoutHeight + totalPaddingTop + totalPaddingBottom - measuredHeight
}
override fun scrollTo(x: Int, y: Int) {
setScrollState(scrollStateIdle)
super.scrollTo(x, min(y, mOffsetHeight))
}
@SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(event: MotionEvent?): Boolean {
event?.let {

@ -134,6 +134,15 @@ class ContentView : FrameLayout {
}
}
fun scrollToBottom() {
content_text_view.post {
content_text_view.scrollTo(
0,
content_text_view.layout.getLineTop(content_text_view.lineCount)
)
}
}
interface CallBack {
fun scrollToLine(line: Int)
}

@ -70,14 +70,17 @@ class PageView(context: Context, attrs: AttributeSet) :
when (direction) {
PageDelegate.Direction.PREV -> {
it.moveToPrevious()
upContent()
curPage?.scrollToBottom()
}
PageDelegate.Direction.NEXT -> {
it.moveToNext()
upContent()
curPage?.scrollTo(0)
}
else -> return
}
}
upContent()
}
fun upPageAnim() {

Loading…
Cancel
Save