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);