@ -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()
curPage?.scrollTo(0)
else -> return
fun upPageAnim() {