From f7b434f4b7c3bbbe35efae3f2dc84850867e585f Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 21 Feb 2020 14:45:20 +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 --- .../legado/app/ui/book/read/page/ContentTextView.kt | 11 ++++------- .../io/legado/app/ui/book/read/page/ContentView.kt | 8 ++------ .../java/io/legado/app/ui/book/read/page/PageView.kt | 1 + 3 files changed, 7 insertions(+), 13 deletions(-) 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 2c1cbad80..e1913943b 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 @@ -6,20 +6,17 @@ import android.graphics.Paint import android.util.AttributeSet import android.view.View import io.legado.app.R +import io.legado.app.constant.PreferKey import io.legado.app.help.ReadBookConfig import io.legado.app.lib.theme.accentColor import io.legado.app.ui.book.read.page.entities.TextPage import io.legado.app.utils.getCompatColor +import io.legado.app.utils.getPrefBoolean -class ContentTextView : View { - constructor(context: Context) : super(context) - - constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) - - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) - : super(context, attrs, defStyleAttr) +class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, attrs) { + var selectAble = context.getPrefBoolean(PreferKey.textSelectAble) private val selectedPaint by lazy { Paint().apply { color = context.getCompatColor(R.color.btn_bg_press) 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 cbc4cb52a..0e5752c64 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 @@ -105,12 +105,8 @@ class ContentView : FrameLayout { } } - fun isTextSelected(): Boolean { - return false - } - - fun contentTextView(): ContentTextView? { - return content_text_view + fun upSelectAble(selectAble: Boolean) { + content_text_view.selectAble = selectAble } fun scrollTo(pos: Int?) { 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 4ea4decdd..3295a0b58 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 @@ -153,6 +153,7 @@ class PageView(context: Context, attrs: AttributeSet) : fun upSelectAble(selectAble: Boolean) { pageDelegate?.upSelectAble(selectAble) + curPage.upSelectAble(selectAble) } fun upStyle() {