Skip to content

Commit

Permalink
杀死应用时停止朗读
Browse files Browse the repository at this point in the history
  • Loading branch information
gedoor committed Sep 2, 2020
1 parent 8c64c62 commit ed73fe0
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 13 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ dependencies {
implementation "org.jetbrains.anko:anko-sdk27-listeners:$anko_version"

//fireBase
implementation 'com.google.firebase:firebase-core:17.4.4'
implementation 'com.google.firebase:firebase-core:17.5.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'

//androidX
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.media:media:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
Expand Down Expand Up @@ -168,7 +168,7 @@ dependencies {
}

greendao {
schemaVersion 64
schemaVersion 65
daoPackage 'com.kunfei.bookshelf.dao'
targetGenDir 'src/main/java'
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/updateLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 更新日志
* 请关注[开源阅读]()支持我,同时关注合作公众号[小说拾遗](),阅读公众号小编。
* 软件以后会在公众号更新,请关注作者公众号多多支持
* 软件以后会在公众号更新,请关注[开源阅读]()获取最新更新

**2020/08/28**
* 应用被杀死时停止朗读
Expand Down
24 changes: 17 additions & 7 deletions app/src/main/java/com/kunfei/bookshelf/bean/BookSourceBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,18 @@ public class BookSourceBean implements Cloneable {
//正文页规则
private String ruleContentUrlNext;
private String ruleBookContent;
private String ruleBookContentReplace;
private String httpUserAgent;

@Transient
private transient ArrayList<String> groupList;

@Generated(hash = 1840823895)
public BookSourceBean(String bookSourceUrl, String bookSourceName, String bookSourceGroup, String bookSourceType, String loginUrl, Long lastUpdateTime, int serialNumber, int weight, boolean enable, String ruleFindUrl,
String ruleFindList, String ruleFindName, String ruleFindAuthor, String ruleFindKind, String ruleFindIntroduce, String ruleFindLastChapter, String ruleFindCoverUrl, String ruleFindNoteUrl, String ruleSearchUrl,
String ruleSearchList, String ruleSearchName, String ruleSearchAuthor, String ruleSearchKind, String ruleSearchIntroduce, String ruleSearchLastChapter, String ruleSearchCoverUrl, String ruleSearchNoteUrl,
String ruleBookUrlPattern, String ruleBookInfoInit, String ruleBookName, String ruleBookAuthor, String ruleCoverUrl, String ruleIntroduce, String ruleBookKind, String ruleBookLastChapter, String ruleChapterUrl,
String ruleChapterUrlNext, String ruleChapterList, String ruleChapterName, String ruleContentUrl, String ruleContentUrlNext, String ruleBookContent, String httpUserAgent) {
@Generated(hash = 243497779)
public BookSourceBean(String bookSourceUrl, String bookSourceName, String bookSourceGroup, String bookSourceType, String loginUrl, Long lastUpdateTime, int serialNumber, int weight, boolean enable, String ruleFindUrl, String ruleFindList,
String ruleFindName, String ruleFindAuthor, String ruleFindKind, String ruleFindIntroduce, String ruleFindLastChapter, String ruleFindCoverUrl, String ruleFindNoteUrl, String ruleSearchUrl, String ruleSearchList,
String ruleSearchName, String ruleSearchAuthor, String ruleSearchKind, String ruleSearchIntroduce, String ruleSearchLastChapter, String ruleSearchCoverUrl, String ruleSearchNoteUrl, String ruleBookUrlPattern,
String ruleBookInfoInit, String ruleBookName, String ruleBookAuthor, String ruleCoverUrl, String ruleIntroduce, String ruleBookKind, String ruleBookLastChapter, String ruleChapterUrl, String ruleChapterUrlNext,
String ruleChapterList, String ruleChapterName, String ruleContentUrl, String ruleContentUrlNext, String ruleBookContent, String ruleBookContentReplace, String httpUserAgent) {
this.bookSourceUrl = bookSourceUrl;
this.bookSourceName = bookSourceName;
this.bookSourceGroup = bookSourceGroup;
Expand Down Expand Up @@ -126,6 +127,7 @@ public BookSourceBean(String bookSourceUrl, String bookSourceName, String bookSo
this.ruleContentUrl = ruleContentUrl;
this.ruleContentUrlNext = ruleContentUrlNext;
this.ruleBookContent = ruleBookContent;
this.ruleBookContentReplace = ruleBookContentReplace;
this.httpUserAgent = httpUserAgent;
}

Expand Down Expand Up @@ -163,7 +165,8 @@ && stringEquals(ruleSearchNoteUrl, bs.ruleSearchNoteUrl)
&& stringEquals(httpUserAgent, bs.httpUserAgent)
&& stringEquals(ruleBookKind, bs.ruleBookKind)
&& stringEquals(ruleBookLastChapter, bs.ruleBookLastChapter)
&& stringEquals(ruleBookUrlPattern, bs.ruleBookUrlPattern);
&& stringEquals(ruleBookUrlPattern, bs.ruleBookUrlPattern)
&& stringEquals(ruleBookContentReplace, bs.ruleBookContentReplace);
}
return false;
}
Expand Down Expand Up @@ -583,4 +586,11 @@ public void setRuleBookInfoInit(String ruleBookInfoInit) {
this.ruleBookInfoInit = ruleBookInfoInit;
}

public String getRuleBookContentReplace() {
return ruleBookContentReplace;
}

public void setRuleBookContentReplace(String ruleBookContentReplace) {
this.ruleBookContentReplace = ruleBookContentReplace;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ Observable<BookContentBean> analyzeBookContent(final String s, final BaseChapter
}
}
}
String replaceRule = bookSourceBean.getRuleBookContentReplace();
if (replaceRule != null && replaceRule.trim().length() > 0) {
analyzer.setContent(bookContentBean.getDurChapterContent());
bookContentBean.setDurChapterContent(analyzer.getString(replaceRule));
}
e.onNext(bookContentBean);
e.onComplete();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ public void setText(BookSourceBean bookSourceBean) {
//正文页
sourceEditList.add(new SourceEdit("ruleContentUrlNext", bookSourceBean.getRuleContentUrlNext(), R.string.rule_content_url_next));
sourceEditList.add(new SourceEdit("ruleBookContent", bookSourceBean.getRuleBookContent(), R.string.rule_book_content));
sourceEditList.add(new SourceEdit("ruleBookContentReplace", bookSourceBean.getRuleBookContentReplace(), R.string.rule_book_content_replace));
sourceEditList.add(new SourceEdit("httpUserAgent", bookSourceBean.getHttpUserAgent(), R.string.source_user_agent));

//发现
Expand Down Expand Up @@ -381,6 +382,9 @@ private BookSourceBean getBookSource(boolean hasFind) {
case "ruleBookContent":
bookSourceBeanN.setRuleBookContent(sourceEdit.value);
break;
case "ruleBookContentReplace":
bookSourceBeanN.setRuleBookContentReplace(sourceEdit.value);
break;
case "httpUserAgent":
bookSourceBeanN.setHttpUserAgent(sourceEdit.value);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@ static class ChapterContainer {

/**
* --------------------
* TODO 检测获取按压坐标所在位置的字符,没有的话返回null
* 检测获取按压坐标所在位置的字符,没有的话返回null
* --------------------
* author: huangwei
* 2017年7月4日上午10:23:19
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@
<string name="book_source_login_url">登錄URL(loginUrl)</string>
<string name="rule_book_author">作者規則(ruleBookAuthor)</string>
<string name="rule_book_content">正文規則(ruleBookContent)</string>
<string name="rule_book_content_replace">正文替换規則(ruleBookContentReplace)</string>
<string name="rule_book_name">書名規則(ruleBookName)</string>
<string name="rule_chapter_list">目錄列表規則(ruleChapterList)</string>
<string name="rule_chapter_name">章節名稱規則(ruleChapterName)</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@
<string name="book_source_login_url">登录URL(loginUrl)</string>
<string name="rule_book_author">作者规则(ruleBookAuthor)</string>
<string name="rule_book_content">正文规则(ruleBookContent)</string>
<string name="rule_book_content_replace">正文替换规则(ruleBookContentReplace)</string>
<string name="rule_book_name">书名规则(ruleBookName)</string>
<string name="rule_chapter_list">目录列表规则(ruleChapterList)</string>
<string name="rule_chapter_name">章节名称规则(ruleChapterName)</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ext {
support_library_version = '28.0.0'
}
buildscript {
ext.kotlin_version = '1.3.72'
ext.kotlin_version = '1.4.0'
repositories {
google()
jcenter()
Expand Down

0 comments on commit ed73fe0

Please sign in to comment.