Skip to content

Commit

Permalink
Merge pull request #3 from gedoor/master
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
Celeter authored Apr 11, 2020
2 parents 1b15fc9 + fbc1f61 commit 215ce88
Show file tree
Hide file tree
Showing 90 changed files with 2,005 additions and 1,949 deletions.
30 changes: 16 additions & 14 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'org.greenrobot.greendao'
apply plugin: 'io.fabric'
apply plugin: "de.timfreiheit.resourceplaceholders"
Expand Down Expand Up @@ -70,11 +70,11 @@ resourcePlaceholders {
}

dependencies {
testImplementation 'junit:junit:4.13-beta-3'
testImplementation 'junit:junit:4.13'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':basemvplib')

api 'androidx.core:core-ktx:1.2.0-rc01'
api 'androidx.core:core-ktx:1.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

//anko
Expand All @@ -83,7 +83,7 @@ dependencies {
implementation "org.jetbrains.anko:anko-sdk27-listeners:$anko_version"

//fireBase
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-core:17.3.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'

//androidX
Expand All @@ -94,39 +94,41 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'

//google
implementation 'com.google.android.material:material:1.2.0-alpha03'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.google.android.material:material:1.2.0-alpha05'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.android:flexbox:1.1.0'

//J_SOUP
implementation 'org.jsoup:jsoup:1.12.1'
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'cn.wanghaomiao:JsoupXpath:2.3.2'
implementation 'com.jayway.jsonpath:json-path:2.4.0'

//JS
//noinspection GradleDependency
implementation 'com.github.gedoor:rhino-android:1.3'

//GreenDao
implementation 'org.greenrobot:greendao:3.2.2'
implementation 'com.github.yuweiguocn:GreenDaoUpgradeHelper:v2.1.0'

//Glide
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'

//CircleImageView
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'

//bind view
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
//noinspection AnnotationProcessorOnCompilePath
implementation 'com.jakewharton:butterknife:10.2.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'

//webServer
implementation 'org.nanohttpd:nanohttpd:2.3.1'
implementation 'org.nanohttpd:nanohttpd-websocket:2.3.1'

//二维码
implementation 'cn.bingoogolapple:bga-qrcode-zxing:1.3.6'
implementation 'cn.bingoogolapple:bga-qrcode-zxing:1.3.7'

//颜色选择
implementation 'com.jaredrummler:colorpicker:1.1.0'
Expand All @@ -138,7 +140,7 @@ dependencies {
implementation 'net.ricecode:string-similarity:1.0.0'

//MarkDown
implementation 'ru.noties.markwon:core:3.0.2'
implementation 'ru.noties.markwon:core:3.1.0'

//epub
implementation('nl.siegmann.epublib:epublib-core:3.1') {
Expand Down
13 changes: 2 additions & 11 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>
<activity-alias
<activity
android:name=".view.activity.WelcomeBookActivity"
android:targetActivity=".view.activity.WelcomeActivity"
android:enabled="false"
android:icon="@mipmap/book_launcher"
android:roundIcon="@mipmap/book_launcher_round"
Expand All @@ -57,13 +56,6 @@
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity-alias>
<activity
android:name=".view.activity.WelcomeToReadActivity"
android:theme="@style/CAppWelcomeTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".view.activity.ReadBookActivity"
Expand Down Expand Up @@ -100,8 +92,7 @@
<activity
android:name=".view.activity.QRCodeScanActivity"
android:configChanges="locale|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
android:launchMode="singleTask" />
<activity
android:name=".view.activity.MainActivity"
android:configChanges="locale|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout"
Expand Down
134 changes: 97 additions & 37 deletions app/src/main/assets/txtChapterRule.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,98 @@
[
{
"enable": true,
"name": "默认正则1",
"rule": "^(.{0,8})(第)([0-9零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]{1,10})([章节卷集部篇回场])(.{0,30})$",
"serialNumber": 0
},
{
"enable": true,
"name": "默认正则2",
"rule": "^([0-9]{1,5})([\\,\\.,-])(.{1,20})$",
"serialNumber": 1
},
{
"enable": true,
"name": "默认正则3",
"rule": "^(\\s{0,4})([\\(【《]?(卷)?)([0-9零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]{1,10})([\\.:: \f\t])(.{0,30})$",
"serialNumber": 2
},
{
"enable": true,
"name": "默认正则4",
"rule": "^(\\s{0,4})([\\((【《])(.{0,30})([\\))】》])(\\s{0,2})$",
"serialNumber": 3
},
{
"enable": true,
"name": "默认正则5",
"rule": "^(\\s{0,4})(正文)(.{0,20})$",
"serialNumber": 4
},
{
"enable": true,
"name": "默认正则6",
"rule": "^(.{0,4})(Chapter|chapter)(\\s{0,4})([0-9]{1,4})(.{0,30})$",
"serialNumber": 5
}
]
{
"enable": true,
"name": "目录",
"rule": "^[  \\t]{0,4}(?:(?:内容|文章)?简介|文案|前言|序章|楔子|正文(?!完|结)|终章|后记|尾声|番外|第?\\s{0,4}[\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+?\\s{0,4}(?:章|节(?!课)|卷|集(?![合和])|部(?!分)|篇(?!张))).{0,30}$",
"serialNumber": 0
},
{
"enable": false,
"name": "目录(去空白)",
"rule": "(?<=[ \\s])(?:(?:内容|文章)?简介|文案|前言|序章|楔子|正文(?!完|结)|终章|后记|尾声|番外|第?\\s{0,4}[\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+?\\s{0,4}(?:章|节(?!课)|卷|集(?![合和])|部(?!分)|篇(?!张))).{0,30}$",
"serialNumber": 1
},
{
"enable": false,
"name": "目录(去简介)",
"rule": "(?<=[ \\s])(?:前言|序章|楔子|正文(?!完|结)|终章|后记|尾声|番外|第?\\s{0,4}[\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+?\\s{0,4}(?:章|节(?!课)|卷|集(?![合和])|部(?!分)|回(?![合来事去])|场(?![和合比电是])|篇(?!张))).{0,30}$",
"serialNumber": 2
},
{
"enable": false,
"name": "目录(古典、轻小说备用)",
"rule": "^[  \\t]{0,4}(?:前言|序章|楔子|正文(?!完|结)|终章|后记|尾声|番外|第?\\s{0,4}[\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+?\\s{0,4}(?:章|节(?!课)|卷|集(?![合和])|部(?!分)|回(?![合来事去])|场(?![和合比电是])|篇(?!张))).{0,30}$",
"serialNumber": 3
},
{
"enable": false,
"name": "数字(纯数字标题)",
"rule": "(?<=[ \\s])\\d+[  \\t]{0,4}$",
"serialNumber": 4
},
{
"enable": true,
"name": "数字 分隔符 标题名称",
"rule": "^[  \\t]{0,4}\\d{1,5}[\\,\\., 、\\-].{1,30}$",
"serialNumber": 5
},
{
"enable": true,
"name": "正文 标题/序号",
"rule": "^[  \\t]{0,4}正文[  ]{1,4}.{0,20}$",
"serialNumber": 6
},
{
"enable": true,
"name": "Chapter/Section/Part/Episode 序号 标题",
"rule": "^[  \\t]{0,4}(?:[Cc]hapter|[Ss]ection|[Pp]art|PART|[Ee]pisode|(?:内容|文章)?简介|文案|前言|序章|楔子|正文(?!完|结)|终章|后记|尾声|番外)\\s{0,4}\\d{1,4}.{0,30}$",
"serialNumber": 7
},
{
"enable": false,
"name": "Chapter(去简介)",
"rule": "^[  \\t]{0,4}(?:[Cc]hapter|[Ss]ection|[Pp]art|PART|[Ee]pisode)\\s{0,4}\\d{1,4}.{0,30}$",
"serialNumber": 8
},
{
"enable": true,
"name": "特殊符号 序号 标题",
"rule": "(?<=[\\s ]{0,4}).{1,3}(?:第|卷|[Cc]hapter)[\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]{1,10}[章节]?[\\.:: \f\t].{0,20}$",
"serialNumber": 9
},
{
"enable": false,
"name": "特殊符号 标题(成对)",
"rule": "(?<=[\\s ]{0,4})(?:[\\[〈「『〖〔《(【\\(].{1,30}[\\)】)》〕〗』」〉\\]]?|(?:内容|文章)?简介|文案|前言|序章|楔子|正文(?!完|结)|终章|后记|尾声|番外)[  ]{0,4}$",
"serialNumber": 10
},
{
"enable":true,
"name": "特殊符号 标题(单个)",
"rule": "(?<=[\\s ]{0,4})(?:[☆★✦✧].{1,30}|(?:内容|文章)?简介|文案|前言|序章|楔子|正文(?!完|结)|终章|后记|尾声|番外)[  ]{0,4}$",
"serialNumber": 11
},
{
"enable": true,
"name": "章/卷 序号 标题",
"rule": "^[ \\t ]{0,4}(?:(?:内容|文章)?简介|文案|前言|序章|楔子|正文(?!完|结)|终章|后记|尾声|番外|[卷章][\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]{1,8})[  ]{0,4}.{0,30}$",
"serialNumber": 12
},
{
"enable":false,
"name": "顶格标题",
"rule": "^\\S.{1,20}$",
"serialNumber": 13
},
{
"enable":false,
"name": "双标题(前向)",
"rule": "(?m)(?<=[ \\t ]{0,4})第[\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]{1,8}章.{0,30}$(?=[\\s ]{0,8}第[\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]{1,8}章)",
"serialNumber": 14
},
{
"enable":false,
"name": "双标题(后向)",
"rule": "(?m)(?<=[ \\t ]{0,4}第[\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]{1,8}章.{0,30}$[\\s ]{0,8})第[\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]{1,8}章.{0,30}$",
"serialNumber": 15
}
]
44 changes: 41 additions & 3 deletions app/src/main/assets/updateLog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
## 本软件为开源软件,请不要在任何地方购买!
### 关注公众号[开源阅读软件]点击广告可支持作者!
### 捐赠里点击红包搜索码可开启高级功能!
## 更新日志
* 请关注[开源阅读]()支持我,同时关注合作公众号[小说拾遗](),阅读公众号小编。
* 弄了个企业公众号[开源阅读](),后面弄好后会把原来的[开源阅读软件]()迁移过来
* [3.0下载地址](https://www.coolapk.com/apk/256030)

**2020/04/11**
* 修复一些bug
* 更新一些库

**2020/03/20**
* 自动备份文件和手动备份文件分开
* 更新一些库文件

**2020/03/12**
* 更新txt解析目录 by 52fisher
* web看书加翻页 by Celeter

**2020/02/26**
* 更新默认txt目录规则,由https://github.com/52fisher提供
* 新版本快上架了,基本功能以完成,上架后再慢慢优化
* 别人说加广告一天能有几千收入,我不加广告大家给点力多看看公众号广告啊

**2020/02/15**
* 修复低版本手机无法联网的问题
* 优化备份恢复

**2020/02/10**
* 优化备份恢复
* 朗读定时会记住

**2020/02/05**
* 修复bug

**2020/02/04**
* 修复bug
* 更换默认封面,默认封面绘制书名作者

**2020/01/24**
* 修复备份bug
* 修复切换图标后不在后台显示的bug

**2020/01/21**
* 将规则解析后得到的字符串反转义(unescape)
* 在正文规则使用all可查看源码,例:`tag.body@all`
* 添加备份时选择备份文件夹--适配安卓10

**2020/01/09**
* 修复按键码为0时翻页的bug
Expand Down
23 changes: 12 additions & 11 deletions app/src/main/java/com/kunfei/bookshelf/base/BaseModelImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;

public class BaseModelImpl {
private static OkHttpClient.Builder clientBuilder;
private static OkHttpClient httpClient;

public static BaseModelImpl getInstance() {
return new BaseModelImpl();
Expand All @@ -41,19 +41,19 @@ public static BaseModelImpl getInstance() {
public Observable<Response<String>> getResponseO(AnalyzeUrl analyzeUrl) {
switch (analyzeUrl.getUrlMode()) {
case POST:
return getRetrofitString(analyzeUrl.getHost())
return getRetrofitString(analyzeUrl.getHost(), analyzeUrl.getCharCode())
.create(IHttpPostApi.class)
.postMap(analyzeUrl.getPath(),
analyzeUrl.getQueryMap(),
analyzeUrl.getHeaderMap());
case GET:
return getRetrofitString(analyzeUrl.getHost())
return getRetrofitString(analyzeUrl.getHost(), analyzeUrl.getCharCode())
.create(IHttpGetApi.class)
.getMap(analyzeUrl.getPath(),
analyzeUrl.getQueryMap(),
analyzeUrl.getHeaderMap());
default:
return getRetrofitString(analyzeUrl.getHost())
return getRetrofitString(analyzeUrl.getHost(), analyzeUrl.getCharCode())
.create(IHttpGetApi.class)
.get(analyzeUrl.getPath(),
analyzeUrl.getHeaderMap());
Expand All @@ -66,7 +66,7 @@ public Retrofit getRetrofitString(String url) {
.addConverterFactory(EncodeConverter.create())
//增加返回值为Observable<T>的支持
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(getClientBuilder().build())
.client(getClient())
.build();
}

Expand All @@ -76,23 +76,24 @@ public Retrofit getRetrofitString(String url, String encode) {
.addConverterFactory(EncodeConverter.create(encode))
//增加返回值为Observable<T>的支持
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(getClientBuilder().build())
.client(getClient())
.build();
}

private static OkHttpClient.Builder getClientBuilder() {
if (clientBuilder == null) {
clientBuilder = new OkHttpClient.Builder()
synchronized public static OkHttpClient getClient() {
if (httpClient == null) {
httpClient = new OkHttpClient.Builder()
.connectTimeout(15, TimeUnit.SECONDS)
.writeTimeout(15, TimeUnit.SECONDS)
.readTimeout(15, TimeUnit.SECONDS)
.retryOnConnectionFailure(true)
.sslSocketFactory(SSLSocketClient.getSSLSocketFactory(), SSLSocketClient.createTrustAllManager())
.hostnameVerifier(SSLSocketClient.getHostnameVerifier())
.protocols(Collections.singletonList(Protocol.HTTP_1_1))
.addInterceptor(getHeaderInterceptor());
.addInterceptor(getHeaderInterceptor())
.build();
}
return clientBuilder;
return httpClient;
}

private static Interceptor getHeaderInterceptor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ protected boolean isImmersionBarEnabled() {
/**
* 设置屏幕方向
*/
@SuppressLint("SourceLockedOrientationActivity")
public void setOrientation(int screenDirection) {
switch (screenDirection) {
case 0:
Expand Down
Loading

0 comments on commit 215ce88

Please sign in to comment.