|
|
|
@ -226,58 +226,24 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at |
|
|
|
|
if (y > textLine.lineTop + relativeOffset && y < textLine.lineBottom + relativeOffset) { |
|
|
|
|
for ((charIndex, textChar) in textLine.textChars.withIndex()) { |
|
|
|
|
if (x > textChar.start && x < textChar.end) { |
|
|
|
|
initSelect( |
|
|
|
|
page.chapterIndex, |
|
|
|
|
relativePos, |
|
|
|
|
textLine, |
|
|
|
|
textChar, |
|
|
|
|
lineIndex, |
|
|
|
|
charIndex, |
|
|
|
|
relativeOffset, |
|
|
|
|
select |
|
|
|
|
) |
|
|
|
|
return |
|
|
|
|
if (textChar.isImage) { |
|
|
|
|
activity?.supportFragmentManager?.let { |
|
|
|
|
PhotoDialog.show(it, page.chapterIndex, textChar.charData) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
textChar.selected = true |
|
|
|
|
invalidate() |
|
|
|
|
select(relativePos, lineIndex, charIndex) |
|
|
|
|
} |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun initSelect( |
|
|
|
|
chapterIndex: Int, |
|
|
|
|
relativePage: Int, |
|
|
|
|
textLine: TextLine, |
|
|
|
|
textChar: TextChar, |
|
|
|
|
lineIndex: Int, |
|
|
|
|
charIndex: Int, |
|
|
|
|
relativeOffset: Float, |
|
|
|
|
select: (relativePage: Int, lineIndex: Int, charIndex: Int) -> Unit, |
|
|
|
|
) { |
|
|
|
|
if (textChar.isImage) { |
|
|
|
|
activity?.supportFragmentManager?.let { |
|
|
|
|
PhotoDialog.show(it, chapterIndex, textChar.charData) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
textChar.selected = true |
|
|
|
|
invalidate() |
|
|
|
|
selectStart[0] = relativePage |
|
|
|
|
selectStart[1] = lineIndex |
|
|
|
|
selectStart[2] = charIndex |
|
|
|
|
selectEnd[0] = relativePage |
|
|
|
|
selectEnd[1] = lineIndex |
|
|
|
|
selectEnd[2] = charIndex |
|
|
|
|
upSelectedStart( |
|
|
|
|
textChar.start, |
|
|
|
|
textLine.lineBottom + relativeOffset, |
|
|
|
|
textLine.lineTop + relativeOffset |
|
|
|
|
) |
|
|
|
|
upSelectedEnd(textChar.end, textLine.lineBottom + relativeOffset) |
|
|
|
|
select(relativePage, lineIndex, charIndex) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|