支持DIY书源

pull/5/head
fengyuecanzhu 4 years ago
parent 61423861f6
commit 49a89bb590
  1. 2
      README.md
  2. 11
      app/src/main/assets/updatelog.fy
  3. 22
      app/src/main/java/xyz/fycz/myreader/model/source/BookSourceManager.java
  4. 2
      app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java
  5. 2
      app/version_code.properties
  6. 2
      source/DIYSource.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)

@ -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

@ -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<List<BookSource>> observable = BookSourceManager.importBookSourceFromJson(referenceSources);
observable.subscribe(new MyObserver<List<BookSource>>() {
@Override
public void onNext(@NonNull List<BookSource> sources) {
}
});
}
}

@ -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);

@ -1,2 +1,2 @@
#Tue Feb 16 21:09:33 CST 2021
#Tue Feb 16 22:03:51 CST 2021
VERSION_CODE=190

@ -2,6 +2,8 @@
## 风月读书DIY书源说明
[参考书源](./app/src/main/assets/ReferenceSources.json)
### 一、解析器
#### 1、Matcher

Loading…
Cancel
Save