From 73a14a6d0ac63367cc9705265ae355656093e211 Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 27 Sep 2021 19:49:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=AA=E5=B1=8F=E5=8F=8C=E9=A1=B5=E5=AE=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/book/read/ReadMenu.kt | 2 +- .../book/read/page/provider/ChapterProvider.kt | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt index dfc5a21a6..45e854c6d 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt @@ -141,7 +141,7 @@ class ReadMenu @JvmOverloads constructor( callBack.openSourceEditActivity() } tvChapterUrl.setOnClickListener { - context.openUrl(binding.tvChapterUrl.text.toString()) + context.sendToClip(binding.tvChapterUrl.text.toString()) } //登录 tvLogin.setOnClickListener { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt index eb20867c2..46421e260 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt @@ -26,6 +26,8 @@ import java.util.* */ @Suppress("DEPRECATION") object ChapterProvider { + private const val srcReplaceChar = "▩" + @JvmStatic private var viewWidth = 0 @@ -71,7 +73,8 @@ object ChapterProvider { @JvmStatic val contentPaint: TextPaint = TextPaint() - private const val srcReplaceChar = "▩" + var isHorizontal = false + init { upStyle() @@ -163,7 +166,7 @@ object ChapterProvider { return TextChapter( bookChapter.index, displayTitle, - bookChapter.getAbsoluteURL().substringBefore(",{"), //getAbsoluteURL已经格式过 + bookChapter.getAbsoluteURL(), textPages, chapterSize, bookChapter.isVip, bookChapter.isPay ) @@ -190,9 +193,6 @@ object ChapterProvider { Book.imgStyleFull -> { width = visibleWidth height = it.height * visibleWidth / it.width - } - Book.imgStyleText -> { - } else -> { if (it.width > visibleWidth) { @@ -529,6 +529,7 @@ object ChapterProvider { if (width > 0 && height > 0 && (width != viewWidth || height != viewHeight)) { viewWidth = width viewHeight = height + isHorizontal = width > height upVisibleSize() postEvent(EventBus.UP_CONFIG, true) } @@ -541,7 +542,11 @@ object ChapterProvider { if (viewWidth > 0 && viewHeight > 0) { paddingLeft = ReadBookConfig.paddingLeft.dp paddingTop = ReadBookConfig.paddingTop.dp - visibleWidth = viewWidth - paddingLeft - ReadBookConfig.paddingRight.dp + visibleWidth = if (isHorizontal) { + viewWidth / 2 - paddingLeft - ReadBookConfig.paddingRight.dp + } else { + viewWidth - paddingLeft - ReadBookConfig.paddingRight.dp + } visibleHeight = viewHeight - paddingTop - ReadBookConfig.paddingBottom.dp visibleRight = paddingLeft + visibleWidth visibleBottom = paddingTop + visibleHeight