From 471a5c9cc29db6cbc62298dec2f60b05b2c805b5 Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Wed, 25 Aug 2021 19:49:26 +0800 Subject: [PATCH] v2.1.7-debug --- .idea/assetWizardSettings.xml | 32 +++++ .idea/misc.xml | 3 + app/build.gradle | 2 +- app/release.md | 6 +- app/src/main/assets/updatelog.fy | 6 +- .../fycz/myreader/greendao/entity/Book.java | 25 +++- .../myreader/model/storage/BackupRestoreUi.kt | 5 +- .../fycz/myreader/model/storage/Restore.kt | 10 ++ .../fycz/myreader/model/storage/WebDavHelp.kt | 5 +- .../ui/activity/MoreSettingActivity.java | 11 -- .../myreader/ui/activity/ReadActivity.java | 7 + .../fycz/myreader/ui/adapter/SearchAdapter.kt | 8 +- .../myreader/ui/fragment/MineFragment.java | 2 +- .../myreader/ui/fragment/WebDavFragment.java | 2 +- .../ui/presenter/BookcasePresenter.java | 4 +- .../util/help/ChapterContentHelp.java | 134 +++++++++--------- .../fycz/myreader/widget/page/PageLoader.java | 12 +- app/src/main/res/drawable/ic_re_seg.xml | 12 ++ .../main/res/layout/activity_more_setting.xml | 27 ---- app/src/main/res/menu/menu_book.xml | 5 +- app/src/main/res/menu/menu_read.xml | 9 ++ app/src/main/res/values/strings.xml | 2 +- 22 files changed, 184 insertions(+), 145 deletions(-) create mode 100644 .idea/assetWizardSettings.xml create mode 100644 app/src/main/res/drawable/ic_re_seg.xml diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml new file mode 100644 index 0000000..89ab429 --- /dev/null +++ b/.idea/assetWizardSettings.xml @@ -0,0 +1,32 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 82c7483..3fee554 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,12 +3,15 @@ diff --git a/app/build.gradle b/app/build.gradle index 8bded9c..a038bf5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -243,7 +243,7 @@ dependencies { } greendao { - schemaVersion 29 + schemaVersion 30 daoPackage 'xyz.fycz.myreader.greendao.gen' // targetGenDir 'src/main/java' } diff --git a/app/release.md b/app/release.md index d26b7ce..79ca2c8 100644 --- a/app/release.md +++ b/app/release.md @@ -1,3 +1,5 @@ * 1、修复发现分类bug -* 2、新增章节内容智能分段 -* 3、备份/恢复路径支持自定义 \ No newline at end of file +* 2、新增章节内容智能分段(阅读菜单-智能分段) +* 3、备份/恢复路径支持自定义 +* 4、优化搜索 +* 5、修复已知bug \ No newline at end of file diff --git a/app/src/main/assets/updatelog.fy b/app/src/main/assets/updatelog.fy index 0a50ec7..b457c3b 100644 --- a/app/src/main/assets/updatelog.fy +++ b/app/src/main/assets/updatelog.fy @@ -1,9 +1,11 @@ - +2021.08.25 风月读书v2.1.7 更新内容: 1、修复发现分类bug -2、新增章节内容智能分段 +2、新增章节内容智能分段(阅读菜单-智能分段) 3、备份/恢复路径支持自定义 +4、优化搜索 +5、修复已知bug 2021.07.24 风月读书v2.1.6 diff --git a/app/src/main/java/xyz/fycz/myreader/greendao/entity/Book.java b/app/src/main/java/xyz/fycz/myreader/greendao/entity/Book.java index 0379bd4..54cd9fc 100644 --- a/app/src/main/java/xyz/fycz/myreader/greendao/entity/Book.java +++ b/app/src/main/java/xyz/fycz/myreader/greendao/entity/Book.java @@ -65,6 +65,8 @@ public class Book implements Serializable { private int groupSort;//分组排序 + private boolean reSeg;//智能分段 + private String tag; private Boolean replaceEnable = SharedPreUtils.getInstance().getBoolean("replaceEnableDefault", true); @@ -83,13 +85,13 @@ public class Book implements Serializable { public Book() { } - @Generated(hash = 1910282685) - public Book(String id, String name, String chapterUrl, String infoUrl, String imgUrl, String desc, - String author, String type, String updateDate, String wordCount, String status, - String newestChapterId, String newestChapterTitle, String historyChapterId, int histtoryChapterNum, - int sortCode, int noReadNum, int chapterTotalNum, int lastReadPosition, String source, - boolean isCloseUpdate, boolean isDownLoadAll, String groupId, int groupSort, String tag, - Boolean replaceEnable, long lastReadTime, String variable) { + @Generated(hash = 1472063028) + public Book(String id, String name, String chapterUrl, String infoUrl, String imgUrl, String desc, String author, + String type, String updateDate, String wordCount, String status, String newestChapterId, + String newestChapterTitle, String historyChapterId, int histtoryChapterNum, int sortCode, int noReadNum, + int chapterTotalNum, int lastReadPosition, String source, boolean isCloseUpdate, boolean isDownLoadAll, + String groupId, int groupSort, boolean reSeg, String tag, Boolean replaceEnable, long lastReadTime, + String variable) { this.id = id; this.name = name; this.chapterUrl = chapterUrl; @@ -114,6 +116,7 @@ public class Book implements Serializable { this.isDownLoadAll = isDownLoadAll; this.groupId = groupId; this.groupSort = groupSort; + this.reSeg = reSeg; this.tag = tag; this.replaceEnable = replaceEnable; this.lastReadTime = lastReadTime; @@ -419,4 +422,12 @@ public class Book implements Serializable { catheMap.clear(); } } + + public boolean getReSeg() { + return this.reSeg; + } + + public void setReSeg(boolean reSeg) { + this.reSeg = reSeg; + } } diff --git a/app/src/main/java/xyz/fycz/myreader/model/storage/BackupRestoreUi.kt b/app/src/main/java/xyz/fycz/myreader/model/storage/BackupRestoreUi.kt index 6e6aaac..55f9d96 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/storage/BackupRestoreUi.kt +++ b/app/src/main/java/xyz/fycz/myreader/model/storage/BackupRestoreUi.kt @@ -5,10 +5,8 @@ import android.app.Activity.RESULT_OK import android.content.Intent import android.net.Uri import android.text.TextUtils -import androidx.core.content.ContextCompat import androidx.documentfile.provider.DocumentFile import com.kongzue.dialogx.dialogs.BottomMenu -import com.kongzue.dialogx.interfaces.OnMenuItemClickListener import io.reactivex.Single import io.reactivex.SingleEmitter import io.reactivex.android.schedulers.AndroidSchedulers @@ -17,7 +15,6 @@ import xyz.fycz.myreader.R import xyz.fycz.myreader.application.App import xyz.fycz.myreader.application.SysManager import xyz.fycz.myreader.base.observer.MySingleObserver -import xyz.fycz.myreader.common.APPCONST import xyz.fycz.myreader.model.storage.WebDavHelp.getWebDavFileNames import xyz.fycz.myreader.model.storage.WebDavHelp.showRestoreDialog import xyz.fycz.myreader.util.SharedPreUtils @@ -139,7 +136,7 @@ object BackupRestoreUi : Backup.CallBack, Restore.CallBack { .observeOn(AndroidSchedulers.mainThread()) .subscribe(object : MySingleObserver?>() { override fun onSuccess(strings: ArrayList) { - if (!showRestoreDialog(activity, strings, this@BackupRestoreUi)) { + if (!showRestoreDialog(strings, this@BackupRestoreUi)) { val path = getBackupPath() if (TextUtils.isEmpty(path)) { selectRestoreFolder(activity) diff --git a/app/src/main/java/xyz/fycz/myreader/model/storage/Restore.kt b/app/src/main/java/xyz/fycz/myreader/model/storage/Restore.kt index 48a0ea4..b39fbaa 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/storage/Restore.kt +++ b/app/src/main/java/xyz/fycz/myreader/model/storage/Restore.kt @@ -23,6 +23,7 @@ object Restore { fun restore(context: Context, uri: Uri, callBack: CallBack?) { Single.create(SingleOnSubscribe { e -> + deleteOldFile() DocumentFile.fromTreeUri(context, uri)?.listFiles()?.forEach { doc -> for (fileName in Backup.backupFileNames) { if (doc.name == fileName) { @@ -48,6 +49,15 @@ object Restore { }) } + private fun deleteOldFile() { + val dir = FileUtils.getFile(Backup.backupPath) + dir.listFiles()?.forEach { + if (it.name in Backup.backupFileNames){ + it?.delete() + } + } + } + fun restore(path: String, callBack: CallBack?) { Single.create(SingleOnSubscribe { e -> try { diff --git a/app/src/main/java/xyz/fycz/myreader/model/storage/WebDavHelp.kt b/app/src/main/java/xyz/fycz/myreader/model/storage/WebDavHelp.kt index a387aac..64f0f52 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/storage/WebDavHelp.kt +++ b/app/src/main/java/xyz/fycz/myreader/model/storage/WebDavHelp.kt @@ -1,15 +1,12 @@ package xyz.fycz.myreader.model.storage -import android.content.Context import android.os.Handler import android.os.Looper import com.kongzue.dialogx.dialogs.BottomMenu -import com.kongzue.dialogx.interfaces.OnMenuItemClickListener import io.reactivex.Single import io.reactivex.SingleOnSubscribe import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.schedulers.Schedulers -import org.jetbrains.anko.selector import xyz.fycz.myreader.R import xyz.fycz.myreader.base.observer.MySingleObserver import xyz.fycz.myreader.common.APPCONST @@ -70,7 +67,7 @@ object WebDavHelp { return names } - fun showRestoreDialog(context: Context, names: ArrayList, callBack: Restore.CallBack?): Boolean { + fun showRestoreDialog(names: ArrayList, callBack: Restore.CallBack?): Boolean { return if (names.isNotEmpty()) { /*context.selector(title = "选择恢复文件", items = names) { _, index -> if (index in 0 until 30.coerceAtLeast(names.size)) { diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/MoreSettingActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/MoreSettingActivity.java index fc6af94..8cdd4fb 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/MoreSettingActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/MoreSettingActivity.java @@ -84,7 +84,6 @@ public class MoreSettingActivity extends BaseActivity implements SharedPreferenc private boolean noMenuTitle; private boolean readAloudVolumeTurnPage; private boolean enType; - private boolean reSeg; private ArrayList mBooks; int booksCount; @@ -129,7 +128,6 @@ public class MoreSettingActivity extends BaseActivity implements SharedPreferenc noMenuTitle = mSetting.isNoMenuChTitle(); readAloudVolumeTurnPage = mSetting.isReadAloudVolumeTurnPage(); enType = mSetting.isEnType(); - reSeg = mSetting.isLightNovelParagraph(); threadNum = SharedPreUtils.getInstance().getInt(getString(R.string.threadNum), 8); isWebDav = getIntent().getBooleanExtra(APPCONST.WEB_DAV, false); } @@ -216,7 +214,6 @@ public class MoreSettingActivity extends BaseActivity implements SharedPreferenc binding.scLongPress.setChecked(isLongPress); binding.scNoMenuTitle.setChecked(noMenuTitle); binding.scAdaptEnType.setChecked(enType); - binding.scReSeg.setChecked(reSeg); binding.scReadAloudVolumeTurnPage.setChecked(readAloudVolumeTurnPage); } @@ -300,14 +297,6 @@ public class MoreSettingActivity extends BaseActivity implements SharedPreferenc } ); - binding.rlReSeg.setOnClickListener(v -> { - needRefresh = true; - reSeg = !reSeg; - binding.scReSeg.setChecked(reSeg); - mSetting.setLightNovelParagraph(reSeg); - SysManager.saveSetting(mSetting); - }); - binding.llBookSort.setOnClickListener(v -> { /*MyAlertDialog.build(this) .setTitle(getString(R.string.book_sort)) diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java index fcbdcff..2a6db72 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java @@ -722,6 +722,7 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe menu.findItem(R.id.action_open_link).setVisible(false); menu.findItem(R.id.action_download).setVisible(false); } + menu.findItem(R.id.action_re_seg).setChecked(mBook.getReSeg()); return super.onPrepareOptionsMenu(menu); } @@ -760,6 +761,12 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe } else if (itemId == R.id.action_replace_content) { Intent ruleIntent = new Intent(this, ReplaceRuleActivity.class); startActivityForResult(ruleIntent, APPCONST.REQUEST_REFRESH_READ_UI); + }else if(itemId == R.id.action_re_seg){ + mBook.setReSeg(!mBook.getReSeg()); + mBookService.updateEntity(mBook); + if (mPageLoader != null) { + mPageLoader.refreshUi(); + } } else if (itemId == R.id.action_copy_content) { String content = mPageLoader.getContentStartPage(0); MyAlertDialog.showTipDialogWithLink(this, "拷贝内容", content == null ? "章节内容为空!" : content); diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/SearchAdapter.kt b/app/src/main/java/xyz/fycz/myreader/ui/adapter/SearchAdapter.kt index 1dab982..425fb48 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/SearchAdapter.kt +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/SearchAdapter.kt @@ -309,7 +309,7 @@ class SearchAdapter( } } if (filterDataS.size > 0) { - val searchBookBeansAdd: MutableList = java.util.ArrayList() + val searchBookBeansAdd: MutableList = ArrayList() if (copyDataS.size == 0) { copyDataS.addAll(filterDataS) } else { @@ -345,10 +345,8 @@ class SearchAdapter( } else if (TextUtils.equals(keyWord, temp.author)) { for (i in copyDataS.indices) { val searchBook = copyDataS[i] - if (!TextUtils.equals(keyWord, searchBook.name) && !TextUtils.equals( - keyWord, - searchBook.author - ) + if (!TextUtils.equals(keyWord, searchBook.name) && + !TextUtils.equals(keyWord, searchBook.author) ) { copyDataS.add(i, temp) break diff --git a/app/src/main/java/xyz/fycz/myreader/ui/fragment/MineFragment.java b/app/src/main/java/xyz/fycz/myreader/ui/fragment/MineFragment.java index 08cb948..a8ef231 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/fragment/MineFragment.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/fragment/MineFragment.java @@ -184,7 +184,7 @@ public class MineFragment extends BaseFragment { } @Override public void onSuccess(ArrayList strings) { - if (!WebDavHelp.INSTANCE.showRestoreDialog(getContext(), strings, new Restore.CallBack() { + if (!WebDavHelp.INSTANCE.showRestoreDialog(strings, new Restore.CallBack() { @Override public void restoreSuccess() { SysManager.regetmSetting(); diff --git a/app/src/main/java/xyz/fycz/myreader/ui/fragment/WebDavFragment.java b/app/src/main/java/xyz/fycz/myreader/ui/fragment/WebDavFragment.java index 090bde3..c49a0bb 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/fragment/WebDavFragment.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/fragment/WebDavFragment.java @@ -130,7 +130,7 @@ public class WebDavFragment extends BaseFragment { } @Override public void onSuccess(ArrayList strings) { - if (!WebDavHelp.INSTANCE.showRestoreDialog(getContext(), strings, new Restore.CallBack() { + if (!WebDavHelp.INSTANCE.showRestoreDialog(strings, new Restore.CallBack() { @Override public void restoreSuccess() { SysManager.regetmSetting(); diff --git a/app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java b/app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java index 0544a47..6e57b1e 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java @@ -504,10 +504,10 @@ public class BookcasePresenter implements BasePresenter { } else if (itemId == R.id.action_addLocalBook) { addLocalBook(); return true; - } else if (itemId == R.id.action_add_url) { + } /*else if (itemId == R.id.action_add_url) { return true; - } else if (itemId == R.id.action_download_all) { + }*/ else if (itemId == R.id.action_download_all) { if (!SharedPreUtils.getInstance().getBoolean(mMainActivity.getString(R.string.isReadDownloadAllTip), false)) { DialogCreator.createCommonDialog(mMainActivity, "一键缓存", mMainActivity.getString(R.string.all_cathe_tip), true, diff --git a/app/src/main/java/xyz/fycz/myreader/util/help/ChapterContentHelp.java b/app/src/main/java/xyz/fycz/myreader/util/help/ChapterContentHelp.java index f54cb5e..b3e79d6 100644 --- a/app/src/main/java/xyz/fycz/myreader/util/help/ChapterContentHelp.java +++ b/app/src/main/java/xyz/fycz/myreader/util/help/ChapterContentHelp.java @@ -493,90 +493,90 @@ public class ChapterContentHelp { * @return */ public static String LightNovelParagraph2(String content, String chapterName) { - if (SysManager.getSetting().isLightNovelParagraph()) { - String _content; - int chapterNameLength = chapterName.trim().length(); - if (chapterNameLength > 1) { - String regexp = chapterName.trim().replaceAll("\\s+", "(\\\\s*)"); +// if (SysManager.getSetting().isLightNovelParagraph()) { + String _content; + int chapterNameLength = chapterName.trim().length(); + if (chapterNameLength > 1) { + String regexp = chapterName.trim().replaceAll("\\s+", "(\\\\s*)"); // 质量较低的页面,章节内可能重复出现章节标题 - if (chapterNameLength > 5) - _content = content.replaceAll(regexp, "").trim(); - else - _content = content.replaceFirst("^\\s*" + regexp, "").trim(); - } else { - _content = content; - } + if (chapterNameLength > 5) + _content = content.replaceAll(regexp, "").trim(); + else + _content = content.replaceFirst("^\\s*" + regexp, "").trim(); + } else { + _content = content; + } - List dict = makeDict(_content); + List dict = makeDict(_content); - String[] p = _content - .replaceAll(""", "“") - .replaceAll("[::]['\"‘”“]+", ":“") - .replaceAll("[\"”“]+[\\s]*[\"”“][\\s\"”“]*", "”\n“") - .split("\n(\\s*)"); + String[] p = _content + .replaceAll(""", "“") + .replaceAll("[::]['\"‘”“]+", ":“") + .replaceAll("[\"”“]+[\\s]*[\"”“][\\s\"”“]*", "”\n“") + .split("\n(\\s*)"); // 初始化StringBuffer的长度,在原content的长度基础上做冗余 - StringBuffer buffer = new StringBuffer((int) (content.length() * 1.15)); + StringBuffer buffer = new StringBuffer((int) (content.length() * 1.15)); // 章节的文本格式为章节标题-空行-首段,所以处理段落时需要略过第一行文本。 - buffer.append(" "); + buffer.append(" "); - if (!chapterName.trim().equals(p[0].trim())) { - // 去除段落内空格。unicode 3000 象形字间隔(中日韩符号和标点),不包含在\s内 - buffer.append(p[0].replaceAll("[\u3000\\s]+", "")); - } + if (!chapterName.trim().equals(p[0].trim())) { + // 去除段落内空格。unicode 3000 象形字间隔(中日韩符号和标点),不包含在\s内 + buffer.append(p[0].replaceAll("[\u3000\\s]+", "")); + } // 如果原文存在分段错误,需要把段落重新黏合 - for (int i = 1; i < p.length; i++) { - if (match(MARK_SENTENCES_END, buffer.charAt(buffer.length() - 1))) - buffer.append("\n"); + for (int i = 1; i < p.length; i++) { + if (match(MARK_SENTENCES_END, buffer.charAt(buffer.length() - 1))) + buffer.append("\n"); // 段落开头以外的地方不应该有空格 - // 去除段落内空格。unicode 3000 象形字间隔(中日韩符号和标点),不包含在\s内 - buffer.append(p[i].replaceAll("[\u3000\\s]", "")); + // 去除段落内空格。unicode 3000 象形字间隔(中日韩符号和标点),不包含在\s内 + buffer.append(p[i].replaceAll("[\u3000\\s]", "")); - } - // 预分段预处理 - // ”“处理为”\n“。 - // ”。“处理为”。\n“。不考虑“?” “!”的情况。 + } + // 预分段预处理 + // ”“处理为”\n“。 + // ”。“处理为”。\n“。不考虑“?” “!”的情况。 // ”。xxx处理为 ”。\n xxx - p = buffer.toString() - .replaceAll("[\"”“]+[\\s]*[\"”“]+", "”\n“") - .replaceAll("[\"”“]+(?。!?!~)[\"”“]+", "”$1\n“") - .replaceAll("[\"”“]+(?。!?!~)([^\"”“])", "”$1\n$2") - .replaceAll("([问说喊唱叫骂道着答])[\\.。]", "$1。\n") + p = buffer.toString() + .replaceAll("[\"”“]+[\\s]*[\"”“]+", "”\n“") + .replaceAll("[\"”“]+(?。!?!~)[\"”“]+", "”$1\n“") + .replaceAll("[\"”“]+(?。!?!~)([^\"”“])", "”$1\n$2") + .replaceAll("([问说喊唱叫骂道着答])[\\.。]", "$1。\n") // .replaceAll("([\\.。\\!!??])([^\"”“]+)[::][\"”“]", "$1\n$2:“") - .split("\n"); + .split("\n"); - buffer = new StringBuffer((int) (content.length() * 1.15)); + buffer = new StringBuffer((int) (content.length() * 1.15)); - for (String s : p) { - buffer.append("\n"); - buffer.append(FindNewLines(s, dict) - ); - } + for (String s : p) { + buffer.append("\n"); + buffer.append(FindNewLines(s, dict) + ); + } - buffer = reduceLength(buffer); - - content = chapterName + "\n\n" - + buffer.toString() - //处理章节头部空格和换行 - .replaceFirst("^\\s+", "") - // 此规则会造成不规范引号被误换行,暂时无法解决,我认为利大于弊 - // 例句:“你”“我”“他”都是一样的 - // 误处理为 “你”\n“我”\n“他”都是一样的 - // 而规范使用的标点不会被误处理: “你”、“我”、“他”,都是一样的。 - .replaceAll("\\s*[\"”“]+[\\s]*[\"”“][\\s\"”“]*", "”\n“") - // 规范 A:“B... - .replaceAll("[::][”“\"\\s]+", ":“") - // 处理奇怪的多余引号 \n”A:“B... 为 \nA:“B... - .replaceAll("\n[\"“”]([^\n\"“”]+)([,:,:][\"”“])([^\n\"“”]+)", "\n$1:“$3") - .replaceAll("\n(\\s*)", "\n") - // 处理“……” + buffer = reduceLength(buffer); + + content = chapterName + "\n\n" + + buffer.toString() + //处理章节头部空格和换行 + .replaceFirst("^\\s+", "") + // 此规则会造成不规范引号被误换行,暂时无法解决,我认为利大于弊 + // 例句:“你”“我”“他”都是一样的 + // 误处理为 “你”\n“我”\n“他”都是一样的 + // 而规范使用的标点不会被误处理: “你”、“我”、“他”,都是一样的。 + .replaceAll("\\s*[\"”“]+[\\s]*[\"”“][\\s\"”“]*", "”\n“") + // 规范 A:“B... + .replaceAll("[::][”“\"\\s]+", ":“") + // 处理奇怪的多余引号 \n”A:“B... 为 \nA:“B... + .replaceAll("\n[\"“”]([^\n\"“”]+)([,:,:][\"”“])([^\n\"“”]+)", "\n$1:“$3") + .replaceAll("\n(\\s*)", "\n") + // 处理“……” // .replaceAll("\n[\"”“][.,。,…]+\\s*[.,。,…]+[\"”“]","\n“……”") - // 处理被错误断行的省略号。存在较高的误判,但是我认为利大于弊 - .replaceAll("[.,。,…]+\\s*[.,。,…]+", "……") - .replaceAll("\n([\\s::,,]+)", "\n") - ; - } + // 处理被错误断行的省略号。存在较高的误判,但是我认为利大于弊 + .replaceAll("[.,。,…]+\\s*[.,。,…]+", "……") + .replaceAll("\n([\\s::,,]+)", "\n") + ; +// } return content; } 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 09d0a1d..f6a0808 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 @@ -285,9 +285,7 @@ public abstract class PageLoader { mTextPaint = new TextPaint(); mTextPaint.setColor(mTextColor); mTextPaint.setTextSize(mTextSize); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - mTextPaint.setLetterSpacing(mSettingManager.getTextLetterSpacing()); - } + mTextPaint.setLetterSpacing(mSettingManager.getTextLetterSpacing()); mTextPaint.setTypeface(mTypeFace); mTextPaint.setAntiAlias(true); @@ -295,9 +293,7 @@ public abstract class PageLoader { mTitlePaint = new TextPaint(); mTitlePaint.setColor(mTextColor); mTitlePaint.setTextSize(mTitleSize); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - mTitlePaint.setLetterSpacing(mSettingManager.getTextLetterSpacing()); - } + mTitlePaint.setLetterSpacing(mSettingManager.getTextLetterSpacing()); mTitlePaint.setStyle(Paint.Style.FILL_AND_STROKE); mTitlePaint.setTypeface(Typeface.create(mTypeFace, Typeface.BOLD)); mTitlePaint.setAntiAlias(true); @@ -1672,7 +1668,9 @@ public abstract class PageLoader { TxtChapter txtChapter = new TxtChapter(chapter.getNumber()); content = contentHelper.replaceContent(mCollBook.getName() + "-" + mCollBook.getAuthor(), mCollBook.getSource(), content, true); - content = contentHelper.LightNovelParagraph2(content, chapter.getTitle()); + if (mCollBook.getReSeg()) { + content = contentHelper.LightNovelParagraph2(content, chapter.getTitle()); + } String[] allLine = content.split("\n"); //使用流的方式加载 diff --git a/app/src/main/res/drawable/ic_re_seg.xml b/app/src/main/res/drawable/ic_re_seg.xml new file mode 100644 index 0000000..d5908ac --- /dev/null +++ b/app/src/main/res/drawable/ic_re_seg.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/layout/activity_more_setting.xml b/app/src/main/res/layout/activity_more_setting.xml index 7891044..f7cff75 100644 --- a/app/src/main/res/layout/activity_more_setting.xml +++ b/app/src/main/res/layout/activity_more_setting.xml @@ -297,33 +297,6 @@ android:longClickable="false" /> - - - - - - - - + app:showAsAction="never" />--> + + + 联系作者 浏览器 添加网址 - 章节内容智能分段 + 智能分段 备份路径 缓存路径 排序方式