From 49a89bb59035eeedb691e7948080657257853ca0 Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Tue, 16 Feb 2021 22:07:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81DIY=E4=B9=A6=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- app/src/main/assets/updatelog.fy | 11 ++++++++-- .../model/source/BookSourceManager.java | 22 ++++++++++++++----- .../ui/activity/SearchBookActivity.java | 2 +- app/version_code.properties | 2 +- source/DIYSource.md | 2 ++ 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1138496..c12d61d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ 风月读书,一款开源、无广告的小说阅读软件。 -成品下载(v1.8.2):[https://fycz.lanzous.com/iEy9kldwrpi](https://fycz.lanzous.com/iEy9kldwrpi) +成品下载(v1.9.0-beta 支持自定义书源):[https://fycz.lanzous.com/ixI19lqnscf](https://fycz.lanzous.com/ixI19lqnscf) [更新日志](./app/src/main/assets/updatelog.fy) diff --git a/app/src/main/assets/updatelog.fy b/app/src/main/assets/updatelog.fy index 2db4b8e..a1f1b7b 100644 --- a/app/src/main/assets/updatelog.fy +++ b/app/src/main/assets/updatelog.fy @@ -1,5 +1,12 @@ -风月读书v1.8.3 -1、优化阅读体验 +2020.02.16 +风月读书v1.9.0-beta +更新内容: +1、新增书源管理:内置书源、DIY书源 +2、新增自定义书源 +3、新增书源测试 +4、搜索时支持根据书源分组搜索 +5、优化阅读体验 +6、此版本为beta版本,如发现bug请及时反馈 2020.02.06 风月读书v1.8.2 diff --git a/app/src/main/java/xyz/fycz/myreader/model/source/BookSourceManager.java b/app/src/main/java/xyz/fycz/myreader/model/source/BookSourceManager.java index e596bfb..dc2f74d 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/source/BookSourceManager.java +++ b/app/src/main/java/xyz/fycz/myreader/model/source/BookSourceManager.java @@ -15,14 +15,17 @@ import io.reactivex.Observable; import io.reactivex.ObservableEmitter; import io.reactivex.Single; import io.reactivex.SingleOnSubscribe; +import io.reactivex.annotations.NonNull; import xyz.fycz.myreader.R; import xyz.fycz.myreader.application.App; +import xyz.fycz.myreader.base.observer.MyObserver; import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.GreenDaoManager; import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.greendao.gen.BookSourceDao; import xyz.fycz.myreader.util.SharedPreUtils; import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.utils.FileUtils; import xyz.fycz.myreader.util.utils.GsonUtils; import xyz.fycz.myreader.util.utils.MeUtils; @@ -271,7 +274,8 @@ public class BookSourceManager { String group = cursor.getString(0); if (TextUtils.isEmpty(group) || TextUtils.isEmpty(group.trim())) continue; for (String item : group.split("\\s*[,;,;]\\s*")) { - if (TextUtils.isEmpty(item) || groupList.contains(item)|| item.equals("内置书源")) continue; + if (TextUtils.isEmpty(item) || groupList.contains(item) || item.equals("内置书源")) + continue; groupList.add(item); } } while (cursor.moveToNext()); @@ -288,7 +292,8 @@ public class BookSourceManager { String group = cursor.getString(0); if (TextUtils.isEmpty(group) || TextUtils.isEmpty(group.trim())) continue; for (String item : group.split("\\s*[,;,;]\\s*")) { - if (TextUtils.isEmpty(item) || groupList.contains(item) || item.equals("内置书源")) continue; + if (TextUtils.isEmpty(item) || groupList.contains(item) || item.equals("内置书源")) + continue; groupList.add(item); } } while (cursor.moveToNext()); @@ -330,7 +335,7 @@ public class BookSourceManager { .where(BookSourceDao.Properties.SourceUrl.eq(bookSource.getSourceUrl())) .buildDelete().executeDeleteWithoutDetachingEntities(); } else { - if (addBookSource(bookSource)){ + if (addBookSource(bookSource)) { successImportSources.add(bookSource); } } @@ -373,7 +378,14 @@ public class BookSourceManager { source1.setOrderNum(0); GreenDaoManager.getDaoSession().getBookSourceDao().insertOrReplace(source1); } - BookSourceManager.importBookSourceFromJson(FileUtils.readAssertFile(App.getmContext(), - "ReferenceSources.json")); + String referenceSources = FileUtils.readAssertFile(App.getmContext(), + "ReferenceSources.json"); + Observable> observable = BookSourceManager.importBookSourceFromJson(referenceSources); + observable.subscribe(new MyObserver>() { + @Override + public void onNext(@NonNull List sources) { + + } + }); } } diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java index ea3ee8e..eda4a97 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java @@ -336,7 +336,7 @@ public class SearchBookActivity extends BaseActivity { */ public void initSourceGroupMenu() { if (menu == null) return; - String searchGroup = SharedPreUtils.getInstance().getString(""); + String searchGroup = SharedPreUtils.getInstance().getString("searchGroup"); menu.removeGroup(R.id.source_group); MenuItem item = menu.add(R.id.source_group, Menu.NONE, Menu.NONE, R.string.all_source); MenuItem localItem = menu.add(R.id.source_group, Menu.NONE, Menu.NONE, R.string.local_source); diff --git a/app/version_code.properties b/app/version_code.properties index 02d0b4d..0bc15dd 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Tue Feb 16 21:09:33 CST 2021 +#Tue Feb 16 22:03:51 CST 2021 VERSION_CODE=190 diff --git a/source/DIYSource.md b/source/DIYSource.md index 13c93c2..b9c4b22 100644 --- a/source/DIYSource.md +++ b/source/DIYSource.md @@ -2,6 +2,8 @@ ## 风月读书DIY书源说明 +[参考书源](./app/src/main/assets/ReferenceSources.json) + ### 一、解析器 #### 1、Matcher