From 577bd6a83b280ba3ab39f08124ceceb031446299 Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 21 Feb 2020 22:58:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/page/ContentTextView.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt index 35e028297..05fb0a0a1 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt @@ -13,6 +13,7 @@ import io.legado.app.help.ReadBookConfig import io.legado.app.lib.theme.accentColor import io.legado.app.ui.book.read.page.entities.SelectPoint import io.legado.app.ui.book.read.page.entities.TextPage +import io.legado.app.utils.activity import io.legado.app.utils.getCompatColor import io.legado.app.utils.getPrefBoolean @@ -24,6 +25,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at style = Paint.Style.FILL } } + private var activityCallBack: CallBack? = null var selectAble = context.getPrefBoolean(PreferKey.textSelectAble) var selectStartLine = 0 var selectStartChar = 0 @@ -31,6 +33,10 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at var selectEndChar = 0 private var textPage: TextPage? = null + init { + activityCallBack = activity as? CallBack + } + fun setContent(textPage: TextPage?) { this.textPage = textPage invalidate() @@ -175,7 +181,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at } invalidate() } - + activityCallBack?.onCancelSelect() } interface CallBack {