|
|
|
@ -164,15 +164,23 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at |
|
|
|
|
|
|
|
|
|
pageOffset += offset |
|
|
|
|
if (pageOffset > 0) { |
|
|
|
|
pageFactory.moveToPrev() |
|
|
|
|
textPage = pageFactory.currentPage |
|
|
|
|
pageOffset -= textPage.height |
|
|
|
|
upView?.invoke(textPage) |
|
|
|
|
if (!pageFactory.hasPrev()) { |
|
|
|
|
pageOffset = 0f |
|
|
|
|
} else { |
|
|
|
|
pageFactory.moveToPrev() |
|
|
|
|
textPage = pageFactory.currentPage |
|
|
|
|
pageOffset -= textPage.height |
|
|
|
|
upView?.invoke(textPage) |
|
|
|
|
} |
|
|
|
|
} else if (pageOffset < -textPage.height) { |
|
|
|
|
pageOffset += textPage.height |
|
|
|
|
pageFactory.moveToNext() |
|
|
|
|
textPage = pageFactory.currentPage |
|
|
|
|
upView?.invoke(textPage) |
|
|
|
|
if (!pageFactory.hasNext()) { |
|
|
|
|
pageOffset = -textPage.height.toFloat() |
|
|
|
|
} else { |
|
|
|
|
pageOffset += textPage.height |
|
|
|
|
pageFactory.moveToNext() |
|
|
|
|
textPage = pageFactory.currentPage |
|
|
|
|
upView?.invoke(textPage) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
invalidate() |
|
|
|
|
} |
|
|
|
|