优化
This commit is contained in:
@@ -23,6 +23,7 @@ import io.legado.app.ui.book.read.page.provider.ChapterProvider
|
|||||||
import io.legado.app.ui.book.read.page.provider.TextPageFactory
|
import io.legado.app.ui.book.read.page.provider.TextPageFactory
|
||||||
import io.legado.app.ui.widget.dialog.PhotoDialog
|
import io.legado.app.ui.widget.dialog.PhotoDialog
|
||||||
import io.legado.app.utils.activity
|
import io.legado.app.utils.activity
|
||||||
|
import io.legado.app.utils.dpToPx
|
||||||
import io.legado.app.utils.getCompatColor
|
import io.legado.app.utils.getCompatColor
|
||||||
import io.legado.app.utils.showDialogFragment
|
import io.legado.app.utils.showDialogFragment
|
||||||
import io.legado.app.utils.toastOnUi
|
import io.legado.app.utils.toastOnUi
|
||||||
@@ -279,11 +280,15 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
|||||||
if (textPos.compare(selectEnd) <= 0) {
|
if (textPos.compare(selectEnd) <= 0) {
|
||||||
selectStartMoveIndex(textPos)
|
selectStartMoveIndex(textPos)
|
||||||
} else {
|
} else {
|
||||||
reverseStartCursor = true
|
touchRough(x - 2 * cursorWidth, y) { _, textPos, _, _, _ ->
|
||||||
reverseEndCursor = false
|
if (textPos.compare(selectEnd) > 0) {
|
||||||
selectEnd.columnIndex++
|
reverseStartCursor = true
|
||||||
selectStartMoveIndex(selectEnd)
|
reverseEndCursor = false
|
||||||
selectEndMoveIndex(textPos)
|
selectEnd.columnIndex++
|
||||||
|
selectStartMoveIndex(selectEnd)
|
||||||
|
selectEndMoveIndex(textPos)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -299,11 +304,15 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
|||||||
if (textPos.compare(selectStart) >= 0) {
|
if (textPos.compare(selectStart) >= 0) {
|
||||||
selectEndMoveIndex(textPos)
|
selectEndMoveIndex(textPos)
|
||||||
} else {
|
} else {
|
||||||
reverseEndCursor = true
|
touchRough(x + 2 * cursorWidth, y) { _, textPos, _, _, _ ->
|
||||||
reverseStartCursor = false
|
if (textPos.compare(selectStart) < 0) {
|
||||||
selectStart.columnIndex--
|
reverseEndCursor = true
|
||||||
selectEndMoveIndex(selectStart)
|
reverseStartCursor = false
|
||||||
selectStartMoveIndex(textPos)
|
selectStart.columnIndex--
|
||||||
|
selectEndMoveIndex(selectStart)
|
||||||
|
selectStartMoveIndex(textPos)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -690,6 +699,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
|||||||
Thread(it, "TextPageRender")
|
Thread(it, "TextPageRender")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private val cursorWidth = 24.dpToPx()
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CallBack {
|
interface CallBack {
|
||||||
|
|||||||
Reference in New Issue
Block a user