From 3166f1a27cb096401064caef1aac03e7526515f2 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 28 Sep 2021 12:16:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=AA=E5=B1=8F=E5=8F=8C=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/book/read/ReadBookActivity.kt | 1 + .../io/legado/app/ui/book/read/config/AutoReadDialog.kt | 2 ++ .../io/legado/app/ui/book/read/config/ReadStyleDialog.kt | 1 + .../main/java/io/legado/app/ui/book/read/page/ReadView.kt | 1 + .../app/ui/book/read/page/provider/ChapterProvider.kt | 8 ++++---- 5 files changed, 9 insertions(+), 4 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 4ac6ccf6a..7d2cbd5a6 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 @@ -269,6 +269,7 @@ class ReadBookActivity : ReadBookBaseActivity(), } R.id.menu_page_anim -> showPageAnimConfig { binding.readView.upPageAnim() + ReadBook.loadContent(false) } R.id.menu_book_info -> ReadBook.book?.let { startActivity { diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt index 6d14cfcad..3302e2fa3 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt @@ -11,6 +11,7 @@ import io.legado.app.help.ReadBookConfig import io.legado.app.lib.theme.bottomBackground import io.legado.app.lib.theme.getPrimaryTextColor import io.legado.app.model.ReadAloud +import io.legado.app.model.ReadBook import io.legado.app.service.BaseReadAloudService import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.book.read.ReadBookBaseActivity @@ -102,6 +103,7 @@ class AutoReadDialog : BaseDialogFragment() { binding.llSetting.setOnClickListener { (activity as ReadBookBaseActivity).showPageAnimConfig { (activity as ReadBookActivity).upPageAnim() + ReadBook.loadContent(false) } } binding.llCatalog.setOnClickListener { callBack?.openChapterList() } diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt index 0488354e5..1d47f6742 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt @@ -132,6 +132,7 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack { ReadBook.book?.setPageAnim(-1) ReadBookConfig.pageAnim = binding.rgPageAnim.getIndexById(checkedId) callBack?.upPageAnim() + ReadBook.loadContent(false) } cbShareLayout.onCheckedChangeListener = { _, isChecked -> ReadBookConfig.shareLayout = isChecked 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 8a9a648c4..2fd5e12c9 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 @@ -469,6 +469,7 @@ class ReadView(context: Context, attrs: AttributeSet) : fun upPageAnim() { isScroll = ReadBook.pageAnim() == 3 + ChapterProvider.upLayout() when (ReadBook.pageAnim()) { 0 -> if (pageDelegate !is CoverPageDelegate) { pageDelegate = CoverPageDelegate(this) 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 13b2763a3..5b87a67e8 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 @@ -497,7 +497,7 @@ object ChapterProvider { paragraphSpacing = ReadBookConfig.paragraphSpacing titleTopSpacing = ReadBookConfig.titleTopSpacing.dp titleBottomSpacing = ReadBookConfig.titleBottomSpacing.dp - upVisibleSize() + upLayout() } private fun getTypeface(fontPath: String): Typeface { @@ -567,8 +567,7 @@ object ChapterProvider { if (width > 0 && height > 0 && (width != viewWidth || height != viewHeight)) { viewWidth = width viewHeight = height - doublePage = width > height - upVisibleSize() + upLayout() postEvent(EventBus.UP_CONFIG, true) } } @@ -576,7 +575,8 @@ object ChapterProvider { /** * 更新绘制尺寸 */ - private fun upVisibleSize() { + fun upLayout() { + doublePage = viewWidth > viewHeight && ReadBook.pageAnim() != 3 if (viewWidth > 0 && viewHeight > 0) { paddingLeft = ReadBookConfig.paddingLeft.dp paddingTop = ReadBookConfig.paddingTop.dp