From d0e5b5cd723b8269b5a41e983eb034e4db52372e Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Fri, 8 Jan 2021 23:35:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E5=B7=B2?= =?UTF-8?q?=E7=9F=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/caches/build_file_checksums.ser | Bin 537 -> 537 bytes app/src/main/assets/fonts/_csrfToken.fy | 10 --- app/src/main/assets/updatelog.fy | 6 +- .../fycz/myreader/application/SysManager.java | 10 ++- .../xyz/fycz/myreader/common/APPCONST.java | 2 +- .../ui/activity/BookstoreActivity.java | 75 ++++++++++-------- .../ui/activity/FeedbackActivity.java | 6 +- .../myreader/ui/activity/ReadActivity.java | 34 ++++++++ .../webapi/crawler/find/QiDianMobileRank.java | 2 +- .../myreader/widget/page/LocalPageLoader.java | 5 +- .../res/layout/layout_book_detail_content.xml | 2 +- app/src/main/res/values/strings.xml | 4 +- app/version_code.properties | 2 +- 13 files changed, 102 insertions(+), 56 deletions(-) delete mode 100644 app/src/main/assets/fonts/_csrfToken.fy diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 1d7a418422088f3aaf87c171bf669fdc2e84ab8b..bdb9dafd9f32a4ea496a76d54288089d7f523fd3 100644 GIT binary patch delta 15 XcmbQqGLvP(43 bookList = (List) msg.obj; - initBookList(bookList); - srlBookList.setEnableRefresh(true); - srlBookList.setEnableLoadMore(true); - pbLoading.setVisibility(View.GONE); - break; - case 3: - pbLoading.setVisibility(View.VISIBLE); - break; - case 4: - pbLoading.setVisibility(View.GONE); - srlBookList.finishRefresh(false); - srlBookList.finishLoadMore(false); - break; - case 5: - mRlRefresh.showError(); - break; - case 6: - DialogCreator.createTipDialog(BookstoreActivity.this, - getResources().getString(R.string.top_sort_tip, title)); - break; - } + switch (msg.what) { + case 1: + initTypeList(); + mRlRefresh.showFinish(); + break; + case 2: + List bookList = (List) msg.obj; + initBookList(bookList); + srlBookList.setEnableRefresh(true); + srlBookList.setEnableLoadMore(true); + pbLoading.setVisibility(View.GONE); + break; + case 3: + pbLoading.setVisibility(View.VISIBLE); + break; + case 4: + pbLoading.setVisibility(View.GONE); + srlBookList.finishRefresh(false); + srlBookList.finishLoadMore(false); + break; + case 5: + mRlRefresh.showError(); + break; + case 6: + DialogCreator.createTipDialog(BookstoreActivity.this, + getResources().getString(R.string.top_sort_tip, title)); + break; } } }; @@ -225,6 +227,7 @@ public class BookstoreActivity extends BaseActivity { ((QiDianMobileRank) findCrawler).initCookie(this, new ResultCallback() { @Override public void onFinish(Object o, int code) { + if (MyApplication.isDestroy(BookstoreActivity.this)) return; spu.putString(getString(R.string.qdCookie), (String) o); mBookTypes = findCrawler.getBookTypes(); initBooks(); @@ -232,6 +235,7 @@ public class BookstoreActivity extends BaseActivity { @Override public void onError(Exception e) { + if (MyApplication.isDestroy(BookstoreActivity.this)) return; mRlRefresh.showError(); e.printStackTrace(); } @@ -240,18 +244,20 @@ public class BookstoreActivity extends BaseActivity { mBookTypes = findCrawler.getBookTypes(); initBooks(); } - } else if ((mBookTypes = findCrawler.getBookTypes()) != null){ + } else if ((mBookTypes = findCrawler.getBookTypes()) != null) { initBooks(); } else { BookStoreApi.getBookTypeList(findCrawler, new ResultCallback() { @Override public void onFinish(Object o, int code) { + if (MyApplication.isDestroy(BookstoreActivity.this)) return; mBookTypes = (ArrayList) o; initBooks(); } @Override public void onError(Exception e) { + if (MyApplication.isDestroy(BookstoreActivity.this)) return; e.printStackTrace(); mHandler.sendEmptyMessage(5); } @@ -259,7 +265,7 @@ public class BookstoreActivity extends BaseActivity { } } - private void initBooks(){ + private void initBooks() { curType = mBookTypes.get(0); mHandler.sendMessage(mHandler.obtainMessage(1)); page = 1; @@ -280,6 +286,7 @@ public class BookstoreActivity extends BaseActivity { ((QiDianMobileRank) findCrawler).getRankBooks(curType, new ResultCallback() { @Override public void onFinish(Object o, int code) { + if (MyApplication.isDestroy(BookstoreActivity.this)) return; List books = new ArrayList<>(); for (QDBook rb : (List) o) { Book book = new Book(); @@ -291,8 +298,7 @@ public class BookstoreActivity extends BaseActivity { book.setNewestChapterTitle(rb.getDesc()); book.setDesc(rb.getDesc()); if (rb instanceof RankBook) { - boolean hasRankCnt = !((RankBook) rb).getRankCnt().equals("null") && - MyApplication.isApkInDebug(BookstoreActivity.this); + boolean hasRankCnt = !((RankBook) rb).getRankCnt().equals("null"); book.setUpdateDate(hasRankCnt ? book.getType() + "-" + rb.getCnt() : rb.getCnt()); book.setNewestChapterId(hasRankCnt ? ((RankBook) rb).getRankCnt() : book.getType()); } else if (rb instanceof SortBook) { @@ -306,6 +312,7 @@ public class BookstoreActivity extends BaseActivity { @Override public void onError(Exception e) { + if (MyApplication.isDestroy(BookstoreActivity.this)) return; mHandler.sendMessage(mHandler.obtainMessage(4)); ToastUtils.showError("数据加载失败!\n" + e.getMessage()); e.printStackTrace(); @@ -315,11 +322,13 @@ public class BookstoreActivity extends BaseActivity { BookStoreApi.getBookRankList(curType, findCrawler, new ResultCallback() { @Override public void onFinish(Object o, int code) { + if (MyApplication.isDestroy(BookstoreActivity.this)) return; mHandler.sendMessage(mHandler.obtainMessage(2, o)); } @Override public void onError(Exception e) { + if (MyApplication.isDestroy(BookstoreActivity.this)) return; mHandler.sendMessage(mHandler.obtainMessage(4)); ToastUtils.showError("数据加载失败!\n" + e.getMessage()); e.printStackTrace(); diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/FeedbackActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/FeedbackActivity.java index 7f10561..589f4d8 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/FeedbackActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/FeedbackActivity.java @@ -13,6 +13,7 @@ import androidx.appcompat.widget.Toolbar; import butterknife.BindView; import xyz.fycz.myreader.R; +import xyz.fycz.myreader.application.MyApplication; import xyz.fycz.myreader.base.BaseActivity; import xyz.fycz.myreader.ui.dialog.DialogCreator; import xyz.fycz.myreader.widget.RefreshLayout; @@ -68,13 +69,14 @@ public class FeedbackActivity extends BaseActivity { @Override public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { super.onReceivedError(view, request, error); - mRlRefresh.showError(); + if (!MyApplication.isDestroy(FeedbackActivity.this)) + mRlRefresh.showError(); } }); wvFeedback.setWebChromeClient(new WebChromeClient(){ @Override public void onProgressChanged(WebView view, int newProgress) { - if (newProgress == 100){ + if (newProgress == 100 && !MyApplication.isDestroy(FeedbackActivity.this)){ mRlRefresh.showFinish(); } }}); diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java index 72e093a..6614b80 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java @@ -11,6 +11,7 @@ import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Message; +import android.os.PersistableBundle; import android.util.Log; import android.view.*; import android.view.animation.Animation; @@ -21,6 +22,8 @@ import android.widget.ProgressBar; import android.widget.SeekBar; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.core.content.ContextCompat; @@ -186,6 +189,10 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe private boolean hasChangeSource; + private int pagePos; + + private int chapterPos; + private Animation mTopInAnim; private Animation mTopOutAnim; private Animation mBottomInAnim; @@ -284,6 +291,27 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe } + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + if (savedInstanceState != null) { + pagePos = savedInstanceState.getInt("pagePos"); + chapterPos = savedInstanceState.getInt("chapterPos"); + }else { + pagePos = -1; + chapterPos = -1; + } + super.onCreate(savedInstanceState); + } + + @Override + protected void onSaveInstanceState(@NonNull Bundle outState) { + super.onSaveInstanceState(outState); + if (mBook != null) { + outState.putInt("pagePos", mBook.getLastReadPosition()); + outState.putInt("chapterPos", mBook.getHisttoryChapterNum()); + } + } + @Override protected void setUpToolbar(Toolbar toolbar) { super.setUpToolbar(toolbar); @@ -301,6 +329,10 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe finish(); return; } + if (pagePos != -1 && chapterPos != -1){ + mBook.setHisttoryChapterNum(chapterPos); + mBook.setLastReadPosition(pagePos); + } if (SharedPreUtils.getInstance().getBoolean(getString(R.string.isNightFS), false)) { mSetting.setDayStyle(!ColorUtil.isColorLight(getResources().getColor(R.color.textPrimary))); } @@ -794,11 +826,13 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe public void onDialogDismissed(int dialogId) { } + /**************************method*********************************/ /** * 初始化 */ private void init() { + if (MyApplication.isDestroy(this)) return; screenOffTimerStart(); mPageLoader.init(); mPageLoader.refreshChapterList(); diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QiDianMobileRank.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QiDianMobileRank.java index 12c64cc..380430c 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QiDianMobileRank.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QiDianMobileRank.java @@ -212,7 +212,7 @@ public class QiDianMobileRank extends FindCrawler { @Override public String getFindName() { - return !isFemale ? !isSort ? "排行榜[男生小说]" : "分类[男生小说]" : !isSort ? "排行榜[女生小说]" : "分类[女生小说]"; + return !isFemale ? !isSort ? "排行榜[起点中文网]" : "分类[起点中文网]" : !isSort ? "排行榜[起点女生网]" : "分类[起点女生网]"; } @Override diff --git a/app/src/main/java/xyz/fycz/myreader/widget/page/LocalPageLoader.java b/app/src/main/java/xyz/fycz/myreader/widget/page/LocalPageLoader.java index 535c42c..e7d4764 100644 --- a/app/src/main/java/xyz/fycz/myreader/widget/page/LocalPageLoader.java +++ b/app/src/main/java/xyz/fycz/myreader/widget/page/LocalPageLoader.java @@ -44,7 +44,9 @@ public class LocalPageLoader extends PageLoader { "^(\\s{0,4})([\\(\u3010\u300a]?(\u5377)?)([0-9\u96f6\u4e00\u4e8c\u4e24\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u767e\u5343\u4e07\u58f9\u8d30\u53c1\u8086\u4f0d\u9646\u67d2\u634c\u7396\u62fe\u4f70\u4edf]{1,10})([\\.:\uff1a\u0020\f\t])(.{0,30})$", "^(\\s{0,4})([\\(\uff08\u3010\u300a])(.{0,30})([\\)\uff09\u3011\u300b])(\\s{0,2})$", "^(\\s{0,4})(\u6b63\u6587)(.{0,20})$", - "^(.{0,4})(Chapter|chapter)(\\s{0,4})([0-9]{1,4})(.{0,30})$"}; + "^(.{0,4})(Chapter|chapter)(\\s{0,4})([0-9]{1,4})(.{0,30})$", + "^(\\s{0,4})(\\d{1,5}[::,.,、_—\\-])(.{1,30})$", + "^(\\s{0,4})(\u756a\u5916)(.{0,20})$"}; //章节解析模式 private Pattern mChapterPattern = null; @@ -70,6 +72,7 @@ public class LocalPageLoader extends PageLoader { */ private List loadChapters() throws IOException { mBookFile = new File(mCollBook.getChapterUrl()); + //获取文件编码 mCharset = FileUtils.getFileCharset(mBookFile); diff --git a/app/src/main/res/layout/layout_book_detail_content.xml b/app/src/main/res/layout/layout_book_detail_content.xml index 3641e9f..08f155a 100644 --- a/app/src/main/res/layout/layout_book_detail_content.xml +++ b/app/src/main/res/layout/layout_book_detail_content.xml @@ -53,7 +53,7 @@ android:gravity="right" android:padding="15dp" android:text="更多" - android:textColor="@color/textAssist" + android:textColor="@color/textSecondary" android:textSize="15sp" /> 99藏书·实体 100本·实体 - 男生小说 - 女生小说 + 起点中文网 + 起点女生网 朗读 diff --git a/app/version_code.properties b/app/version_code.properties index 1719206..74f27ed 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Thu Dec 24 22:07:42 CST 2020 +#Fri Jan 08 23:11:19 CST 2021 VERSION_CODE=177