diff --git a/app/src/main/java/com/monke/monkeybook/view/activity/ReadBookActivity.java b/app/src/main/java/com/monke/monkeybook/view/activity/ReadBookActivity.java index c7d39e0d47..ca575d35b5 100644 --- a/app/src/main/java/com/monke/monkeybook/view/activity/ReadBookActivity.java +++ b/app/src/main/java/com/monke/monkeybook/view/activity/ReadBookActivity.java @@ -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(); @@ -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目录正则 */ @@ -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();