From 5b87b2f167e12214c377b53a27f10f75395fc41b Mon Sep 17 00:00:00 2001 From: mwang <8205347@qq.com> Date: Sun, 16 Jun 2019 23:56:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AB=A0=E8=8A=82=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/novelbook/android/ReadActivity.java | 2 +- .../com/novelbook/android/utils/BookUtil.java | 20 +++++++++---------- .../novelbook/android/utils/PageFactory.java | 6 +++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/zhuike/src/main/java/com/novelbook/android/ReadActivity.java b/zhuike/src/main/java/com/novelbook/android/ReadActivity.java index b423101..217eb80 100644 --- a/zhuike/src/main/java/com/novelbook/android/ReadActivity.java +++ b/zhuike/src/main/java/com/novelbook/android/ReadActivity.java @@ -604,7 +604,7 @@ public class ReadActivity extends Activity_base implements AdInterface { } if(!pageFactory.canExitSilent()){ - if(book.isOnShelf()){ + if(book.isOnShelf() ||pageFactory.getChapters().size()>0){ finish(); }else { // showNormalDialog(); diff --git a/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java b/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java index 9c041a4..9f70ebd 100644 --- a/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java +++ b/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java @@ -496,7 +496,8 @@ public class BookUtil { chaptCache.clear(); fileRetryCnt.clear(); siteRuleRetryCnt=0; - caprint.clear(); + isChangeSource=false; + } public Site getSite() { @@ -582,7 +583,7 @@ public class BookUtil { int chId=chapId;//chapterNo; String title =""; - mChangeChapId = mChangeChapId >=1 ?mChangeChapId :1;//TODO: mChangeChapId 换源时不要变 + mChangeChapId = mChangeChapId >=1 ?mChangeChapId :1; if( mChapters.size() >= mChangeChapId && mChapters.get(mChangeChapId-1)!=null ){ title= mChapters.get(mChangeChapId-1).getChapterName(); Log.d(TAG, "changing Source:chapter name in new site " + title ); @@ -671,10 +672,10 @@ public class BookUtil { chapTitle = params[2]; int splet =0; - while(isChangeSource && splet <200){ + while(isChangeSource && splet caprint = new ArrayList(); - //获取chapter 缓存 public char[] chaptChars(final int index) { // Log.d(TAG, String.format("prepare book begin to load content for chapter %s ------------------------------------------------------------------------->", index)); @@ -1489,10 +1488,6 @@ int muluRetryCount =0; block = chaptCache .get(index).getData().get(); // Log.d(TAG, String.format("chaptChars get block in cache, chapter: %s", index)); - if(!caprint.contains(index)) { - caprint.add(index); - // Log.d(TAG, String.format("chaptChars: load from cache chaptId %s,--->%s", index, new String(block))); - } } // Log.d(TAG, String.format("prepare book begin to load content for chapter %s", index)); if (block == null) { @@ -1873,5 +1868,10 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte return (line.length() <= 30 && (line.matches(".*第.{1,8}章.*") || line.matches(".*第.{1,8}节.*"))) ; } +void clear(){ + clearBook(); + mContext=null; + this.pagefactory =null; } +} diff --git a/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java b/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java index 99acff7..c8c924a 100644 --- a/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java +++ b/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java @@ -317,7 +317,7 @@ public class PageFactory implements ChangeSource{ if(!getNovel().isLocalBook()) { mStatus = Status.OPENING; - final int maxSleep = Constants.MAX_SLEEP_4_CHAPT_DOWNLOAD; + final int maxSleep = Constants.MAX_SLEEP_4_CHAPT_DOWNLOAD+1000; // final File file = new File(getChapterFileName(chaptId)); @@ -1478,6 +1478,10 @@ private void hideSysUI(){ } } + if(mBookUtil!=null){ + mBookUtil. clear(); + mBookUtil=null; + } mBookUtil = new BookUtil(); mBookUtil.pagefactory=this; //this.mBookUtil.setContext(context);