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 5d642940d..44c67ba8b 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 @@ -35,6 +35,7 @@ import io.legado.app.ui.book.read.config.BgTextConfigDialog.Companion.TEXT_COLOR import io.legado.app.ui.book.read.page.ChapterProvider import io.legado.app.ui.book.read.page.PageView import io.legado.app.ui.book.read.page.delegate.PageDelegate +import io.legado.app.ui.book.read.page.entities.TextChar import io.legado.app.ui.book.source.edit.BookSourceEditActivity import io.legado.app.ui.changesource.ChangeSourceDialog import io.legado.app.ui.chapterlist.ChapterListActivity @@ -389,6 +390,11 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo } } + override fun selectText(textChar: TextChar) { + cursor_left + cursor_right + } + override fun showReadAloudDialog() { ReadAloudDialog().show(supportFragmentManager, "readAloud") } 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 3295a0b58..68708c725 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 @@ -11,6 +11,7 @@ import io.legado.app.help.ReadBookConfig import io.legado.app.service.help.ReadBook import io.legado.app.ui.book.read.page.delegate.* import io.legado.app.ui.book.read.page.entities.TextChapter +import io.legado.app.ui.book.read.page.entities.TextChar import io.legado.app.utils.activity import io.legado.app.utils.getPrefInt @@ -241,6 +242,8 @@ class PageView(context: Context, attrs: AttributeSet) : interface CallBack { + val isInitFinish: Boolean + /** * 保存页数 */ @@ -251,8 +254,8 @@ class PageView(context: Context, attrs: AttributeSet) : */ fun clickCenter() - val isInitFinish: Boolean - fun screenOffTimerStart() + + fun selectText(textChar: TextChar) } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt index b0be332dc..aa525f948 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt @@ -268,6 +268,9 @@ abstract class PageDelegate(protected val pageView: PageView) : override fun onLongPress(e: MotionEvent) { val textChar = curPage.selectText(e) + textChar?.let { + pageView.callBack?.selectText(it) + } } /**