市场分发准备

This commit is contained in:
mwang 2019-06-14 23:45:09 +08:00
parent 8204477341
commit e423d8432e
18 changed files with 251 additions and 163 deletions

View File

@ -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,8 +38,10 @@ 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", "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
@ -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,37 +88,36 @@ 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 {
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\\"]}"'
}
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/"'
@ -136,13 +137,13 @@ android {
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

View File

@ -197,8 +197,8 @@
<meta-data
android:name="UMENG_APPKEY"
android:value="5cd6238a570df375c3000cc9" /> <!-- <meta-data android:name="UMENG_CHANNEL" android:value="${UMENG_CHANNEL_VALUE}"/> -->
<meta-data android:name="UMENG_CHANNEL" android:value="debug" />
<!--<meta-data android:name="UMENG_CHANNEL" android:value="${UMENG_CHANNEL_VALUE}" />-->
<!-- <meta-data android:name="UMENG_CHANNEL" android:value="debug" />-->
<meta-data android:name="UMENG_CHANNEL" android:value="${UMENG_CHANNEL_VALUE}" />
</application>
</manifest>

View File

@ -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

View File

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

View File

@ -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){

View File

@ -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();
}

View File

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

View File

@ -546,6 +546,7 @@ public class ReadActivity extends Activity_base implements AdInterface {
hideReadSetting();
pageFactory.updateTime();
pageFactory.showAd();
}
@ -886,10 +887,13 @@ 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());
}
}
}
}
@ -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);

View File

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

View File

@ -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;
@ -36,13 +38,15 @@ public class UrlFactory {
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) {

View File

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

View File

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

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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

View File

@ -186,8 +186,11 @@ public class GsonUtil {
while (it.hasNext()) {
JsonElement e = (JsonElement) it.next();
//JsonElement转换为JavaBean对象
Novel nv = (Novel) gson.fromJson(e, Novel.class);
if(nv!=null) {
list.add((Novel) gson.fromJson(e, Novel.class));
}
}
return list;
}
}

View File

@ -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,7 +1278,8 @@ 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()));

View File

@ -8,38 +8,80 @@
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="SELECTED_BUILD_VARIANT" value="aliDebug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleAliDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileAliDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
<task>generateAliDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/src/ali/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes" />
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/compileDebugUnitTestJavaWithJavac/classes" />
<output url="file://$MODULE_DIR$/build/intermediates/javac/aliDebug/compileAliDebugJavaWithJavac/classes" />
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/aliDebugUnitTest/compileAliDebugUnitTestJavaWithJavac/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/compileDebugAndroidTestRenderscript/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/ali/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/aliDebug/compileAliDebugAidl/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/ali/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/aliDebug/compileAliDebugRenderscript/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/ali/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/ali/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/aliDebug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/aliDebug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/aliDebug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/aliDebug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/aliDebug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/aliDebug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/aliDebug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/ali/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/aliDebugAndroidTest/compileAliDebugAndroidTestAidl/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/ali/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/aliDebugAndroidTest/compileAliDebugAndroidTestRenderscript/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/ali/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/ali/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAliDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAliDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAliDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAliDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAliDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAliDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAliDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/ali/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAliDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testAliDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testAliDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testAliDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAliDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAliDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAliDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/ali/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/ali/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/ali/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/ali/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/ali/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/ali/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/ali/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAli/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAli/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAli/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAli/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAli/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAli/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAli/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAli/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testAli/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testAli/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testAli/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAli/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAli/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAli/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
@ -87,25 +129,16 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotation_processor_list" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/apk_list" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundle_manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check_manifest_result" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_app_manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_app_info_output_file" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_main_apk_resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_merged_manifests" />
<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-not-compiled-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
@ -114,15 +147,12 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/processed_res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard-files" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard-rules" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res_stripped" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shader_assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/signing_config" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />