diff --git a/zhuike/src/main/java/com/novelbook/android/ActivitySetup.java b/zhuike/src/main/java/com/novelbook/android/ActivitySetup.java index 1e254cf..b229e69 100644 --- a/zhuike/src/main/java/com/novelbook/android/ActivitySetup.java +++ b/zhuike/src/main/java/com/novelbook/android/ActivitySetup.java @@ -9,12 +9,16 @@ import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.LinearLayout; +import android.widget.RadioButton; +import android.widget.RadioGroup; import android.widget.TextView; +import com.novelbook.android.AD.toutiao.TTAdManagerHolder; import com.novelbook.android.db.DownloadTask; import com.novelbook.android.netutils.NetUtil; import com.novelbook.android.service.ServiceDownload; import com.novelbook.android.utils.CommonUtil; +import com.novelbook.android.utils.Config; import com.novelbook.android.utils.Constants; import com.novelbook.android.utils.FileUtils; import com.novelbook.android.utils.Fileutil; @@ -32,11 +36,12 @@ static final String TAG = ActivitySetup.class.getSimpleName(); TextView tvCache; @BindView(R.id.tvVersion) TextView tvVersion; - + @BindView(R.id.rgShelfOrder) + RadioGroup rgShelfOrder; String mVersion =""; String mCacheSize =""; - + private Config config ; @Override public int getLayoutRes() { return R.layout.activity_setup; @@ -44,6 +49,8 @@ static final String TAG = ActivitySetup.class.getSimpleName(); @Override protected void initViews() { + config =Config.getInstance(); + initialShelfOrderOption(); new Thread() { @Override public void run() { @@ -80,7 +87,7 @@ static final String TAG = ActivitySetup.class.getSimpleName(); } - @OnClick({R.id.llAnouncement,R.id.llCache,R.id.llVersion}) + @OnClick({R.id.llAnouncement,R.id.llCache,R.id.llVersion,R.id.radioButton1,R.id.radioButton2,R.id.radioButton3}) void onSetupclick(View view){ switch (view.getId()) { @@ -160,20 +167,52 @@ static final String TAG = ActivitySetup.class.getSimpleName(); } }.start(); + break; - - - - - + case R.id.radioButton1: + setShelfOrder(); + break; + case R.id.radioButton2: + setShelfOrder(); + break; + case R.id.radioButton3: + setShelfOrder(); break; } + } + + private void setShelfOrder() { + int s = 1; + + switch (rgShelfOrder.getCheckedRadioButtonId()){ + case R.id.radioButton1: + s=1; + break; + case R.id.radioButton2: + s=2; + break; + case R.id.radioButton3: + s=3; + break; + } + + Log.d(TAG, "setSexOption: new sex option:" +s); + if(s!= Constants.SHELF_ORDER) { + Constants.SHELF_ORDER = s; + config.setShelfOrderOption(s); + } + } + void initialShelfOrderOption(){ - + Constants.SHELF_ORDER = config.getShelfOrderOption(); + rgShelfOrder.clearCheck(); + ((RadioButton) rgShelfOrder.getChildAt(Constants.SHELF_ORDER-1)).setChecked(true); } + + } diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_Shelf.java b/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_Shelf.java index 501deb6..e6359d1 100644 --- a/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_Shelf.java +++ b/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_Shelf.java @@ -23,6 +23,8 @@ import android.widget.CompoundButton; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; +import android.widget.RadioButton; +import android.widget.RadioGroup; import android.widget.TextView; import android.widget.Toast; @@ -43,6 +45,7 @@ import com.novelbook.android.netutils.NetUtil; import com.novelbook.android.netutils.OnSuccessAndFaultListener; import com.novelbook.android.netutils.OnSuccessAndFaultSub; import com.novelbook.android.utils.CommonUtil; +import com.novelbook.android.utils.Config; import com.novelbook.android.utils.Constants; import com.novelbook.android.utils.FileUtils; import com.novelbook.android.utils.Fileutil; @@ -92,6 +95,7 @@ public class Fragment_Shelf extends BasicFragment { @BindView(R.id.banner_container) FrameLayout mBannerContainer; + private Config config ; public Fragment_Shelf() { // Required empty public constructor } @@ -123,7 +127,7 @@ public class Fragment_Shelf extends BasicFragment { int i=0; for (Novel novel : bookLists) { if (novel.isFinished() || novel.isLocalBook() || novel.isUpdated() && (new Date().getTime() - novel.getLastVisit() > 1*3600*1000 ) ) { - // if(!novel.getName().equals("暗月纪元")) + //if(!novel.getName().equals("剑来")) continue; } if(i>Constants.MAX_SHELF_CNT){ @@ -366,9 +370,68 @@ public class Fragment_Shelf extends BasicFragment { } }); + if(config==null){ + config =Config.getInstance(); + } + + RadioGroup rgShelfOrder = bottomSheetDialog.findViewById(R.id.rgShelfOrder); + Constants.SHELF_ORDER = config.getShelfOrderOption(); + rgShelfOrder.clearCheck(); + ((RadioButton) rgShelfOrder.getChildAt(Constants.SHELF_ORDER-1)).setChecked(true); + + + + RadioButton radioButton1 = bottomSheetDialog.findViewById(R.id.radioButton1); + RadioButton radioButton2 = bottomSheetDialog.findViewById(R.id.radioButton2); + RadioButton radioButton3 = bottomSheetDialog.findViewById(R.id.radioButton3); + RadioButton radioButton4 = bottomSheetDialog.findViewById(R.id.radioButton4); + radioButton1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + setShelfOrder(1); + } + }); + + radioButton2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + setShelfOrder(2); + } + }); + radioButton3.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + setShelfOrder(3); + } + }); + + radioButton4.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + setShelfOrder(4); + } + }); + bottomSheetDialog.show(); + + + + + } + private void setShelfOrder(int option) { + + Log.d(TAG, "setShelfOrder: new sex option:" +option); + if(option!= Constants.SHELF_ORDER) { + Constants.SHELF_ORDER = option; + config.setShelfOrderOption(option); + getUpdatedData(); + } + } + + + @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { diff --git a/zhuike/src/main/java/com/novelbook/android/MyApp.java b/zhuike/src/main/java/com/novelbook/android/MyApp.java index 1429f6b..a1eb802 100644 --- a/zhuike/src/main/java/com/novelbook/android/MyApp.java +++ b/zhuike/src/main/java/com/novelbook/android/MyApp.java @@ -51,6 +51,7 @@ public class MyApp extends Application { private void initialConstants(){ Config config= Config.createConfig(this); Constants.SEX = config.getSexOption(); + Constants.SHELF_ORDER = config.getShelfOrderOption(); Constants.PRE_LOAD_CHAPT =config.isPreLoadChapter(); Gson gson = new Gson(); Constants.AD_SETTING = gson.fromJson(config.getAdSetting(), AdSetting.class); diff --git a/zhuike/src/main/java/com/novelbook/android/ReadActivity.java b/zhuike/src/main/java/com/novelbook/android/ReadActivity.java index 9cc954f..0b51644 100644 --- a/zhuike/src/main/java/com/novelbook/android/ReadActivity.java +++ b/zhuike/src/main/java/com/novelbook/android/ReadActivity.java @@ -996,14 +996,17 @@ public class ReadActivity extends Activity_base implements AdInterface { /* tvUrl.setVisibility(View.VISIBLE); tvUrl.setText("abcd+" + pageFactory.getChapter().getChapterUrl());*/ - if(Constants.SHOW_NOVEL_CHAPTER_URL) { - if(pageFactory.getChapter()!=null && !TextUtils.isEmpty(pageFactory.getChapter().getChapterUrl())) { - tvUrl.setVisibility(View.VISIBLE); - tvUrl.setText(pageFactory.getChapter().getChapterUrl()); - } + showChaptUrl(); + + + } + } + void showChaptUrl(){ + if(Constants.SHOW_NOVEL_CHAPTER_URL) { + if(pageFactory.getChapter()!=null && !TextUtils.isEmpty(pageFactory.getChapter().getChapterUrl())) { + tvUrl.setVisibility(View.VISIBLE); + tvUrl.setText(pageFactory.getChapter().getChapterUrl()); } - - } } /** @@ -1114,12 +1117,15 @@ public class ReadActivity extends Activity_base implements AdInterface { case R.id.rl_progress: break; case R.id.tv_pre: + showChaptUrl(); pageFactory.preChapter(); break; case R.id.sb_progress: break; case R.id.tv_next: + showChaptUrl(); pageFactory.nextChapter(); + break; case R.id.tv_directory: Intent intent = new Intent(ReadActivity.this, MarkActivity.class); diff --git a/zhuike/src/main/java/com/novelbook/android/bean/AdSetting.java b/zhuike/src/main/java/com/novelbook/android/bean/AdSetting.java index da3d777..28de458 100644 --- a/zhuike/src/main/java/com/novelbook/android/bean/AdSetting.java +++ b/zhuike/src/main/java/com/novelbook/android/bean/AdSetting.java @@ -16,8 +16,8 @@ public class AdSetting { private slot fixBanner = new slot(); private slot bigBanner = new slot(); public boolean isShowAdsense() { - // return true; - return showAdsense && NetUtil.isNetworkConnected(); + return false; + // return showAdsense && NetUtil.isNetworkConnected(); } public void setShowAdsense(boolean showAdsense) { diff --git a/zhuike/src/main/java/com/novelbook/android/db/Novel.java b/zhuike/src/main/java/com/novelbook/android/db/Novel.java index 1218733..ca970ee 100644 --- a/zhuike/src/main/java/com/novelbook/android/db/Novel.java +++ b/zhuike/src/main/java/com/novelbook/android/db/Novel.java @@ -275,7 +275,24 @@ public class Novel extends LitePalSupport implements Serializable{ public static List getNovelsOnShelf(){ // return LitePal.where("isOnShelf=?","1").order("isTop desc,isUpdated desc,lastVisit desc,lastUpdateTime desc" ).find(Novel.class); - return LitePal.where("isOnShelf=?","1").order("isTop desc,lastUpdateTime desc" ).find(Novel.class); + String order = "isTop desc,lastUpdateTime desc"; + switch (Constants.SHELF_ORDER){ + case 1://更新时间 + order = "isTop desc,lastUpdateTime desc"; + break; + case 2: //最近阅读 + order = "isTop desc,lastVisit desc"; + break; + case 3: //有更新 + 最近阅读 + 更新时间 + order = " isTop desc,isUpdated desc"; + break; + case 4: //有更新 + 最近阅读 + 更新时间 + order = " isTop desc,isUpdated desc,lastVisit desc,lastUpdateTime desc"; + break; + } + + + return LitePal.where("isOnShelf=?","1").order(order ).find(Novel.class); } @@ -347,21 +364,21 @@ public void testUpdate(){ ) ); - boolean isLastReadchaptUpdated = TextUtils.isEmpty(nv.lastReadChaptName) || !(chapterName.equals(nv.lastReadChaptName)); //没看过最新章节 - boolean isLastChaptUpdated = !TextUtils.isEmpty(chapterName) && !TextUtils.isEmpty(nv.chapterName) && !(chapterName.equals(nv.chapterName)); - Log.d("Novel", String.format( " server lastUpdateTime ,server chaptername %s,chaptername %s,lastreadchapt %s" , chapterName,nv.chapterName,nv.lastReadChaptName ) ); + boolean isLastChaptNotRead = TextUtils.isEmpty(nv.lastReadChaptName) || !( !TextUtils.isEmpty(chapterName) && (chapterName.trim()).equals(nv.lastReadChaptName.trim())); //没看过最新章节 + boolean isLastChaptUpdated = !TextUtils.isEmpty(chapterName) && !TextUtils.isEmpty(nv.chapterName) && !(chapterName.trim().equals(nv.chapterName.trim())); + Log.d("Novel", String.format( " server lastUpdateTime ,server chaptername '%s',chaptername %s,lastreadchapt '%s'" , chapterName,nv.chapterName,nv.lastReadChaptName ) ); /* isUpdated = isUpdated && isLastReadchaptUpdated || isLastChaptUpdated ; boolean isLastChaptUpdated = !TextUtils.isEmpty(chapterName) && !TextUtils.isEmpty(nv.chapterName) && !(chapterName.equals(nv.chapterName)); */ - Log.d("Novel", String.format( " isupdated %s, server lastUpdateTime isLastReadchaptUpdated %s,isLastChaptUpdated %s" ,isUpdated,isLastReadchaptUpdated,isLastChaptUpdated ) ); + Log.d("Novel", String.format( " is updated %s, server lastUpdateTime isLastChaptNotRead %s,isLastChaptUpdated %s" ,isUpdated,isLastChaptNotRead,isLastChaptUpdated ) ); - Log.d("Novel", String.format( " server lastUpdateTime ,server chaptername %s,chaptername %s,lastreadchapt %s" , chapterName,nv.chapterName,nv.lastReadChaptName ) ); + // Log.d("Novel", String.format( " server lastUpdateTime ,server chaptername '%s',chaptername '%s',lastreadchapt '%s'" , chapterName,nv.chapterName,nv.lastReadChaptName ) ); isUpdated = isUpdated && isLastChaptUpdated || lastUpdateTime > nv.lastVisit; - isUpdated = isUpdated && isLastReadchaptUpdated; + isUpdated = isUpdated && isLastChaptNotRead; diff --git a/zhuike/src/main/java/com/novelbook/android/netutils/HttpMethods.java b/zhuike/src/main/java/com/novelbook/android/netutils/HttpMethods.java index 273eddc..ce091ba 100644 --- a/zhuike/src/main/java/com/novelbook/android/netutils/HttpMethods.java +++ b/zhuike/src/main/java/com/novelbook/android/netutils/HttpMethods.java @@ -52,9 +52,9 @@ public class HttpMethods { public String TAG = "HttpMethods"; public static final String CACHE_NAME = "ZHUIKE"; //public static String BASE_URL = getBaseUrl(); - private static final int DEFAULT_CONNECT_TIMEOUT = 5; - private static final int DEFAULT_WRITE_TIMEOUT = 5; - private static final int DEFAULT_READ_TIMEOUT = 5; + private static final int DEFAULT_CONNECT_TIMEOUT = 10; + private static final int DEFAULT_WRITE_TIMEOUT = 10; + private static final int DEFAULT_READ_TIMEOUT = 10; public static String USERAGENT=""; public static String LOCALUSERAGENT=""; private Retrofit retrofit; @@ -62,7 +62,7 @@ public class HttpMethods { /** * 请求失败重连次数 */ - private int RETRY_COUNT = 0; + private int RETRY_COUNT = 3; private OkHttpClient.Builder okHttpBuilder; private OkHttpClient okHttpClient; //构造方法私有 @@ -222,7 +222,7 @@ public class HttpMethods { }); - loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); + loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BASIC); //设置 Debug Log 模式 okHttpBuilder.addInterceptor(loggingInterceptor); // okHttpBuilder.addInterceptor(new RetryInterceptor()); 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 17a7a68..f785bc4 100644 --- a/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java +++ b/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java @@ -1030,7 +1030,7 @@ int muluRetryCount =0; } void buildChapters( String content ,String url){ - Log.d(TAG, "buildChapters: " +content); + // Log.d(TAG, "buildChapters: " +content); if(mSite==null ||mSiteRule ==null){ Log.d(TAG,String.format("prepare book buildChapters failed---- %s ,mSite is null? %s ,mSiteRule ==null ? %s", mNovel.getName() ,mSite==null,mSiteRule ==null )); return; @@ -1658,9 +1658,9 @@ int muluRetryCount =0; slepttime += 50; Log.d(TAG, String.format(" prepare book loadChaptContent slept %s for downloading,isDownload %s ,thread %s ", slepttime, getDownloadStatus(), Thread.currentThread().getName())); }*/ - while (!file.exists() && NetUtil.isNetworkConnected() && chaptDownStatus.get(Integer.valueOf(index)) == DownloadStatus.downloading && slepttime < maxSleep) { - Thread.sleep(50); - slepttime += 50; + while (!file.exists() && NetUtil.isNetworkConnected() && chaptDownStatus.get(Integer.valueOf(index)) == DownloadStatus.downloading && slepttime < maxSleep ) { + Thread.sleep(500); + slepttime += 500; Log.d(TAG, String.format(" prepare book loadChaptContent %s , slept %s for downloading, thread %s ",index, slepttime, Thread.currentThread().getName())); } Log.d(TAG, String.format("prepare book loadChaptContent slept %s for downloading ", slepttime)); @@ -1833,15 +1833,112 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte Request request = getTagRequest(url, refUrl,-1); + /*try { + Response response = HttpMethods.getOkClient().newCall(request).execute(); + Log.d( TAG,String.format("prepare book loadChaptContent get response, thread %s", Thread.currentThread().getName())); + ResponseBody body = response.body(); + if (body != null ) { + if(response.code()!=200){ + Log.d(TAG, "prepare book loadChaptContent----network failure returnCode " + response.code()); + // setDownloadFlag(true); + chaptDownStatus.put(index,DownloadStatus.failure); + Log.d( TAG,String.format("prepare book loadChaptContent error %s ,isDownloadChapt: %s", response.code(),false)); + handler.sendEmptyMessage(1); + return; + } + + try { + + if(mSiteRule==null){ + return; + } + *//* Charset charset = body.contentType().charset(); + if(charset!=null){ + String name = charset.displayName(); + }*//* + // String bodyStr = body.string(); + // bodyStr =NovelParseUtil.enconding(bodyStr,mSiteRule.getEncoding()); + + // Log.d( TAG,String.format("prepare book content %s", body )); + + + String bodyStr =NovelParseUtil.enconding(body,mSiteRule.getEncoding()); + if(TextUtils.isEmpty(bodyStr)){ + Log.e( TAG,String.format("prepare book loadChaptContent %s isEmpty,retry....", index, Thread.currentThread().getName())); + chaptDownStatus.put(index,DownloadStatus.failure); + return; + } + // Log.d( TAG,String.format("prepare book encoded content %s", bodyStr )); + bodyStr = NovelParseUtil.getChapterContent(bodyStr, siteJson); + *//* if(BuildConfig.LOG_DEBUG) { + reportMsg(Constants.REPORT_REX_CHAPTER_CONTENT_ERROR, url,"",getRequestHeader(request),200+"");//TODO: remove + }*//* + if(TextUtils.isEmpty(bodyStr) || bodyStr.trim().length()<10 ){ + Log.e( TAG,String.format("prepare book loadChaptContent %s isEmpty,reporting empty ....", index )); + + reportMsg(Constants.REPORT_REX_CHAPTER_CONTENT_ERROR, url,bodyStr,getRequestHeader(request),200+""); + chaptDownStatus.put(index,DownloadStatus.failure); + // bodyStr += Constants.BAD_CHAR +Constants.BAD_CHAR +"内容正在搜索中,请稍后刷新内容"; + return; + } + + String title = chapter.getChapterName(); + String chapterContent = title+ "\n" + bodyStr; + char[] buf = chapterContent.toCharArray(); + File file = new File(fileChapterName(index)); + file.createNewFile(); + + final OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(fileChapterName(index)), charachterType);//"UTF-16LE"); // UTF-16LE 比 utf-8 文件小 + // final OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(fileChapterName(index)), mSiteRule.getEncoding() );//charachterType);//"UTF-16LE"); // UTF-16LE 比 utf-8 文件小 + writer.write(buf); + writer.close(); + Log.d( TAG,String.format("prepare book loadChaptContent file created: %s, thread %s", file.getPath(), Thread.currentThread().getName())); + handler.sendEmptyMessage(MSG_FILLCONTENTDONE); + // setDownloadFlag(true); + } catch (IOException | JSONException e) { + e.printStackTrace(); + Log.e(TAG, "onResponse: prepare book error ",e ); + chaptDownStatus.put(index,DownloadStatus.failure); + return; + // throw new RuntimeException("Error during writing " + fileChapterName( index)); + } + finally { + body.close(); + + handler.sendEmptyMessage(MSG_FILLCONTENTDONE); + // setDownloadFlag(true); + } + chapter.setNovelId(mNovel.getId()); + chapter.setChapterPath(fileChapterName(index)); + chapter.setDomain(mSite.getDomain()); + if(chapter.getId()>0) { + chapter.update(chapter.getId()); + }else{ + chapter.save(); + } + //setDownloadFlag(true); + chaptDownStatus.put(index,DownloadStatus.success); + Log.d(TAG,String.format(" prepare book loadChaptContent---- finished download %s, cost time %s ,content path %s ,thread %s", chapter.getChapterName(), new Date().getTime() -startTime ,chapter.getChapterPath() , Thread.currentThread().getName() )); + + } + + } catch (IOException e) { + + Log.e(TAG, "onResponse: prepare book error ",e ); + }*/ HttpMethods.getOkClient().newCall(request).enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { - /* if(e.toString().contains("closed") ||e.getMessage().contains("Canceled")) + if(e!=null && + (e.toString().contains("closed") + ||e.getMessage().contains("Canceled"))) { - // return; - }*/ + Log.d(TAG, "onFailure: prepare book cancled request ,return, " + request.url()); + return; + + } // handler.sendEmptyMessage(MSG_FILLCONTENTDONE); // handler.sendEmptyMessage(1); @@ -1849,16 +1946,17 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte chaptDownStatus.put(index,DownloadStatus.failure); // setDownloadFlag(true); - Log.d( TAG,String.format("prepare book loadChaptContent %s fail, isDownloadChapt: %s",index,false)); + Log.e( TAG,String.format("prepare book loadChaptContent %s fail, isDownloadChapt: %s",index,false),e); // e.printStackTrace(); // throw new RuntimeException("Error during writing " + fileChapterName( index)); } @Override public void onResponse(Call call, Response response){ - + Log.d( TAG,String.format("prepare book loadChaptContent get response, thread %s", Thread.currentThread().getName())); ResponseBody body = response.body(); if (body != null ) { + if(response.code()!=200){ Log.d(TAG, "prepare book loadChaptContent----network failure returnCode " + response.code()); // setDownloadFlag(true); @@ -1873,10 +1971,10 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte if(mSiteRule==null){ return; } - /* Charset charset = body.contentType().charset(); + Charset charset = body.contentType().charset(); if(charset!=null){ String name = charset.displayName(); - }*/ + } // String bodyStr = body.string(); // bodyStr =NovelParseUtil.enconding(bodyStr,mSiteRule.getEncoding()); @@ -1885,7 +1983,7 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte String bodyStr =NovelParseUtil.enconding(body,mSiteRule.getEncoding()); if(TextUtils.isEmpty(bodyStr)){ - Log.d( TAG,String.format("prepare book loadChaptContent %s isEmpty,retry....", index, Thread.currentThread().getName())); + Log.e( TAG,String.format("prepare book loadChaptContent %s isEmpty,retry....", index, Thread.currentThread().getName())); chaptDownStatus.put(index,DownloadStatus.failure); return; } @@ -1895,9 +1993,10 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte reportMsg(Constants.REPORT_REX_CHAPTER_CONTENT_ERROR, url,"",getRequestHeader(request),200+"");//TODO: remove }*/ if(TextUtils.isEmpty(bodyStr) || bodyStr.trim().length()<10 ){ - Log.d( TAG,String.format("prepare book loadChaptContent %s isEmpty,reporting empty ....", index )); + Log.e( TAG,String.format("prepare book loadChaptContent %s isEmpty,reporting empty ....", index )); reportMsg(Constants.REPORT_REX_CHAPTER_CONTENT_ERROR, url,bodyStr,getRequestHeader(request),200+""); + chaptDownStatus.put(index,DownloadStatus.failure); // bodyStr += Constants.BAD_CHAR +Constants.BAD_CHAR +"内容正在搜索中,请稍后刷新内容"; return; } @@ -1947,6 +2046,8 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte } + + /*** * * @param url diff --git a/zhuike/src/main/java/com/novelbook/android/utils/Config.java b/zhuike/src/main/java/com/novelbook/android/utils/Config.java index 60e61e1..bc8c8eb 100644 --- a/zhuike/src/main/java/com/novelbook/android/utils/Config.java +++ b/zhuike/src/main/java/com/novelbook/android/utils/Config.java @@ -47,6 +47,12 @@ public class Config { private final static String AD_KEY = "adkey"; + //sexoption + private final static String SEX_OPTION_KEY="sexoption"; + private int sexOption =1; + + private final static String SHELF_ORDER_OPTION_KEY="shelforderoption"; + private int shelfOrderOption =1; private Context mContext; private static Config config; @@ -70,9 +76,7 @@ public class Config { sp.edit().putInt(SEX_OPTION_KEY,sexOption).commit(); } - //sexoption - public final static String SEX_OPTION_KEY="sexoption"; - private int sexOption =1; + private Config(Context mContext){ this.mContext = mContext.getApplicationContext(); @@ -302,6 +306,12 @@ public Boolean isShowAd(){ } + public int getShelfOrderOption() { + return sp.getInt(SHELF_ORDER_OPTION_KEY,shelfOrderOption ); + } + public void setShelfOrderOption(int option) { + sp.edit().putInt(SHELF_ORDER_OPTION_KEY,option).commit(); + } } diff --git a/zhuike/src/main/java/com/novelbook/android/utils/Constants.java b/zhuike/src/main/java/com/novelbook/android/utils/Constants.java index e1031ba..78a0315 100644 --- a/zhuike/src/main/java/com/novelbook/android/utils/Constants.java +++ b/zhuike/src/main/java/com/novelbook/android/utils/Constants.java @@ -15,6 +15,7 @@ public class Constants { public static final int MAXAGE_MAX =60*60*24*28; //28 天 ; public static final int MAXAGE_MULU = 60*60*24*7*2; //2周;; public static final String VERSION_ADDRESS ="version.xml"; + public static int SHELF_ORDER =0 ; public static AdSetting AD_SETTING; public static final int AD_TENCENT_QQ =1; @@ -73,7 +74,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 + public final static int MAX_SLEEP_4_CHAPT_DOWNLOAD =15000;//最多等待时间10s public final static int MAX_SHELF_CNT =100; public static final String REPORT_NEW_UPDATE ="HasNewUpdate"; //其它源有新章节 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 372aea1..17e6963 100644 --- a/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java +++ b/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java @@ -391,7 +391,7 @@ public class PageFactory implements ChangeSource{ " mBookUtil.muluRetryCount %s,thread.name %s",chid,slepttime , getChapters().size(),mBookUtil.muluRetryCount,Thread.currentThread().getName() ) ); slepttime=0; while( !file.exists() && slepttime + + + + + + + + + + diff --git a/zhuike/src/main/res/layout/app_bar_main2.xml b/zhuike/src/main/res/layout/app_bar_main2.xml index a07b09f..d74430d 100644 --- a/zhuike/src/main/res/layout/app_bar_main2.xml +++ b/zhuike/src/main/res/layout/app_bar_main2.xml @@ -70,7 +70,7 @@ android:text="女生" style="@style/radioButton" - /> + /> diff --git a/zhuike/src/main/res/layout/fragment_shelf_more_sheet.xml b/zhuike/src/main/res/layout/fragment_shelf_more_sheet.xml index 42a2fbc..adbd284 100644 --- a/zhuike/src/main/res/layout/fragment_shelf_more_sheet.xml +++ b/zhuike/src/main/res/layout/fragment_shelf_more_sheet.xml @@ -50,12 +50,63 @@ /> --> + + + + + + + + + + +