From ad5bfc4b575b6b2f97274fbe9150cfba9a64580d Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 9 Aug 2021 16:00:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/book/read/ReadBookActivity.kt | 2 ++ .../java/io/legado/app/ui/book/read/page/ContentTextView.kt | 4 ++-- .../main/java/io/legado/app/ui/book/read/page/ReadView.kt | 6 +++--- 3 files changed, 7 insertions(+), 5 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 0e0152540..739c53ab2 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 @@ -7,6 +7,7 @@ import android.content.res.Configuration import android.os.Bundle import android.os.Handler import android.os.Looper +import android.util.Log import android.view.* import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import androidx.activity.result.contract.ActivityResultContracts @@ -150,6 +151,7 @@ class ReadBookActivity : ReadBookBaseActivity(), override fun onWindowFocusChanged(hasFocus: Boolean) { super.onWindowFocusChanged(hasFocus) + Log.d("navigationBarHeight", navigationBarHeight.toString()) upSystemUiVisibility() } 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 a70a546bd..67f16724a 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 @@ -250,7 +250,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at selectStart[2] != charIndex ) { if (selectToInt(relativePos, lineIndex, charIndex) - < selectToInt(selectEnd) + <= selectToInt(selectEnd) ) { selectStart[0] = relativePos selectStart[1] = lineIndex @@ -276,7 +276,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at || selectEnd[2] != charIndex ) { if (selectToInt(relativePos, lineIndex, charIndex) - > selectToInt(selectStart) + >= selectToInt(selectStart) ) { selectEnd[0] = relativePos selectEnd[1] = lineIndex diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt index b6de252c8..966407094 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt @@ -43,9 +43,9 @@ class ReadView(context: Context, attrs: AttributeSet) : upContent() } var isScroll = false - var prevPage: PageView = PageView(context) - var curPage: PageView = PageView(context) - var nextPage: PageView = PageView(context) + val prevPage by lazy { PageView(context) } + val curPage by lazy { PageView(context) } + val nextPage by lazy { PageView(context) } val defaultAnimationSpeed = 300 private var pressDown = false private var isMove = false