From d0dd58489360882354cbcc53909139f7d6c07cfe Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 22 Feb 2020 09:36:02 +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 --- .../java/io/legado/app/ui/book/read/ReadBookActivity.kt | 4 ++-- app/src/main/java/io/legado/app/utils/ViewExtensions.kt | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) 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 47a087d30..688a24bb2 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 @@ -344,13 +344,13 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo override fun upSelectedStart(x: Float, y: Float) { cursor_left.x = x - cursor_left.width cursor_left.y = y - cursor_left.visible() + cursor_left.visible(true) } override fun upSelectedEnd(x: Float, y: Float) { cursor_right.x = x cursor_right.y = y - cursor_right.visible() + cursor_right.visible(true) } override fun onCancelSelect() { diff --git a/app/src/main/java/io/legado/app/utils/ViewExtensions.kt b/app/src/main/java/io/legado/app/utils/ViewExtensions.kt index 5d191609f..8eb3cb1f6 100644 --- a/app/src/main/java/io/legado/app/utils/ViewExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/ViewExtensions.kt @@ -50,10 +50,10 @@ fun View.visible() { } fun View.visible(visible: Boolean) { - visibility = if (visible) { - VISIBLE - } else { - INVISIBLE + if (visible && visibility != VISIBLE) { + visibility = VISIBLE + } else if (!visible && visibility == VISIBLE) { + visibility = INVISIBLE } }