Merge pull request #1403 from DuShuYuan/master

修复滚动模式下,长按选择错乱问题
pull/1463/head
kunfei 3 years ago committed by GitHub
commit 778cf1303a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt
  3. 3
      app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt

@ -524,7 +524,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
}
}
private fun relativePage(relativePos: Int): TextPage {
fun relativePage(relativePos: Int): TextPage {
return when (relativePos) {
0 -> textPage
1 -> pageFactory.nextPage

@ -271,6 +271,10 @@ class PageView(context: Context) : FrameLayout(context) {
return binding.contentTextView.createBookmark()
}
fun relativePage(relativePos: Int): TextPage {
return binding.contentTextView.relativePage(relativePos)
}
val selectedText: String get() = binding.contentTextView.selectedText
val textPage get() = binding.contentTextView.textPage

@ -265,8 +265,9 @@ class ReadView(context: Context, attrs: AttributeSet) :
*/
private fun onLongPress() {
kotlin.runCatching {
with(curPage.textPage) {
curPage.selectText(startX, startY) { relativePage, lineIndex, charIndex ->
val page = if (isScroll) curPage.relativePage(relativePage) else curPage.textPage
with(page) {
isTextSelected = true
firstRelativePage = relativePage
firstLineIndex = lineIndex

Loading…
Cancel
Save