Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
gedoor committed Nov 4, 2018
1 parent 8fefef7 commit 2431b63
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,9 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.action_book_info:
BookInfoActivity.startThis(this, mPresenter.getBookShelf().getNoteUrl());
break;
case R.id.action_set_charset:
setCharset();
break;
case R.id.update_chapter_list:
if (mPageLoader != null) {
mPageLoader.updateChapter();
Expand Down Expand Up @@ -968,6 +971,24 @@ private void download() {
}
}

/**
* 设置编码
*/
private void setCharset() {
final String charset = getBook().getBookInfoBean().getCharset();
moProgressHUD.showInputBox("TXT目录正则",
charset,
(inputText -> {
if (!Objects.equals(charset, inputText)) {
getBook().getBookInfoBean().setChapterUrl(inputText);
mPresenter.saveProgress();
if (mPageLoader != null) {
mPageLoader.updateChapter();
}
}
}));
}

/**
* 设置TXT目录正则
*/
Expand All @@ -978,7 +999,7 @@ private void setTextChapterRegex() {
regex,
(inputText -> {
if (!Objects.equals(regex, inputText)) {
getBook().getBookInfoBean().setChapterUrl(regex);
getBook().getBookInfoBean().setChapterUrl(inputText);
mPresenter.saveProgress();
if (mPageLoader != null) {
mPageLoader.updateChapter();
Expand Down

0 comments on commit 2431b63

Please sign in to comment.