调整章节读取等待时间
This commit is contained in:
parent
e5581f9028
commit
c9059c7910
|
@ -6,8 +6,6 @@
|
|||
</shared>
|
||||
</component>
|
||||
<component name="AndroidLogFilters">
|
||||
<option name="TOOL_WINDOW_CUSTOM_FILTER" value="HttpMethods" />
|
||||
<option name="TOOL_WINDOW_LOG_LEVEL" value="debug" />
|
||||
<option name="TOOL_WINDOW_CONFIGURED_FILTER" value="Show only selected application" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
|
@ -201,7 +199,6 @@
|
|||
<session id="2023648885">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="1" />
|
||||
<entry key="project.open.time.0" value="1" />
|
||||
<entry key="project.opened" value="1" />
|
||||
</counts>
|
||||
|
@ -237,8 +234,8 @@
|
|||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/build.gradle">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="70">
|
||||
<caret line="13" column="30" lean-forward="true" selection-start-line="13" selection-start-column="30" selection-end-line="13" selection-end-column="30" />
|
||||
<state relative-caret-position="304">
|
||||
<caret line="16" column="44" selection-start-line="16" selection-start-column="44" selection-end-line="16" selection-end-column="44" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -397,8 +394,9 @@
|
|||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="1358" y="-8" width="1936" height="1096" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info content_ui="combo" id="Project" visible="true" weight="0.27665246" />
|
||||
<window_info active="true" content_ui="combo" id="Project" visible="true" weight="0.27665246" />
|
||||
<window_info id="Structure" side_tool="true" />
|
||||
<window_info id="Build Variants" side_tool="true" />
|
||||
<window_info id="Image Layers" />
|
||||
|
@ -407,14 +405,14 @@
|
|||
<window_info id="Favorites" side_tool="true" />
|
||||
<window_info id="Captures" order="0" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Run" weight="0.32952183" />
|
||||
<window_info active="true" anchor="bottom" id="Logcat" visible="true" weight="0.45738044" />
|
||||
<window_info anchor="bottom" id="Logcat" weight="0.32952183" />
|
||||
<window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="TODO" />
|
||||
<window_info anchor="bottom" id="Android Profiler" />
|
||||
<window_info anchor="bottom" id="Debug" />
|
||||
<window_info anchor="bottom" id="Terminal" />
|
||||
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Build" weight="0.7172557" />
|
||||
<window_info anchor="bottom" id="Build" visible="true" weight="0.27338877" />
|
||||
<window_info anchor="right" id="Device File Explorer" side_tool="true" />
|
||||
<window_info anchor="right" id="Capture Analysis" />
|
||||
<window_info anchor="right" id="Gradle" />
|
||||
|
@ -439,8 +437,8 @@
|
|||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/build.gradle">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="70">
|
||||
<caret line="13" column="30" lean-forward="true" selection-start-line="13" selection-start-column="30" selection-end-line="13" selection-end-column="30" />
|
||||
<state relative-caret-position="304">
|
||||
<caret line="16" column="44" selection-start-line="16" selection-start-column="44" selection-end-line="16" selection-end-column="44" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
|
|
@ -38,7 +38,7 @@ android {
|
|||
debug {
|
||||
// 显示Log
|
||||
buildConfigField "boolean", "LOG_DEBUG", "true"
|
||||
buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"'
|
||||
buildConfigField "String", "MAIN_HOST", '"http://dg.xiaoshuofenxiang.com/api/"'
|
||||
// buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/dg.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/d.p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\//d.r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\//d.s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\//d.n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\//d.nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\//d.u.xiaoshuofenxiang.com\\"]}"'
|
||||
buildConfigField "String", "API_HOST", '""'
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1517,12 +1517,14 @@ int muluRetryCount =0;
|
|||
getSiteRule();
|
||||
}
|
||||
}
|
||||
int slept = 0;
|
||||
while (NetUtil.isNetworkConnected() && slept < 50 &&(mMuluStatus ==null || mMuluStatus == MuluStatus.isDownloading)) {
|
||||
int maxSleep = Constants.MAX_SLEEP_4_CHAPT_DOWNLOAD;
|
||||
int slepttime = 0;
|
||||
|
||||
while (NetUtil.isNetworkConnected() && slepttime < maxSleep &&(mMuluStatus ==null || mMuluStatus == MuluStatus.isDownloading)) {
|
||||
try {
|
||||
Thread.sleep(50);
|
||||
slept++;
|
||||
Log.d(TAG, String.format("prepare book loadChapts----等待中 %s 目录, 目录数量 %s, slept %s, MuluStatus %s", mNovel.getName(), mChapters.size(), slept, mMuluStatus));
|
||||
slepttime+=50;
|
||||
Log.d(TAG, String.format("prepare book loadChapts----等待中 %s 目录, 目录数量 %s, slept %s, MuluStatus %s", mNovel.getName(), mChapters.size(), slepttime, mMuluStatus));
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -1530,7 +1532,7 @@ int muluRetryCount =0;
|
|||
}
|
||||
|
||||
if (!NetUtil.isNetworkConnected() || muluRetryCount >= Constants.retryCnt && (mChapters == null || mChapters.size() == 0)) {
|
||||
Log.d(TAG, String.format("prepare book loadChapts----超时。。。或出错了 %s 目录, 目录数量 %s, slept %s, MuluStatus %s,thread %s", mNovel.getName(), mChapters.size(), slept, mMuluStatus, Thread.currentThread().getName()));
|
||||
Log.d(TAG, String.format("prepare book loadChapts----超时。。。或出错了 %s 目录, 目录数量 %s, slept %s, MuluStatus %s,thread %s", mNovel.getName(), mChapters.size(), slepttime, mMuluStatus, Thread.currentThread().getName()));
|
||||
String error = "网络不给力";
|
||||
return error.toCharArray();
|
||||
}
|
||||
|
@ -1550,8 +1552,8 @@ int muluRetryCount =0;
|
|||
index, chaptDownStatus.get(Integer.valueOf(index)), Thread.currentThread().getName()));
|
||||
|
||||
|
||||
int maxSleep = 10000;
|
||||
int slepttime = 0;
|
||||
|
||||
slepttime = 0;
|
||||
// while(!file.exists() && !getDownloadStatus()){//&& slepttime <maxSleep){
|
||||
// while( !getDownloadStatus() && slepttime <maxSleep){
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ public class Constants {
|
|||
public static final String BAD_CHAR =" ";//not blank,don't edit
|
||||
|
||||
public final static int MAX_PAGE_CNT =10;//最多加载的页数
|
||||
public final static int MAX_SLEEP_4_CHAPT_DOWNLOAD =10000;//最多等待时间10s
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -317,6 +317,7 @@ public class PageFactory implements ChangeSource{
|
|||
if(!getNovel().isLocalBook()) {
|
||||
|
||||
mStatus = Status.OPENING;
|
||||
final int maxSleep = Constants.MAX_SLEEP_4_CHAPT_DOWNLOAD;
|
||||
|
||||
// final File file = new File(getChapterFileName(chaptId));
|
||||
|
||||
|
@ -376,10 +377,10 @@ public class PageFactory implements ChangeSource{
|
|||
public void run() {
|
||||
int slepttime =0;
|
||||
File file = new File(getChapterFileName(chid));
|
||||
while( !file.exists() && slepttime <60 && mBookUtil.muluRetryCount<Constants.retryCnt ||showingStatusAd &&(new Date().getTime() - showStatusAdTime <2200) ){
|
||||
while( !file.exists() && slepttime <maxSleep && mBookUtil.muluRetryCount<Constants.retryCnt ||showingStatusAd &&(new Date().getTime() - showStatusAdTime <2200) ){
|
||||
try {
|
||||
sleep(50);
|
||||
slepttime++;
|
||||
slepttime+=50;
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -933,7 +934,7 @@ private void hideSysUI(){
|
|||
}
|
||||
|
||||
if (mStatus==Status.OPENING ) {
|
||||
String url = mBookUtil.getChapter(currentChapter).getChapterUrl();
|
||||
String url = mBookUtil.getChapter(getNovel().getLastReadChapt()).getChapterUrl();
|
||||
if(!TextUtils.isEmpty(url)) {
|
||||
if(url.length()>100)
|
||||
url =url.substring(0,100);
|
||||
|
@ -955,7 +956,7 @@ private void hideSysUI(){
|
|||
if(Constants.SHOW_NOVEL_CHAPTER_URL) {
|
||||
c.drawText(url, targetRect.centerX(), baseline, waitPaint);
|
||||
}
|
||||
String chaptName= mBookUtil.getChapter(currentChapter).getChapterName();
|
||||
String chaptName= mBookUtil.getChapter(getNovel().getLastReadChapt()).getChapterName();
|
||||
if(!TextUtils.isEmpty(chaptName)) {
|
||||
if(chaptName.length()>100)
|
||||
chaptName =chaptName.substring(0,100);
|
||||
|
@ -1377,7 +1378,7 @@ private void hideSysUI(){
|
|||
@Override
|
||||
public void run() {
|
||||
int slepttime = 0; mBookUtil.muluRetryCount=0;
|
||||
while (slepttime<80 && mBookUtil.getChapters().size()==0 && (mBookUtil.mMuluStatus == BookUtil.MuluStatus.isDownloading || mBookUtil.muluRetryCount < Constants.retryCnt)) {
|
||||
while (slepttime<200 && mBookUtil.getChapters().size()==0 && (mBookUtil.mMuluStatus == BookUtil.MuluStatus.isDownloading || mBookUtil.muluRetryCount < Constants.retryCnt)) {
|
||||
try {
|
||||
sleep(50);
|
||||
slepttime++;
|
||||
|
@ -1387,8 +1388,8 @@ private void hideSysUI(){
|
|||
}
|
||||
}
|
||||
|
||||
Log.d(TAG, String.format("prepare book waiting for chapters slept %s, chapt size %s, MuluStatus %s, muluRetryCount %s " ,
|
||||
slepttime *50,mBookUtil.getChapters().size(),mBookUtil.mMuluStatus,mBookUtil.muluRetryCount));
|
||||
Log.d(TAG, String.format("prepare book waiting for chapters slept %s, chapt size %s, MuluStatus %s, muluRetryCount %s ,mStatus %s" ,
|
||||
slepttime *50,mBookUtil.getChapters().size(),mBookUtil.mMuluStatus,mBookUtil.muluRetryCount,mStatus));
|
||||
|
||||
if(mBookUtil.getChapters().size()>0){
|
||||
if( mBookUtil.getChapterNo() == mBookUtil.getChapters().size()+1){
|
||||
|
@ -1396,7 +1397,7 @@ private void hideSysUI(){
|
|||
}
|
||||
currentChapter=mBookUtil.getChapterNo();
|
||||
handler.sendEmptyMessage(MSG_NEXTPAGE) ;
|
||||
}else{
|
||||
}else if(mStatus !=Status.OPENING){
|
||||
handler.sendEmptyMessage(MSG_NEXTPAGE_FAIL) ;
|
||||
}
|
||||
|
||||
|
@ -1412,8 +1413,8 @@ private void hideSysUI(){
|
|||
drawStatus();
|
||||
// currentPage(false);
|
||||
return;
|
||||
} else {
|
||||
|
||||
} else if(mBookUtil.getChapters().size()==0){
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Log.d(TAG, "prepare book nextPage: to open next page: ");
|
||||
|
@ -1518,7 +1519,7 @@ private void hideSysUI(){
|
|||
bookName =book.getName();// FileUtils.getFileName(bookPath);
|
||||
// this.mCurrentChapter = chapter;
|
||||
mStatus = Status.OPENING;
|
||||
drawStatus();
|
||||
|
||||
|
||||
|
||||
if (bookTask != null && bookTask.getStatus() != AsyncTask.Status.FINISHED){
|
||||
|
@ -1528,6 +1529,8 @@ private void hideSysUI(){
|
|||
bookTask = new BookTask();
|
||||
Log.d(TAG, String.format("prepare book 1 to open chapter %s ,position %s,source %s",book.getLastReadChapt() ,book.getLastReadPos(),book.getDomain()+book.getDomainName() ) );
|
||||
bookTask.execute((long)book.getLastReadChapt(),book .getLastReadPos());
|
||||
|
||||
drawStatus();
|
||||
}
|
||||
|
||||
private class BookTask extends AsyncTask<Long,Void,Boolean>{
|
||||
|
|
|
@ -103,6 +103,8 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_split_apk_resources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/legacy_multidex_aapt_derived_proguard_rules" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/legacy_multidex_main_dex_list" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
|
||||
|
|
Loading…
Reference in New Issue