|
|
@ -11,6 +11,7 @@ import io.legado.app.R |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.help.ReadBookConfig |
|
|
|
import io.legado.app.help.ReadBookConfig |
|
|
|
import io.legado.app.lib.theme.accentColor |
|
|
|
import io.legado.app.lib.theme.accentColor |
|
|
|
|
|
|
|
import io.legado.app.ui.book.read.page.entities.TextChar |
|
|
|
import io.legado.app.ui.book.read.page.entities.TextPage |
|
|
|
import io.legado.app.ui.book.read.page.entities.TextPage |
|
|
|
import io.legado.app.utils.getCompatColor |
|
|
|
import io.legado.app.utils.getCompatColor |
|
|
|
import io.legado.app.utils.getPrefBoolean |
|
|
|
import io.legado.app.utils.getPrefBoolean |
|
|
@ -81,7 +82,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun selectText(x: Float, y: Float) { |
|
|
|
fun selectText(x: Float, y: Float): TextChar? { |
|
|
|
textPage?.let { textPage -> |
|
|
|
textPage?.let { textPage -> |
|
|
|
for (textLine in textPage.textLines) { |
|
|
|
for (textLine in textPage.textLines) { |
|
|
|
if (y > textLine.lineTop && y < textLine.lineBottom) { |
|
|
|
if (y > textLine.lineTop && y < textLine.lineBottom) { |
|
|
@ -89,12 +90,13 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at |
|
|
|
if (x > textChar.leftBottomPosition.x && x < textChar.rightTopPosition.x) { |
|
|
|
if (x > textChar.leftBottomPosition.x && x < textChar.rightTopPosition.x) { |
|
|
|
textChar.selected = true |
|
|
|
textChar.selected = true |
|
|
|
invalidate() |
|
|
|
invalidate() |
|
|
|
break |
|
|
|
return textChar |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return null |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|