diff --git a/zhuike/build.gradle b/zhuike/build.gradle index 4430e48..52d69a0 100644 --- a/zhuike/build.gradle +++ b/zhuike/build.gradle @@ -17,8 +17,8 @@ android { applicationId "com.novelbook.android" minSdkVersion 19 //target 19 Android 4.4 以下版本仅占比4.1% targetSdkVersion 28 - versionCode 6 - versionName "6.0" + versionCode 1 + versionName "v1.0" // testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -38,9 +38,11 @@ android { debug { // 显示Log buildConfigField "boolean", "LOG_DEBUG", "true" - buildConfigField "String", "MAIN_HOST", '"http://xiaoshuofenxiang.com/api/"' - buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/g.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"' - // buildConfigField "String", "CHANNEL",'"DEBUG"' + 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", '""' + + // buildConfigField "String", "CHANNEL",'"DEBUG"' versionNameSuffix "-debug" minifyEnabled false zipAlignEnabled false @@ -58,7 +60,7 @@ android { shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - /* applicationVariants.all { variant -> + applicationVariants.all { variant -> variant.outputs.all { output -> def outFile = output.outputFile if (outFile != null && outFile.name.endsWith(".apk")) { @@ -68,17 +70,17 @@ android { } } - }*/ + } signingConfig signingConfigs.releaseConfig } } //渠道 - /* productFlavors { + productFlavors { // googleplay {} ali { applicationId "com.zhushou.wangshu" versionName "v1.0" - buildConfigField "String", "MAIN_HOST", '"http://xiaoshuofenxiang.com/api/"' + buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"' buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/g.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"' @@ -86,63 +88,62 @@ android { qq { applicationId "com.zhushou.wangshu" versionName "v1.0" - buildConfigField "String", "MAIN_HOST", '"http://xiaoshuofenxiang.com/api/"' + buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"' buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/g.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"' //buildConfigField "String", "API_HOST", '""' } - *//*kuan { - applicationId "com.novelbook.android" - versionName "v-kuan-1.0" - buildConfigField "String", "MAIN_HOST", '"http://xiaoshuofenxiang.com/api/"' - buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/g.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"' - //buildConfigField "String", "API_HOST", '""' - buildConfigField "String", "CHANNEL",'"kuan"' - } + xiaomi { - applicationId "com.novelbook.android" - versionName "v-xiaomi-1.0" - buildConfigField "String", "MAIN_HOST", '"http://xiaoshuofenxiang.com/api/"' + applicationId "com.zhushou.wangshu" + versionName "v1.0" + buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"' buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/g.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"' - //buildConfigField "String", "API_HOST", '""' - buildConfigField "String", "CHANNEL",'"xiaomi"' - } - - qxs { - applicationId "com.novelbook.android.qxs" - versionName "v-qxs-5.0" - buildConfigField "String", "MAIN_HOST", '"http://chqxs.xiaoshuofenxiang.com/api/"' - buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/qxs.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"' - //buildConfigField "String", "API_HOST", '""' } - wzzw { - applicationId "com.novelbook.android.wzzw" - versionName "v-wzzw-5.0" - buildConfigField "String", "MAIN_HOST", '"http://chwzzw.xiaoshuofenxiang.com/api/"' - buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/wzzw.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"' - // buildConfigField "String", "API_HOST", '""' - } - bo { - applicationId "com.novelbook.android.bo" - versionName "v-bo-5.0" - buildConfigField "String", "MAIN_HOST", '"http://chbo.xiaoshuofenxiang.com/api/"' - buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/bo.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"' - // buildConfigField "String", "API_HOST", '""' - } - g { - applicationId "com.novelbook.android.g" - versionName "v-g-5.0" - buildConfigField "String", "MAIN_HOST", '"http://chg.xiaoshuofenxiang.com/api/"' + huawei { + applicationId "com.zhushou.yueshu" + versionName "v1.0" + buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"' buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/g.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"' - // buildConfigField "String", "API_HOST", '""' - }*//* + + } + + kuan { + applicationId "com.zhushou.wangshu" + versionName "v1.0" + buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"' + buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/g.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"' + + } + + /* wzzw { + applicationId "com.novelbook.android.wzzw" + versionName "v-wzzw-5.0" + buildConfigField "String", "MAIN_HOST", '"http://chwzzw.xiaoshuofenxiang.com/api/"' + buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/wzzw.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"' + // buildConfigField "String", "API_HOST", '""' + } + bo { + applicationId "com.novelbook.android.bo" + versionName "v-bo-5.0" + buildConfigField "String", "MAIN_HOST", '"http://chbo.xiaoshuofenxiang.com/api/"' + buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/bo.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"' + // buildConfigField "String", "API_HOST", '""' + } + g { + applicationId "com.novelbook.android.g" + versionName "v-g-5.0" + buildConfigField "String", "MAIN_HOST", '"http://chg.xiaoshuofenxiang.com/api/"' + buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/g.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"' + // buildConfigField "String", "API_HOST", '""' + }*/ //批量配置 productFlavors.all { flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name] } - }*/ + } android { lintOptions { abortOnError false diff --git a/zhuike/src/main/AndroidManifest.xml b/zhuike/src/main/AndroidManifest.xml index b8ad3f2..d323491 100644 --- a/zhuike/src/main/AndroidManifest.xml +++ b/zhuike/src/main/AndroidManifest.xml @@ -197,8 +197,8 @@ - - + + \ No newline at end of file diff --git a/zhuike/src/main/java/com/novelbook/android/ActivityAnounce.java b/zhuike/src/main/java/com/novelbook/android/ActivityAnounce.java index e10b622..65c8d0a 100644 --- a/zhuike/src/main/java/com/novelbook/android/ActivityAnounce.java +++ b/zhuike/src/main/java/com/novelbook/android/ActivityAnounce.java @@ -2,9 +2,17 @@ package com.novelbook.android; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.text.TextUtils; +import android.widget.TextView; + +import com.novelbook.android.utils.Constants; + +import butterknife.BindView; public class ActivityAnounce extends Activity_base { + @BindView(R.id.tvAnnounce) + TextView tvAnnounce; @Override public int getLayoutRes() { return R.layout.activity_anounce; @@ -24,7 +32,10 @@ public class ActivityAnounce extends Activity_base { @Override protected void initData() { - + if(TextUtils.isEmpty(Constants.DECLARE.trim())){ + return; + } + tvAnnounce.setText(Constants.DECLARE); } @Override diff --git a/zhuike/src/main/java/com/novelbook/android/Activity_base.java b/zhuike/src/main/java/com/novelbook/android/Activity_base.java index f3e8d2d..428312a 100644 --- a/zhuike/src/main/java/com/novelbook/android/Activity_base.java +++ b/zhuike/src/main/java/com/novelbook/android/Activity_base.java @@ -196,17 +196,7 @@ public abstract class Activity_base extends AppCompatActivity implements Native protected abstract void setTitle(); protected abstract void initData() ; - @Override - protected void onResume() { - super.onResume(); - // MobclickAgent.onResume(this); - } - @Override - protected void onPause(){ - super.onPause(); - hideProgress(); - // MobclickAgent.onPause(this); - } + protected void closeCurrentActitivty(){ if( this instanceof BookActivity ) { // return; @@ -931,7 +921,7 @@ public abstract class Activity_base extends AppCompatActivity implements Native }; public TTAdNative getAdNative(){ - return mTTAdNative; + return getTTAdNative();//mTTAdNative; } void loadInteractionAd(String codeId) { //step4:创建插屏广告请求参数AdSlot,具体参数含义参考文档 @@ -1324,4 +1314,20 @@ public abstract class Activity_base extends AppCompatActivity implements Native Log.i(TAG, "onVideoPageClose"); } }; + + + + + @Override + protected void onResume() { + super.onResume(); + // MobclickAgent.onResume(this); + } + @Override + protected void onPause(){ + super.onPause(); + hideProgress(); + // MobclickAgent.onPause(this); + } + } diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/BasicFragment.java b/zhuike/src/main/java/com/novelbook/android/Fragments/BasicFragment.java index 81f37cc..cc68e1b 100644 --- a/zhuike/src/main/java/com/novelbook/android/Fragments/BasicFragment.java +++ b/zhuike/src/main/java/com/novelbook/android/Fragments/BasicFragment.java @@ -45,7 +45,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.novelbook.android.AD.toutiao.TToast; import com.novelbook.android.Activity_base; -import com.novelbook.android.Activity_base_ViewBinding; + import com.novelbook.android.Activity_paihangbang; import com.novelbook.android.Activity_shudan; import com.novelbook.android.BookActivity; @@ -610,6 +610,9 @@ void initTabs(){ * 加载 toutiao feed广告 */ void loadListAd( BookListAdapter adapter, int adCnt, boolean addFooter) { + if(!Constants.AD_SETTING.isShowAdsense()){ + return; + } if(Constants.AD_SETTING.getInformationFlow().getSource()==Constants.AD_TENCENT_QQ) { loadListAd_qq(adapter, adCnt, addFooter); }else if(Constants.AD_SETTING.getInformationFlow().getSource()==Constants.AD_TOUTIAO){ 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 40f9610..863bb53 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 @@ -270,7 +270,7 @@ public class Fragment_Shelf extends BasicFragment { //swipeRefreshLayout.setRefreshing(true); pageNo = 1; getUpdatedData(); - // TODO 获取数据 + } }); @@ -293,9 +293,13 @@ public class Fragment_Shelf extends BasicFragment { @Override protected void fillData() { + /* for(Novel nv :bookLists){ + nv.testUpdate(); + }*/ mAdapter.setData(bookLists); + } public void initReceyleView() { @@ -761,7 +765,7 @@ public class Fragment_Shelf extends BasicFragment { @Override public void onResume() { super.onResume(); - getUpdatedData(); //TODO: 更新书的状态,是不有更新 + getUpdatedData(); if (bottomSheetDialog != null) { bottomSheetDialog.hide(); } diff --git a/zhuike/src/main/java/com/novelbook/android/MyApp.java b/zhuike/src/main/java/com/novelbook/android/MyApp.java index b16160c..1bff797 100644 --- a/zhuike/src/main/java/com/novelbook/android/MyApp.java +++ b/zhuike/src/main/java/com/novelbook/android/MyApp.java @@ -56,20 +56,8 @@ public class MyApp extends Application { if(Constants.AD_SETTING==null){ Constants.AD_SETTING = new AdSetting(); } - - /* Constants.SHOWAD =config.isShowAd(); - Constants.AD_CHAPT_TOP_BANNER_PER_PAGE_COUNT = config.getAdTopBannerRate(); - Constants.AD_CHAPT_NATIVE_BANNER_PER_PAGE_COUNT= config.getAdNativeBannerInLinesRate() ; - Constants.AD_SPLASH_SOURCE=config.getAdSplashSource(); - Constants.AD_UNIFIED_RECYCLE_SOURCE=config.getAdUnifiedRecycleSource(); - Constants.AD_NATIVE_BANNER_SOURCE=config.getAdNativeBannerSource(); - Constants.AD_BANNER_SOURCE=2;//config.getAdBannerSource();*/ - - - - - - + Constants.SHOW_NOVEL_CHAPTER_URL =config.isShowChatpUrl(); + Constants.DECLARE = config.getDeclare(); Constants.ONE_DP_SIZE = (int)applicationContext.getResources().getDimension(R.dimen.one_dp); } diff --git a/zhuike/src/main/java/com/novelbook/android/ReadActivity.java b/zhuike/src/main/java/com/novelbook/android/ReadActivity.java index 1e4b17b..b423101 100644 --- a/zhuike/src/main/java/com/novelbook/android/ReadActivity.java +++ b/zhuike/src/main/java/com/novelbook/android/ReadActivity.java @@ -546,6 +546,7 @@ public class ReadActivity extends Activity_base implements AdInterface { hideReadSetting(); pageFactory.updateTime(); + pageFactory.showAd(); } @@ -886,11 +887,14 @@ public class ReadActivity extends Activity_base implements AdInterface { /* tvUrl.setVisibility(View.VISIBLE); tvUrl.setText("abcd+" + pageFactory.getChapter().getChapterUrl());*/ - if(pageFactory.getChapter()!=null && !TextUtils.isEmpty(pageFactory.getChapter().getChapterUrl())) { - tvUrl.setVisibility(View.VISIBLE); - tvUrl.setText(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()); + } } + } } /** @@ -1134,23 +1138,26 @@ public class ReadActivity extends Activity_base implements AdInterface { // mBannerContainer.removeAllViews(); // mBannerContainer.removeAllViews(); // mBannerContainer.setBackgroundResource(R.color.transparent); + + Log.d(TAG, String.format("loadBannerAd:showNativeBannerInLines height %s, adY %s ",height, adY/Constants.ONE_DP_SIZE )); + hideAdSlot(mBannerContainer); hideAdSlot(mNative_status_banner_container); if(height<=0){ return; } - Log.d(TAG, String.format("loadBannerAd:showNativeBannerInLines width %s, adY %s ",Constants.SCREEN_WIDTH_PIX-50, adY/Constants.ONE_DP_SIZE )); + if( adY >390*Constants.ONE_DP_SIZE){ return; } - hideAdSlot(mTopBannerContainer); + + // hideAdSlot(mTopBannerContainer); if(mBannerContainer.getChildCount()>0) { mBannerContainer.removeAllViews(); - Log.d(TAG, "loadBannerAd: hideAdSlot()"); } tmpFrame =mBannerContainer; mLastBannerTime=0; - Log.d(TAG, String.format("loadBannerAd:showNativeBannerInLines width %s, height %s ,adY %s ",Constants.SCREEN_WIDTH_PIX-50,height,adY)); + Log.d(TAG, String.format("loadBannerAd:showNativeBannerInLines to get ad, width %s, height %s ,adY %s ",Constants.SCREEN_WIDTH_PIX-50,height,adY)); loadNativeBannerAd(mBannerContainer); FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mBannerContainer.getLayoutParams(); params.setMargins(10*Constants.ONE_DP_SIZE, adY+5*Constants.ONE_DP_SIZE, 10*Constants.ONE_DP_SIZE, 0*Constants.ONE_DP_SIZE); @@ -1170,8 +1177,8 @@ public class ReadActivity extends Activity_base implements AdInterface { // Log.d(TAG, String.format("loadBannerAd:showTopBanner width %s, height %s ,adY %s ",Constants.SCREEN_WIDTH_PIX-50,adHeight,adY)); tmpFrame =mTopBannerContainer; // hideAdSlot(mBannerContainer); - - hideAdSlot(mBannerContainer); + Log.d(TAG, String.format("loadBannerAd:showTopBanner width %s, height %s ,adY %s ",Constants.SCREEN_WIDTH_PIX-50,adHeight,adY)); + //hideAdSlot(mBannerContainer); hideAdSlot(mNative_status_banner_container); if(adHeight<=0){ hideAdSlot(mTopBannerContainer); @@ -1179,7 +1186,7 @@ public class ReadActivity extends Activity_base implements AdInterface { } int topMargin = adY >200*Constants.ONE_DP_SIZE ? adY -15*Constants.ONE_DP_SIZE :adY -5*Constants.ONE_DP_SIZE; - Log.d(TAG, String.format("loadBannerAd:showTopBanner width %s, height %s ,adY %s ",Constants.SCREEN_WIDTH_PIX-50,adHeight,adY)); + FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mTopBannerContainer.getLayoutParams(); loadBanner(mTopBannerContainer, Constants.SCREEN_WIDTH_PIX-50,adHeight); // loadNativeBannerAd(mTopBannerContainer,BuildConfig.AD_SLOT_TOUTIAO_BANNER_NATIVE_ID, 304,200); diff --git a/zhuike/src/main/java/com/novelbook/android/adapter/BookListAdapter.java b/zhuike/src/main/java/com/novelbook/android/adapter/BookListAdapter.java index 1038565..784b3e6 100644 --- a/zhuike/src/main/java/com/novelbook/android/adapter/BookListAdapter.java +++ b/zhuike/src/main/java/com/novelbook/android/adapter/BookListAdapter.java @@ -166,7 +166,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol }else if(mDatas.get(position) instanceof NativeExpressADView ){ return ITEM_VIEW_TYPE_QQ_NATIVE_EXPRESS; } - + Log.d(TAG, String.format("getItemViewType exception 1: position %s, mDatas.get(position) %s ,mDatas.size %s",position, mDatas.get(position),mDatas.size() )); } else if ( position == mDatas.size()) { //最后一个item设置为footerView @@ -177,7 +177,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol } else { return TYPE_ITEM; } - + Log.d(TAG, String.format("getItemViewType exception 2: position %s, mDatas.get(position) %s ,mDatas.size %s",position, mDatas.get(position),mDatas.size() )); return EMPTY_VIEW; // return super.getItemViewType(position); @@ -259,9 +259,12 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol } }else if (hd instanceof EmptyViewHolder) { - EmptyViewHolder holder = (EmptyViewHolder)hd; - holder.tvEmpty.setVisibility(View.VISIBLE); - holder.tvEmpty.setText(norecord); + EmptyViewHolder holder = (EmptyViewHolder) hd; + holder.tvEmpty.setVisibility(View.GONE); + if (mDatas == null || mDatas != null && mDatas.size() == 0) { + holder.tvEmpty.setVisibility(View.VISIBLE); + holder.tvEmpty.setText(norecord); + } }else if (hd instanceof QQ_ExpressViewHolder) { QQ_ExpressViewHolder holder = (QQ_ExpressViewHolder)hd; // holder.title.setVisibility(View.VISIBLE); diff --git a/zhuike/src/main/java/com/novelbook/android/netapi/UrlFactory.java b/zhuike/src/main/java/com/novelbook/android/netapi/UrlFactory.java index dc0b6ab..7a5d0f1 100644 --- a/zhuike/src/main/java/com/novelbook/android/netapi/UrlFactory.java +++ b/zhuike/src/main/java/com/novelbook/android/netapi/UrlFactory.java @@ -2,6 +2,8 @@ package com.novelbook.android.netapi; +import android.util.Log; + import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -33,16 +35,18 @@ public class UrlFactory { if (host != null) { us = host.getJSONArray(key); if (us != null && us.length() > index) { - return us.getString(index) ;//+ uri; + return us.getString(index) ;//+ uri; } } - return ""; - /*int value = (us == null || us.length()==0) ? index : index - us.length(); + // return ""; + int value = (us == null || us.length()==0) ? index : index - us.length(); int second = 90 + 7; int a1 = value / 2 +1; int a2 = value % 2; - return String.format("http://%s%s%s.%s%s%s%s.com", key.charAt(0), (char)(second + a2), a1, "xiao", "shuo", "fen", "xiang");*/ + String url = String.format("http://%s%s%s.%s%s%s%s.com", key.charAt(0), (char)(second + a2), a1, "xiao", "shuo", "fen", "xiang"); + Log.d("randomurl", "getUrl: " + url); + return url; } public static void main(String[] args) { diff --git a/zhuike/src/main/java/com/novelbook/android/netutils/NetUtil.java b/zhuike/src/main/java/com/novelbook/android/netutils/NetUtil.java index 817b622..3e4aff3 100644 --- a/zhuike/src/main/java/com/novelbook/android/netutils/NetUtil.java +++ b/zhuike/src/main/java/com/novelbook/android/netutils/NetUtil.java @@ -72,7 +72,7 @@ public class NetUtil { return false; } long t =Constants.MAXAGE_G*1000 - (new Date().getTime() - Constants.LAST_G ) ; - Log.d(TAG, "isHostExpires: time left is " +CommonUtil.getTimeCnt4Read(t,true)); + Log.d(TAG, "HttpMethods intercept isHostExpires: time left is " +CommonUtil.getTimeCnt4Read(t,true)); // t=0; return t < 0; @@ -81,12 +81,13 @@ public class NetUtil { public static JSONObject getHost(boolean isMainApi) { JSONObject jsonObject=null; if(!isMainApi && isHostExpires()){ - Log.d(TAG, String.format("isHostExpires prepare book: main API maxAge %s, is expired, loading main API again ",CommonUtil.getTimeCnt4Read(Constants.MAXAGE_G*1000,true))); + Log.d(TAG, String.format("HttpMethods intercept isHostExpires prepare book: main API maxAge %s, is expired, loading main API again ",CommonUtil.getTimeCnt4Read(Constants.MAXAGE_G*1000,true))); getHostPolicy(); } if (TextUtils.isEmpty(hosts)) { Config config = Config.getInstance(); hosts = config.getBaseUrl(); + Log.d(TAG, " hostconfig gethosts " +hosts); if(TextUtils.isEmpty(hosts)){ return null; } @@ -327,6 +328,7 @@ public class NetUtil { public static void getHostPolicy(){ + Log.d(TAG, " hostconfig is in ... isRequestHosts? "+isRequestHosts ); if(isRequestHosts){ return; } @@ -341,6 +343,7 @@ public class NetUtil { String resultstr = jsonObject.getString("hosts"); Config config =Config.createConfig(MyApp.applicationContext); config.setBaseUrl(resultstr); + Log.d(TAG, " hostconfig sethosts " +resultstr); //config.setBaseUrl(resultstr); hosts=""; Constants.LAST_G = new Date().getTime(); @@ -358,6 +361,11 @@ public class NetUtil { // Constants.minVersion = // config.setRootUrl( jsonObject.getString("masterDomains")); isRequestHosts =false; + + Constants.SHOW_NOVEL_CHAPTER_URL = jsonObject.getBoolean("showTargetSiteChatperUrl"); + Constants.DECLARE =jsonObject.getString("disclaimer"); + config.setShowChaptUrl( Constants.SHOW_NOVEL_CHAPTER_URL); + config.setDeclare( Constants.DECLARE ); } catch (Exception e) { e.printStackTrace(); } @@ -381,7 +389,9 @@ public class NetUtil { String tmp = jsonObject.getString("upgradeUrl"); Constants.updateUrl = TextUtils.isEmpty(tmp) ? Constants.updateUrl : tmp; Constants.minVersion = jsonObject.getInt("minVersion"); + //if(jsonObject.has("showTargetSiteChatperUrl")) { + //} Constants.version = CommonUtil.getVersionCode(MyApp.applicationContext); if (lastUpgradCheck == 0 || Constants.version < Constants.minVersion) { lastUpgradCheck = new Date().getTime(); diff --git a/zhuike/src/main/java/com/novelbook/android/netutils/RetryInterceptor.java b/zhuike/src/main/java/com/novelbook/android/netutils/RetryInterceptor.java index 35408e3..65e4bdf 100644 --- a/zhuike/src/main/java/com/novelbook/android/netutils/RetryInterceptor.java +++ b/zhuike/src/main/java/com/novelbook/android/netutils/RetryInterceptor.java @@ -162,12 +162,16 @@ public class RetryInterceptor implements Interceptor { if (response != null && response.isSuccessful()) { // rh = null; - Log.d(TAG, String.format("HttpMethods intercept: set rh null,return response")); - if (path.equals("/api/g")) { + Log.d(TAG, String.format("HttpMethods intercept isHostExpires get path %s" ,path)); + if (path.equals("/api/g/") || path.equals("/api/g")) { + Log.d(TAG, String.format("HttpMethods intercept isHostExpires get main api %s" ,path)); String cacheControl = response.header("Cache-Control"); + Log.d(TAG, String.format("HttpMethods intercept isHostExpires, cacheControl %s" ,cacheControl)); if(!TextUtils.isEmpty(cacheControl)) { try { + Constants.MAXAGE_G = Integer.parseInt(cacheControl.substring("max-age=".length())); + Log.d(TAG, String.format("HttpMethods intercept isHostExpires Constants.MAXAGE_G: %s" ,Constants.MAXAGE_G)); }catch (Exception e) { Log.e(TAG, "intercept: parse max age error", e); 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 f6ded1a..715a439 100644 --- a/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java +++ b/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java @@ -1699,7 +1699,7 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte } Chapter chapter = mChapters.get(index -1); - String refUrl=REUtil.getDomain(mSite.getMuluUrl()); + String refUrl=mSite.getMuluUrl(); if(index>1){ refUrl = mChapters.get(index -2).getChapterUrl(); } 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 704b614..d780b57 100644 --- a/zhuike/src/main/java/com/novelbook/android/utils/Config.java +++ b/zhuike/src/main/java/com/novelbook/android/utils/Config.java @@ -41,10 +41,9 @@ public class Config { public final static int PAGE_MODE_SLIDE = 2; public final static int PAGE_MODE_NONE = 3; public final static boolean SHOW_AD = false; - private final static String SHOW_AD_KEY = "showAd"; + private final static String DECLARE_KEY = "declarekey"; + private final static String SHOW_CHAPT_URL_KEY = "chapturlkey"; private static final String PRE_LOAD_CHAPT_KEY ="preloadchapt" ; - private static final String AD_TOP_BANNER_SEEDS_KEY ="topbannerseeds" ; - private static final String AD_NATVIE_BANNER_IN_LINES_SEEDS_KEY ="nativebannerinlinesseeds" ; private final static String AD_KEY = "adkey"; @@ -286,17 +285,22 @@ public Boolean isShowAd(){ public void setAdSplashSource(int source){ sp.edit().putInt(AD_SPLASH_SOURCE_KEY,source).commit(); } - - - public int getAdNativeBannerInLinesRate(){ - return sp.getInt(AD_NATVIE_BANNER_IN_LINES_SEEDS_KEY,0); - } - - public void setAdNativeBannerInLinesRate(int pageCnt){ - sp.edit().putInt(AD_NATVIE_BANNER_IN_LINES_SEEDS_KEY,pageCnt).commit(); - } */ + public String getDeclare(){ + return sp.getString(DECLARE_KEY,"" ); + } + + public void setDeclare(String declare){ + sp.edit().putString(DECLARE_KEY,declare).commit(); + } + public Boolean isShowChatpUrl(){ + return sp.getBoolean(SHOW_CHAPT_URL_KEY,false); + } + public void setShowChaptUrl(boolean isShowChatpUrl){ + sp.edit().putBoolean(SHOW_CHAPT_URL_KEY,isShowChatpUrl).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 3fce914..cb197ca 100644 --- a/zhuike/src/main/java/com/novelbook/android/utils/Constants.java +++ b/zhuike/src/main/java/com/novelbook/android/utils/Constants.java @@ -27,6 +27,8 @@ public class Constants { public static int SCREEN_HEIGHT_PIX =1920 ; public static int SCREEN_WIDTH_PIX = 1080; + public static String DECLARE =""; + public static boolean SHOW_NOVEL_CHAPTER_URL =false; /* public static boolean SHOWAD =false ; public static int AD_NATIVE_BANNER_SOURCE = 1 ; //1:tencent,2:toutiao public static int AD_BANNER_SOURCE = 2 ; //1:tencent,2:toutiao diff --git a/zhuike/src/main/java/com/novelbook/android/utils/GsonUtil.java b/zhuike/src/main/java/com/novelbook/android/utils/GsonUtil.java index 3aec00d..9ab6dda 100644 --- a/zhuike/src/main/java/com/novelbook/android/utils/GsonUtil.java +++ b/zhuike/src/main/java/com/novelbook/android/utils/GsonUtil.java @@ -186,7 +186,10 @@ public class GsonUtil { while (it.hasNext()) { JsonElement e = (JsonElement) it.next(); //JsonElement转换为JavaBean对象 - list.add((Novel) gson.fromJson(e, Novel.class)); + Novel nv = (Novel) gson.fromJson(e, Novel.class); + if(nv!=null) { + list.add((Novel) gson.fromJson(e, Novel.class)); + } } return list; } 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 ba538d7..7dcb7ee 100644 --- a/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java +++ b/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java @@ -952,8 +952,9 @@ private void hideSysUI(){ waitPaint.setTextAlign(Paint.Align.CENTER); c.drawText("正加载第三方网站 " +site, targetRect.centerX(), baseline, waitPaint); baseline+=40; - c.drawText(url , targetRect.centerX(), baseline, waitPaint); - + if(Constants.SHOW_NOVEL_CHAPTER_URL) { + c.drawText(url, targetRect.centerX(), baseline, waitPaint); + } String chaptName= mBookUtil.getChapter(currentChapter).getChapterName(); if(!TextUtils.isEmpty(chaptName)) { if(chaptName.length()>100) @@ -1091,9 +1092,10 @@ private void hideSysUI(){ mAdType =AdTpye.BANNER; if(trPage.getBannerHeight()==0) { - mAd.showNativeBannerInLines(0,0);//hide ad container + mAd.showTopBanner(0,0);//hide banner container } - // mAd.showNativeBannerInLines(0,0); + + // } @@ -1105,7 +1107,7 @@ private void hideSysUI(){ } }*/ - if (m_lines.size() > 0) { + float y = marginHeight +mAdHeight; String lastLine =""; @@ -1174,17 +1176,22 @@ private void hideSysUI(){ mAdHeight = (int) adHeight; mAdType = AdTpye.CHAPTEREND; + }else{ + mAd.showNativeBannerInLines(0, 0);//清除内容广告 } - if(trPage.getBannerHeight()==0 || mAdType !=AdTpye.BANNER){ - mAd.showTopBanner(0, 0);//清除所有广告 - } // showAd((int) adHeight, (int) adY); Log.d(TAG, String.format("loadBannerAd: AD is requested, adtype %s, adHeight %s, ady %s",mAdType,adHeight,adY)); } // Log.d(TAG,String.format("ad + statusMarginBottom %s ",200+ statusMarginBottom)); // Log.d(TAG,String.format("adHeight %s, adY %s",adHeight,adY)); + + if(trPage.getBannerHeight()==0 ){ + mAd.showTopBanner(0, 0);//清除 banner广告 + } + if(trPage.getNativeBannerHeight()==0 && mAdType != AdTpye.CHAPTEREND){ + mAd.showNativeBannerInLines(0,0);//hide content banner container } //画进度及时间 @@ -1271,10 +1278,11 @@ private void hideSysUI(){ } public void showAd(){ - if(mStatus == Status.LASTPAGE || mAd==null){ + Log.d(TAG, String.format("loadBannerAd showAd: mAdType %s ",mAdType )); + if(mStatus == Status.LASTPAGE || mAd==null ||currentPage==null){ return; } - Log.d(TAG, String.format("loadBannerAd showAd: mAdType %s, pageNo %s",mAdType, currentPage.getPageNo())); + Log.d(TAG, String.format("loadBannerAd showAd: mAdType %s, pageNo %s",mAdType, currentPage.getPageNo())); if(mAdType ==AdTpye.BANNER){ mAd.showTopBanner(mAdHeight,mAdY); }else if(mAdType == AdTpye.NATIVEINLINES){ diff --git a/zhuike/zhuike.iml b/zhuike/zhuike.iml index 241f1b2..139a93f 100644 --- a/zhuike/zhuike.iml +++ b/zhuike/zhuike.iml @@ -8,38 +8,80 @@ - - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -87,25 +129,16 @@ - - - - - - - - - @@ -114,15 +147,12 @@ - - -