diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index c46bd86ea..248f2b5e5 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -1,5 +1,6 @@ package io.legado.app.ui.book.read +import android.annotation.SuppressLint import android.app.Activity import android.content.Intent import android.net.Uri @@ -312,9 +313,16 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo /** * view触摸 */ - override fun onTouch(v: View?, event: MotionEvent?): Boolean { - - + @SuppressLint("ClickableViewAccessibility") + override fun onTouch(v: View, event: MotionEvent): Boolean { + when (event.action) { + MotionEvent.ACTION_MOVE, MotionEvent.ACTION_UP -> { + when (v.id) { + R.id.cursor_left -> page_view.selectStartMove(event.x, event.y) + R.id.cursor_right -> page_view.selectEndMove(event.x, event.y) + } + } + } return true } diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt index a4e2b5b75..aedf2e8b9 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt @@ -121,6 +121,14 @@ class ContentView : FrameLayout { return selectPoint } + fun selectStartMove(x: Float, y: Float) { + + } + + fun selectEndMove(x: Float, y: Float) { + + } + fun scrollTo(pos: Int?) { if (pos != null) { content_text_view.post { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt index fe478f36c..13a3322d2 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt @@ -184,6 +184,14 @@ class PageView(context: Context, attrs: AttributeSet) : nextPage.upBattery(battery) } + fun selectStartMove(x: Float, y: Float) { + curPage.selectStartMove(x, y) + } + + fun selectEndMove(x: Float, y: Float) { + curPage.selectEndMove(x, y) + } + override val isScrollDelegate: Boolean get() = pageDelegate is ScrollPageDelegate