From 153c5a36eb43cfbc4aaf2fe85dfb5bd2b3ab7fc7 Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Thu, 12 Nov 2020 17:36:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=AD=E9=9F=B3=E6=9C=97?= =?UTF-8?q?=E8=AF=BB=E9=83=A8=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/updatelog.fy | 7 +++++-- .../xyz/fycz/myreader/widget/page/PageLoader.java | 11 +++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/src/main/assets/updatelog.fy b/app/src/main/assets/updatelog.fy index fe6a7a2..51baad8 100644 --- a/app/src/main/assets/updatelog.fy +++ b/app/src/main/assets/updatelog.fy @@ -1,9 +1,12 @@ 2020.11.12 -风月读书v1.20.1111211 +风月读书v1.20.1111217 1、修复语音朗读定时停止无效的bug 2、修复语音朗读时切换日夜间闪退的bug 3、修复语音朗读时切换章节闪退的bug -4、修复安卓5进入字体界面闪退的bug +4、修复语音朗读时部分安卓版本卡死的bug +5、修复语音朗读时章节首页朗读段落高亮错位的bug +6、修复语音朗读时章节标题不高亮的bug +7、修复安卓5进入字体界面闪退的bug 2020.11.11 风月读书v1.20.1111121 diff --git a/app/src/main/java/xyz/fycz/myreader/widget/page/PageLoader.java b/app/src/main/java/xyz/fycz/myreader/widget/page/PageLoader.java index 1e073e2..edbc3a5 100644 --- a/app/src/main/java/xyz/fycz/myreader/widget/page/PageLoader.java +++ b/app/src/main/java/xyz/fycz/myreader/widget/page/PageLoader.java @@ -2,7 +2,11 @@ package xyz.fycz.myreader.widget.page; import android.content.Context; import android.graphics.*; +import android.text.Layout; +import android.text.StaticLayout; import android.text.TextUtils; + +import androidx.annotation.NonNull; import androidx.core.content.ContextCompat; import android.text.TextPaint; import android.util.Log; @@ -147,7 +151,7 @@ public abstract class PageLoader { private int mLastChapterPos = 0; private int readTextLength; //已读字符数 private boolean resetReadAloud; //是否重新朗读 - private int readAloudParagraph; //正在朗读章节 + private int readAloudParagraph = -1; //正在朗读章节 /*****************************init params*******************************/ public PageLoader(PageView pageView, Book collBook, Setting setting) { @@ -1027,8 +1031,10 @@ public abstract class PageLoader { //对标题进行绘制 boolean isLight; + int titleLen = 0; for (int i = 0; i < mCurPage.titleLines; ++i) { str = mCurPage.lines.get(i); + titleLen += str.length(); isLight = ReadAloudService.running && readAloudParagraph == 0; mTitlePaint.setColor(isLight ? mContext.getResources().getColor(R.color.sys_color) : mTextColor); @@ -1056,7 +1062,7 @@ public abstract class PageLoader { for (int i = mCurPage.titleLines; i < mCurPage.lines.size(); ++i) { str = mCurPage.lines.get(i); strLength = strLength + str.length(); - int paragraphLength = mCurPage.position == 0 ? strLength : mCurChapter.getPageLength(mCurPage.position - 1) + strLength; + int paragraphLength = mCurPage.position == 0 ? strLength + titleLen : mCurChapter.getPageLength(mCurPage.position - 1) + strLength; isLight = ReadAloudService.running && readAloudParagraph == mCurChapter.getParagraphIndex(paragraphLength); mTextPaint.setColor(isLight ? mContext.getResources().getColor(R.color.sys_color) : mTextColor); canvas.drawText(str, mMarginWidth, top, mTextPaint); @@ -1284,6 +1290,7 @@ public abstract class PageLoader { private void chapterChangeCallback() { if (mPageChangeListener != null) { + readAloudParagraph = -1; mPageChangeListener.onChapterChange(mCurChapterPos); mPageChangeListener.onPageChange(0, resetReadAloud); resetReadAloud = true;