From 82b524490941b73bef7e8f0d8b1fad4b8d43a920 Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 12 Aug 2022 23:19:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=8E=E6=96=87=E5=AD=97=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=A4=84=E5=BC=80=E5=A7=8B=E6=9C=97=E8=AF=BB,=E6=9C=AA?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/book/read/page/ReadView.kt | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) 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 1c22fd203..55ced3e0a 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 @@ -446,6 +446,10 @@ class ReadView(context: Context, attrs: AttributeSet) : curPage.cancelSelect() } + /** + * 翻页动画完成后事件 + * @param direction 翻页翻页反向 + */ fun fillPage(direction: PageDirection): Boolean { return when (direction) { PageDirection.PREV -> { @@ -458,6 +462,9 @@ class ReadView(context: Context, attrs: AttributeSet) : } } + /** + * 更新翻页动画 + */ fun upPageAnim() { isScroll = ReadBook.pageAnim() == 3 ChapterProvider.upLayout() @@ -480,6 +487,11 @@ class ReadView(context: Context, attrs: AttributeSet) : } } + /** + * 更新阅读内容 + * @param relativePosition 相对位置 -1 上一页 0 当前页 1 下一页 + * @param resetPageOffset 滚动阅读是是否重置位置 + */ override fun upContent(relativePosition: Int, resetPageOffset: Boolean) { curPage.setContentDescription(pageFactory.curPage.text) if (isScroll && !callBack.isAutoPage) { @@ -499,6 +511,9 @@ class ReadView(context: Context, attrs: AttributeSet) : callBack.screenOffTimerStart() } + /** + * 更新样式 + */ fun upStyle() { ChapterProvider.upStyle() curPage.upStyle() @@ -506,6 +521,9 @@ class ReadView(context: Context, attrs: AttributeSet) : nextPage.upStyle() } + /** + * 更新背景 + */ fun upBg() { ReadBookConfig.upBg(width, height) curPage.upBg() @@ -513,18 +531,27 @@ class ReadView(context: Context, attrs: AttributeSet) : nextPage.upBg() } + /** + * 更新背景透明度 + */ fun upBgAlpha() { curPage.upBgAlpha() prevPage.upBgAlpha() nextPage.upBgAlpha() } + /** + * 更新时间信息 + */ fun upTime() { curPage.upTime() prevPage.upTime() nextPage.upTime() } + /** + * 更新电量信息 + */ fun upBattery(battery: Int) { curPage.upBattery(battery) prevPage.upBattery(battery) @@ -542,6 +569,9 @@ class ReadView(context: Context, attrs: AttributeSet) : //TODO 未完成 } + /** + * @return 选择的文本 + */ fun getSelectText(): String { return curPage.selectedText }